diff --git a/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/Mods/EmptyFreeformModAutoplay.cs b/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/Mods/EmptyFreeformModAutoplay.cs index f705009d18..d4496a24fd 100644 --- a/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/Mods/EmptyFreeformModAutoplay.cs +++ b/Templates/Rulesets/ruleset-empty/osu.Game.Rulesets.EmptyFreeform/Mods/EmptyFreeformModAutoplay.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.EmptyFreeform.Replays; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Rulesets.EmptyFreeform.Mods { @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.EmptyFreeform.Mods { ScoreInfo = new ScoreInfo { - User = new User { Username = "sample" }, + User = new APIUser { Username = "sample" }, }, Replay = new EmptyFreeformAutoGenerator(beatmap).Generate(), }; diff --git a/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/Mods/PippidonModAutoplay.cs b/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/Mods/PippidonModAutoplay.cs index 4565c97d1a..6e1fe42ee2 100644 --- a/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/Mods/PippidonModAutoplay.cs +++ b/Templates/Rulesets/ruleset-example/osu.Game.Rulesets.Pippidon/Mods/PippidonModAutoplay.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Pippidon.Replays; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Rulesets.Pippidon.Mods { @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Pippidon.Mods { ScoreInfo = new ScoreInfo { - User = new User { Username = "sample" }, + User = new APIUser { Username = "sample" }, }, Replay = new PippidonAutoGenerator(beatmap).Generate(), }; diff --git a/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/Mods/EmptyScrollingModAutoplay.cs b/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/Mods/EmptyScrollingModAutoplay.cs index 431994e098..c5bacb522f 100644 --- a/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/Mods/EmptyScrollingModAutoplay.cs +++ b/Templates/Rulesets/ruleset-scrolling-empty/osu.Game.Rulesets.EmptyScrolling/Mods/EmptyScrollingModAutoplay.cs @@ -5,8 +5,8 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.EmptyScrolling.Replays; using osu.Game.Scoring; -using osu.Game.Users; using System.Collections.Generic; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Rulesets.EmptyScrolling.Mods { @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.EmptyScrolling.Mods { ScoreInfo = new ScoreInfo { - User = new User { Username = "sample" }, + User = new APIUser { Username = "sample" }, }, Replay = new EmptyScrollingAutoGenerator(beatmap).Generate(), }; diff --git a/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/Mods/PippidonModAutoplay.cs b/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/Mods/PippidonModAutoplay.cs index 4565c97d1a..6e1fe42ee2 100644 --- a/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/Mods/PippidonModAutoplay.cs +++ b/Templates/Rulesets/ruleset-scrolling-example/osu.Game.Rulesets.Pippidon/Mods/PippidonModAutoplay.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Pippidon.Replays; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Rulesets.Pippidon.Mods { @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Pippidon.Mods { ScoreInfo = new ScoreInfo { - User = new User { Username = "sample" }, + User = new APIUser { Username = "sample" }, }, Replay = new PippidonAutoGenerator(beatmap).Generate(), }; diff --git a/osu.Android.props b/osu.Android.props index 6d2e8428a7..4f9f83f199 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -52,7 +52,7 @@ - + diff --git a/osu.Desktop/DiscordRichPresence.cs b/osu.Desktop/DiscordRichPresence.cs index e2b40e9dc6..e1e7e6ad18 100644 --- a/osu.Desktop/DiscordRichPresence.cs +++ b/osu.Desktop/DiscordRichPresence.cs @@ -11,10 +11,10 @@ using osu.Framework.Graphics; using osu.Framework.Logging; using osu.Game.Configuration; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Users; using LogLevel = osu.Framework.Logging.LogLevel; -using User = osu.Game.Users.User; namespace osu.Desktop { @@ -27,7 +27,7 @@ namespace osu.Desktop [Resolved] private IBindable ruleset { get; set; } - private IBindable user; + private IBindable user; private readonly IBindable status = new Bindable(); private readonly IBindable activity = new Bindable(); diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModAutoplay.cs b/osu.Game.Rulesets.Catch/Mods/CatchModAutoplay.cs index 6f3e6763bd..11fffb31de 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModAutoplay.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModAutoplay.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Catch.Replays; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Rulesets.Catch.Mods { @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Catch.Mods { public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => new Score { - ScoreInfo = new ScoreInfo { User = new User { Username = "osu!salad" } }, + ScoreInfo = new ScoreInfo { User = new APIUser { Username = "osu!salad" } }, Replay = new CatchAutoGenerator(beatmap).Generate(), }; } diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModCinema.cs b/osu.Game.Rulesets.Catch/Mods/CatchModCinema.cs index 1b7d254321..6d2286b957 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModCinema.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModCinema.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Replays; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Rulesets.Catch.Mods { @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Catch.Mods { public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => new Score { - ScoreInfo = new ScoreInfo { User = new User { Username = "osu!salad" } }, + ScoreInfo = new ScoreInfo { User = new APIUser { Username = "osu!salad" } }, Replay = new CatchAutoGenerator(beatmap).Generate(), }; } diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModAutoplay.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModAutoplay.cs index 86f667466f..1504c868d0 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModAutoplay.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModAutoplay.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Replays; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Rulesets.Mania.Mods { @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Mania.Mods { public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => new Score { - ScoreInfo = new ScoreInfo { User = new User { Username = "osu!topus" } }, + ScoreInfo = new ScoreInfo { User = new APIUser { Username = "osu!topus" } }, Replay = new ManiaAutoGenerator((ManiaBeatmap)beatmap).Generate(), }; } diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModCinema.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModCinema.cs index 1c06bb389b..4f1276946b 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModCinema.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModCinema.cs @@ -3,12 +3,12 @@ using System.Collections.Generic; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Replays; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Rulesets.Mania.Mods { @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Mania.Mods { public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => new Score { - ScoreInfo = new ScoreInfo { User = new User { Username = "osu!topus" } }, + ScoreInfo = new ScoreInfo { User = new APIUser { Username = "osu!topus" } }, Replay = new ManiaAutoGenerator((ManiaBeatmap)beatmap).Generate(), }; } diff --git a/osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs b/osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs index db1ac6da88..7138421b91 100644 --- a/osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Skinning/Default/DefaultBodyPiece.cs @@ -86,20 +86,18 @@ namespace osu.Game.Rulesets.Mania.Skinning.Default [BackgroundDependencyLoader] private void load() { - InternalChild = foregroundBuffer = new BufferedContainer + InternalChild = foregroundBuffer = new BufferedContainer(cachedFrameBuffer: true) { Blending = BlendingParameters.Additive, RelativeSizeAxes = Axes.Both, - CacheDrawnFrameBuffer = true, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both }, - subtractionBuffer = new BufferedContainer + subtractionBuffer = new BufferedContainer(cachedFrameBuffer: true) { RelativeSizeAxes = Axes.Both, // This is needed because we're blending with another object BackgroundColour = Color4.White.Opacity(0), - CacheDrawnFrameBuffer = true, // The 'hole' is achieved by subtracting the result of this container with the parent Blending = new BlendingParameters { AlphaEquation = BlendingEquation.ReverseSubtract }, Child = subtractionLayer = new CircularContainer diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs index 7cd06c5225..b0e173e752 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs @@ -15,13 +15,13 @@ namespace osu.Game.Rulesets.Osu.Tests { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; - [TestCase(6.5295339534769958d, "diffcalc-test")] - [TestCase(1.1514260533755143d, "zero-length-sliders")] + [TestCase(6.6975550434910005d, "diffcalc-test")] + [TestCase(1.4670676815251105d, "zero-length-sliders")] public void Test(double expected, string name) => base.Test(expected, name); - [TestCase(9.047752485219954d, "diffcalc-test")] - [TestCase(1.3985711787077566d, "zero-length-sliders")] + [TestCase(8.9389769779826267d, "diffcalc-test")] + [TestCase(1.7786917985891204d, "zero-length-sliders")] public void TestClockRateAdjusted(double expected, string name) => Test(expected, name, new OsuModDoubleTime()); diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneMissHitWindowJudgements.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneMissHitWindowJudgements.cs index a5629119b6..840d871b7b 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestSceneMissHitWindowJudgements.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneMissHitWindowJudgements.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using NUnit.Framework; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Replays; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Beatmaps; @@ -14,7 +15,6 @@ using osu.Game.Rulesets.Osu.Scoring; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Tests.Visual; -using osu.Game.Users; using osuTK; namespace osu.Game.Rulesets.Osu.Tests @@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Osu.Tests { public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => new Score { - ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } }, + ScoreInfo = new ScoreInfo { User = new APIUser { Username = "Autoplay" } }, Replay = new MissingAutoGenerator(beatmap, mods).Generate() }; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index 4bca87204a..a9d9ff6985 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -54,7 +54,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty if (mods.Any(h => h is OsuModRelax)) { - effectiveMissCount += countOk + countMeh; + // As we're adding Oks and Mehs to an approximated number of combo breaks the result can be higher than total hits in specific scenarios (which breaks some calculations) so we need to clamp it. + effectiveMissCount = Math.Min(effectiveMissCount + countOk + countMeh, totalHits); + multiplier *= 0.6; } @@ -109,13 +111,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty double approachRateFactor = 0.0; if (Attributes.ApproachRate > 10.33) - approachRateFactor = Attributes.ApproachRate - 10.33; + approachRateFactor = 0.3 * (Attributes.ApproachRate - 10.33); else if (Attributes.ApproachRate < 8.0) - approachRateFactor = 0.025 * (8.0 - Attributes.ApproachRate); + approachRateFactor = 0.1 * (8.0 - Attributes.ApproachRate); - double approachRateTotalHitsFactor = 1.0 / (1.0 + Math.Exp(-(0.007 * (totalHits - 400)))); - - double approachRateBonus = 1.0 + (0.03 + 0.37 * approachRateTotalHitsFactor) * approachRateFactor; + aimValue *= 1.0 + approachRateFactor * lengthBonus; // Buff for longer maps with high AR. if (mods.Any(m => m is OsuModBlinds)) aimValue *= 1.3 + (totalHits * (0.0016 / (1 + 2 * effectiveMissCount)) * Math.Pow(accuracy, 16)) * (1 - 0.003 * Attributes.DrainRate * Attributes.DrainRate); @@ -125,10 +125,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty aimValue *= 1.0 + 0.04 * (12.0 - Attributes.ApproachRate); } - aimValue *= approachRateBonus; - - // Scale the aim value with accuracy _slightly_. - aimValue *= 0.5 + accuracy / 2.0; + aimValue *= accuracy; // It is important to also consider accuracy difficulty when doing that. aimValue *= 0.98 + Math.Pow(Attributes.OverallDifficulty, 2) / 2500; @@ -154,11 +151,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty double approachRateFactor = 0.0; if (Attributes.ApproachRate > 10.33) - approachRateFactor = Attributes.ApproachRate - 10.33; + approachRateFactor = 0.3 * (Attributes.ApproachRate - 10.33); - double approachRateTotalHitsFactor = 1.0 / (1.0 + Math.Exp(-(0.007 * (totalHits - 400)))); - - speedValue *= 1.0 + (0.03 + 0.37 * approachRateTotalHitsFactor) * approachRateFactor; + speedValue *= 1.0 + approachRateFactor * lengthBonus; // Buff for longer maps with high AR. if (mods.Any(m => m is OsuModBlinds)) { @@ -255,7 +250,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty private int calculateEffectiveMissCount() { - // guess the number of misses + slider breaks from combo + // Guess the number of misses + slider breaks from combo double comboBasedMissCount = 0.0; if (Attributes.SliderCount > 0) @@ -265,7 +260,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty comboBasedMissCount = fullComboThreshold / Math.Max(1.0, scoreMaxCombo); } - // we're clamping misscount because since its derived from combo it can be higher than total hits and that breaks some calculations + // Clamp misscount since it's derived from combo and can be higher than total hits and that breaks some calculations comboBasedMissCount = Math.Min(comboBasedMissCount, totalHits); return Math.Max(countMiss, (int)Math.Floor(comboBasedMissCount)); diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 4b90285fd4..cbaad93bed 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -2,7 +2,6 @@ // 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.Objects; using osu.Game.Rulesets.Osu.Objects; @@ -14,6 +13,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { private const int normalized_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 = normalized_radius * 2.4f; + private const float assumed_slider_radius = normalized_radius * 1.65f; protected new OsuHitObject BaseObject => (OsuHitObject)base.BaseObject; @@ -89,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing if (lastObject is Slider lastSlider) { computeSliderCursorPosition(lastSlider); - TravelDistance = lastSlider.LazyTravelDistance * scalingFactor; + TravelDistance = lastSlider.LazyTravelDistance; TravelTime = Math.Max(lastSlider.LazyTravelTime / clockRate, min_delta_time); MovementTime = Math.Max(StrainTime - TravelTime, min_delta_time); @@ -99,7 +100,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing // For hitobjects which continue in the direction of the slider, the player will normally follow through the slider, // such that they're not jumping from the lazy position but rather from very close to (or the end of) the slider. // In such cases, a leniency is applied by also considering the jump distance from the tail of the slider, and taking the minimum jump distance. - MovementDistance = Math.Min(JumpDistance, tailJumpDistance); + // Additional distance is removed based on position of jump relative to slider follow circle radius. + // JumpDistance is the leniency distance beyond the assumed_slider_radius. tailJumpDistance is maximum_slider_radius since the full distance of radial leniency is still possible. + MovementDistance = Math.Max(0, Math.Min(JumpDistance - (maximum_slider_radius - assumed_slider_radius), tailJumpDistance - maximum_slider_radius)); } else { @@ -126,37 +129,60 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing if (slider.LazyEndPosition != null) return; - slider.LazyEndPosition = slider.StackedPosition; + slider.LazyTravelTime = slider.NestedHitObjects[^1].StartTime - slider.StartTime; - float followCircleRadius = (float)(slider.Radius * 2.4); - var computeVertex = new Action(t => + double endTimeMin = slider.LazyTravelTime / slider.SpanDuration; + if (endTimeMin % 2 >= 1) + endTimeMin = 1 - endTimeMin % 1; + else + endTimeMin %= 1; + + slider.LazyEndPosition = slider.StackedPosition + slider.Path.PositionAt(endTimeMin); // temporary lazy end position until a real result can be derived. + var currCursorPosition = slider.StackedPosition; + double scalingFactor = normalized_radius / slider.Radius; // lazySliderDistance is coded to be sensitive to scaling, this makes the maths easier with the thresholds being used. + + for (int i = 1; i < slider.NestedHitObjects.Count; i++) { - double progress = (t - slider.StartTime) / slider.SpanDuration; - if (progress % 2 >= 1) - progress = 1 - progress % 1; - else - progress %= 1; + var currMovementObj = (OsuHitObject)slider.NestedHitObjects[i]; - // ReSharper disable once PossibleInvalidOperationException (bugged in current r# version) - var diff = slider.StackedPosition + slider.Path.PositionAt(progress) - slider.LazyEndPosition.Value; - float dist = diff.Length; + Vector2 currMovement = Vector2.Subtract(currMovementObj.StackedPosition, currCursorPosition); + double currMovementLength = scalingFactor * currMovement.Length; - slider.LazyTravelTime = t - slider.StartTime; + // Amount of movement required so that the cursor position needs to be updated. + double requiredMovement = assumed_slider_radius; - if (dist > followCircleRadius) + if (i == slider.NestedHitObjects.Count - 1) { - // The cursor would be outside the follow circle, we need to move it - diff.Normalize(); // Obtain direction of diff - dist -= followCircleRadius; - slider.LazyEndPosition += diff * dist; - slider.LazyTravelDistance += dist; - } - }); + // The end of a slider has special aim rules due to the relaxed time constraint on position. + // There is both a lazy end position as well as the actual end slider position. We assume the player takes the simpler movement. + // For sliders that are circular, the lazy end position may actually be farther away than the sliders true end. + // This code is designed to prevent buffing situations where lazy end is actually a less efficient movement. + Vector2 lazyMovement = Vector2.Subtract((Vector2)slider.LazyEndPosition, currCursorPosition); - // Skip the head circle - var scoringTimes = slider.NestedHitObjects.Skip(1).Select(t => t.StartTime); - foreach (double time in scoringTimes) - computeVertex(time); + if (lazyMovement.Length < currMovement.Length) + currMovement = lazyMovement; + + currMovementLength = scalingFactor * currMovement.Length; + } + else if (currMovementObj is SliderRepeat) + { + // For a slider repeat, assume a tighter movement threshold to better assess repeat sliders. + requiredMovement = normalized_radius; + } + + if (currMovementLength > requiredMovement) + { + // this finds the positional delta from the required radius and the current position, and updates the currCursorPosition accordingly, as well as rewarding distance. + currCursorPosition = Vector2.Add(currCursorPosition, Vector2.Multiply(currMovement, (float)((currMovementLength - requiredMovement) / currMovementLength))); + currMovementLength *= (currMovementLength - requiredMovement) / currMovementLength; + slider.LazyTravelDistance += (float)currMovementLength; + } + + if (i == slider.NestedHitObjects.Count - 1) + slider.LazyEndPosition = currCursorPosition; + } + + slider.LazyTravelDistance *= (float)Math.Pow(1 + slider.RepeatCount / 2.5, 1.0 / 2.5); // Bonus for repeat sliders until a better per nested object strain system can be achieved. } private Vector2 getEndCursorPosition(OsuHitObject hitObject) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index a054b46366..4c40a49396 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -23,8 +23,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills 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 = 1; + private double currentStrain; private double skillMultiplier => 23.25; private double strainDecayBase => 0.15; @@ -61,7 +63,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills prevVelocity = Math.Max(prevVelocity, movementVelocity + travelVelocity); } - double angleBonus = 0; + 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. @@ -73,10 +79,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills double lastLastAngle = osuLastLastObj.Angle.Value; // Rewarding angles, take the smaller velocity as base. - angleBonus = Math.Min(currVelocity, prevVelocity); + double angleBonus = Math.Min(currVelocity, prevVelocity); - double wideAngleBonus = calcWideAngleBonus(currAngle); - double acuteAngleBonus = calcAcuteAngleBonus(currAngle); + wideAngleBonus = calcWideAngleBonus(currAngle); + acuteAngleBonus = calcAcuteAngleBonus(currAngle); if (osuCurrObj.StrainTime > 100) // Only buff deltaTime exceeding 300 bpm 1/2. acuteAngleBonus = 0; @@ -88,14 +94,48 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills * Math.Pow(Math.Sin(Math.PI / 2 * (Math.Clamp(osuCurrObj.JumpDistance, 50, 100) - 50) / 50), 2); // Buff distance exceeding 50 (radius) up to 100 (diameter). } - wideAngleBonus *= angleBonus * (1 - Math.Min(wideAngleBonus, Math.Pow(calcWideAngleBonus(lastAngle), 3))); // Penalize wide angles if they're repeated, reducing the penalty as the lastAngle gets more acute. - acuteAngleBonus *= 0.5 + 0.5 * (1 - Math.Min(acuteAngleBonus, Math.Pow(calcAcuteAngleBonus(lastLastAngle), 3))); // Penalize acute angles if they're repeated, reducing the penalty as the lastLastAngle gets more obtuse. - - angleBonus = acuteAngleBonus * acute_angle_multiplier + wideAngleBonus * wide_angle_multiplier; // add the angle buffs together. + // 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))); } } - aimStrain += angleBonus; // Add in angle bonus. + 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.JumpDistance + osuLastObj.TravelDistance) / osuLastObj.StrainTime; + currVelocity = (osuCurrObj.JumpDistance + osuCurrObj.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.JumpDistance, osuLastObj.JumpDistance) / 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 (osuCurrObj.TravelTime != 0) + { + // Reward sliders based on velocity. + sliderBonus = osuCurrObj.TravelDistance / osuCurrObj.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. + aimStrain += sliderBonus * slider_multiplier; return aimStrain; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs index e3abe7d700..466f0556ab 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Flashlight.cs @@ -23,7 +23,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills 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 double currentStrain = 1; + + private double currentStrain; private double strainValueOf(DifficultyHitObject current) { diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index cae6b8e01c..24881d9c47 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -24,8 +24,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private double skillMultiplier => 1375; private double strainDecayBase => 0.3; - private double currentStrain = 1; - private double currentRhythm = 1; + private double currentStrain; + private double currentRhythm; protected override int ReducedSectionCount => 5; protected override double DifficultyMultiplier => 1.04; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs index 652da7123e..106edfb623 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAutoplay.cs @@ -5,10 +5,10 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Replays; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Rulesets.Osu.Mods { @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => new Score { - ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } }, + ScoreInfo = new ScoreInfo { User = new APIUser { Username = "Autoplay" } }, Replay = new OsuAutoGenerator(beatmap, mods).Generate() }; } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs b/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs index df06988b70..f478790134 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModCinema.cs @@ -5,11 +5,11 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Replays; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Rulesets.Osu.Mods { @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => new Score { - ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } }, + ScoreInfo = new ScoreInfo { User = new APIUser { Username = "Autoplay" } }, Replay = new OsuAutoGenerator(beatmap, mods).Generate() }; } diff --git a/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs b/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs index 3c2077b3c8..db4a6eb50b 100644 --- a/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs +++ b/osu.Game.Rulesets.Osu/Statistics/AccuracyHeatmap.cs @@ -136,10 +136,9 @@ namespace osu.Game.Rulesets.Osu.Statistics } } }, - bufferedGrid = new BufferedContainer + bufferedGrid = new BufferedContainer(cachedFrameBuffer: true) { RelativeSizeAxes = Axes.Both, - CacheDrawnFrameBuffer = true, BackgroundColour = Color4Extensions.FromHex("#202624").Opacity(0), Child = pointGrid = new GridContainer { diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModAutoplay.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModAutoplay.cs index 31d9abf8b2..5832ae3dc1 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModAutoplay.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModAutoplay.cs @@ -3,10 +3,10 @@ using System.Collections.Generic; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Replays; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Rulesets.Taiko.Mods { @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Taiko.Mods { public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => new Score { - ScoreInfo = new ScoreInfo { User = new User { Username = "mekkadosu!" } }, + ScoreInfo = new ScoreInfo { User = new APIUser { Username = "mekkadosu!" } }, Replay = new TaikoAutoGenerator(beatmap).Generate(), }; } diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModCinema.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModCinema.cs index 00f0c8e321..f76e04a069 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModCinema.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModCinema.cs @@ -3,11 +3,11 @@ using System.Collections.Generic; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Replays; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Rulesets.Taiko.Mods { @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Taiko.Mods { public override Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => new Score { - ScoreInfo = new ScoreInfo { User = new User { Username = "mekkadosu!" } }, + ScoreInfo = new ScoreInfo { User = new APIUser { Username = "mekkadosu!" } }, Replay = new TaikoAutoGenerator(beatmap).Generate(), }; } diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 7a95856c36..0bd7c19200 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -112,7 +112,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual("Renatus", metadata.TitleUnicode); Assert.AreEqual("Soleily", metadata.Artist); Assert.AreEqual("Soleily", metadata.ArtistUnicode); - Assert.AreEqual("Gamu", metadata.AuthorString); + Assert.AreEqual("Gamu", metadata.Author.Username); Assert.AreEqual("Insane", beatmapInfo.Version); Assert.AreEqual(string.Empty, metadata.Source); Assert.AreEqual("MBC7 Unisphere 地球ヤバイEP Chikyu Yabai", metadata.Tags); @@ -547,7 +547,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.DoesNotThrow(() => beatmap = decoder.Decode(stream)); Assert.IsNotNull(beatmap); Assert.AreEqual("Beatmap with corrupted header", beatmap.Metadata.Title); - Assert.AreEqual("Evil Hacker", beatmap.Metadata.AuthorString); + Assert.AreEqual("Evil Hacker", beatmap.Metadata.Author.Username); } } @@ -565,7 +565,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.DoesNotThrow(() => beatmap = decoder.Decode(stream)); Assert.IsNotNull(beatmap); Assert.AreEqual("Beatmap with no header", beatmap.Metadata.Title); - Assert.AreEqual("Incredibly Evil Hacker", beatmap.Metadata.AuthorString); + Assert.AreEqual("Incredibly Evil Hacker", beatmap.Metadata.Author.Username); } } @@ -583,7 +583,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.DoesNotThrow(() => beatmap = decoder.Decode(stream)); Assert.IsNotNull(beatmap); Assert.AreEqual("Empty lines at start", beatmap.Metadata.Title); - Assert.AreEqual("Edge Case Hunter", beatmap.Metadata.AuthorString); + Assert.AreEqual("Edge Case Hunter", beatmap.Metadata.Author.Username); } } @@ -601,7 +601,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.DoesNotThrow(() => beatmap = decoder.Decode(stream)); Assert.IsNotNull(beatmap); Assert.AreEqual("The dog ate the file header", beatmap.Metadata.Title); - Assert.AreEqual("Why does this keep happening", beatmap.Metadata.AuthorString); + Assert.AreEqual("Why does this keep happening", beatmap.Metadata.Author.Username); } } @@ -619,7 +619,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.DoesNotThrow(() => beatmap = decoder.Decode(stream)); Assert.IsNotNull(beatmap); Assert.AreEqual("No empty line delimiting header from contents", beatmap.Metadata.Title); - Assert.AreEqual("Edge Case Hunter", beatmap.Metadata.AuthorString); + Assert.AreEqual("Edge Case Hunter", beatmap.Metadata.Author.Username); } } diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs index 9ec2f37569..37c1dfc657 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs @@ -35,7 +35,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual("Soleily", meta.Artist); Assert.AreEqual("Soleily", meta.ArtistUnicode); Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile); - Assert.AreEqual("Gamu", meta.AuthorString); + Assert.AreEqual("Gamu", meta.Author.Username); Assert.AreEqual("machinetop_background.jpg", meta.BackgroundFile); Assert.AreEqual(164471, meta.PreviewTime); Assert.AreEqual(string.Empty, meta.Source); diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index d68d43c998..5e8d741356 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -17,12 +17,12 @@ using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.IO; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Scoring; using osu.Game.Tests.Resources; using osu.Game.Tests.Scores.IO; -using osu.Game.Users; using SharpCompress.Archives; using SharpCompress.Archives.Zip; using SharpCompress.Common; @@ -859,7 +859,7 @@ namespace osu.Game.Tests.Beatmaps.IO var manager = osu.Dependencies.Get(); - var working = manager.CreateNew(new OsuRuleset().RulesetInfo, User.SYSTEM_USER); + var working = manager.CreateNew(new OsuRuleset().RulesetInfo, APIUser.SYSTEM_USER); var beatmap = working.Beatmap; @@ -892,7 +892,7 @@ namespace osu.Game.Tests.Beatmaps.IO var osu = LoadOsuIntoHost(host); var manager = osu.Dependencies.Get(); - var working = manager.CreateNew(new OsuRuleset().RulesetInfo, User.SYSTEM_USER); + var working = manager.CreateNew(new OsuRuleset().RulesetInfo, APIUser.SYSTEM_USER); manager.Save(working.BeatmapInfo, working.Beatmap); @@ -919,7 +919,7 @@ namespace osu.Game.Tests.Beatmaps.IO var osu = LoadOsuIntoHost(host); var manager = osu.Dependencies.Get(); - var working = manager.CreateNew(new OsuRuleset().RulesetInfo, User.SYSTEM_USER); + var working = manager.CreateNew(new OsuRuleset().RulesetInfo, APIUser.SYSTEM_USER); ((Beatmap)working.Beatmap).HitObjects.Add(new HitCircle { StartTime = 5000 }); diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs index d11da5e2a3..eaf5d107ca 100644 --- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs @@ -60,7 +60,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.AreEqual("Soleily", meta.Artist); Assert.AreEqual("Soleily", meta.ArtistUnicode); Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile); - Assert.AreEqual("Deif", meta.AuthorString); + Assert.AreEqual("Deif", meta.Author.Username); Assert.AreEqual("machinetop_background.jpg", meta.BackgroundFile); Assert.AreEqual(164471, meta.PreviewTime); Assert.AreEqual(string.Empty, meta.Source); diff --git a/osu.Game.Tests/Beatmaps/ToStringFormattingTest.cs b/osu.Game.Tests/Beatmaps/ToStringFormattingTest.cs index c477bbd9cf..da7f32a2d3 100644 --- a/osu.Game.Tests/Beatmaps/ToStringFormattingTest.cs +++ b/osu.Game.Tests/Beatmaps/ToStringFormattingTest.cs @@ -3,7 +3,7 @@ using NUnit.Framework; using osu.Game.Beatmaps; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Tests.Beatmaps { @@ -34,7 +34,7 @@ namespace osu.Game.Tests.Beatmaps { Artist = "artist", Title = "title", - Author = new User { Username = "creator" } + Author = new APIUser { Username = "creator" } } }; @@ -50,7 +50,7 @@ namespace osu.Game.Tests.Beatmaps { Artist = "artist", Title = "title", - Author = new User { Username = "creator" } + Author = new APIUser { Username = "creator" } }, Version = "difficulty" }; diff --git a/osu.Game.Tests/Chat/TestSceneChannelManager.cs b/osu.Game.Tests/Chat/TestSceneChannelManager.cs index 5e22101e5c..eaacc623c9 100644 --- a/osu.Game.Tests/Chat/TestSceneChannelManager.cs +++ b/osu.Game.Tests/Chat/TestSceneChannelManager.cs @@ -9,9 +9,9 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Testing; 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.Tests.Visual; -using osu.Game.Users; namespace osu.Game.Tests.Chat { @@ -133,7 +133,7 @@ namespace osu.Game.Tests.Chat } } - private Channel createChannel(int id, ChannelType type) => new Channel(new User()) + private Channel createChannel(int id, ChannelType type) => new Channel(new APIUser()) { Id = id, Name = $"Channel {id}", diff --git a/osu.Game.Tests/Database/BeatmapImporterTests.cs b/osu.Game.Tests/Database/BeatmapImporterTests.cs index a21f935f6b..e1fe1e224e 100644 --- a/osu.Game.Tests/Database/BeatmapImporterTests.cs +++ b/osu.Game.Tests/Database/BeatmapImporterTests.cs @@ -482,7 +482,10 @@ namespace osu.Game.Tests.Database var metadata = new RealmBeatmapMetadata { Artist = "SomeArtist", - Author = "SomeAuthor" + Author = + { + Username = "SomeAuthor" + } }; var ruleset = realmFactory.Context.All().First(); diff --git a/osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs b/osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs index 84cf796835..fd620a0e95 100644 --- a/osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs +++ b/osu.Game.Tests/Mods/ModDifficultyAdjustTest.cs @@ -105,6 +105,9 @@ namespace osu.Game.Tests.Mods testMod.ResetSettingsToDefaults(); Assert.That(testMod.DrainRate.Value, Is.Null); + + // ReSharper disable once HeuristicUnreachableCode + // see https://youtrack.jetbrains.com/issue/RIDER-70159. Assert.That(testMod.OverallDifficulty.Value, Is.Null); var applied = applyDifficulty(new BeatmapDifficulty diff --git a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs index 97105b6b6a..8386a10ebb 100644 --- a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs +++ b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs @@ -79,8 +79,17 @@ namespace osu.Game.Tests.NonVisual public List HitObjects; public override IEnumerable Objects => HitObjects; - public override event Action NewResult; - public override event Action RevertResult; + public override event Action NewResult + { + add => throw new InvalidOperationException(); + remove => throw new InvalidOperationException(); + } + + public override event Action RevertResult + { + add => throw new InvalidOperationException(); + remove => throw new InvalidOperationException(); + } public override Playfield Playfield { get; } public override Container Overlays { get; } @@ -95,9 +104,6 @@ namespace osu.Game.Tests.NonVisual public TestDrawableRuleset() : base(new OsuRuleset()) { - // won't compile without this. - NewResult?.Invoke(null); - RevertResult?.Invoke(null); } public override void SetReplayScore(Score replayScore) => throw new NotImplementedException(); diff --git a/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs b/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs index 8e2259bce8..abe5664737 100644 --- a/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs +++ b/osu.Game.Tests/NonVisual/Multiplayer/StatefulMultiplayerClientTest.cs @@ -6,10 +6,10 @@ using Humanizer; using NUnit.Framework; using osu.Framework.Extensions.ObjectExtensions; using osu.Framework.Testing; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; using osu.Game.Online.Rooms; using osu.Game.Tests.Visual.Multiplayer; -using osu.Game.Users; namespace osu.Game.Tests.NonVisual.Multiplayer { @@ -21,7 +21,7 @@ namespace osu.Game.Tests.NonVisual.Multiplayer { int id = 2000; - AddRepeatStep("add some users", () => Client.AddUser(new User { Id = id++ }), 5); + AddRepeatStep("add some users", () => Client.AddUser(new APIUser { Id = id++ }), 5); checkPlayingUserCount(0); AddAssert("playlist item is available", () => Client.CurrentMatchPlayingItem.Value != null); @@ -64,7 +64,7 @@ namespace osu.Game.Tests.NonVisual.Multiplayer room.State = MultiplayerRoomState.Playing; room.Users.Add(new MultiplayerRoomUser(PLAYER_1_ID) { - User = new User { Id = PLAYER_1_ID }, + User = new APIUser { Id = PLAYER_1_ID }, State = MultiplayerUserState.Playing }); }; diff --git a/osu.Game.Tests/OnlinePlay/StatefulMultiplayerClientTest.cs b/osu.Game.Tests/OnlinePlay/StatefulMultiplayerClientTest.cs index 82ce588c6f..5a621ecf84 100644 --- a/osu.Game.Tests/OnlinePlay/StatefulMultiplayerClientTest.cs +++ b/osu.Game.Tests/OnlinePlay/StatefulMultiplayerClientTest.cs @@ -3,8 +3,8 @@ using NUnit.Framework; using osu.Framework.Testing; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Tests.Visual.Multiplayer; -using osu.Game.Users; namespace osu.Game.Tests.OnlinePlay { @@ -14,7 +14,7 @@ namespace osu.Game.Tests.OnlinePlay [Test] public void TestUserAddedOnJoin() { - var user = new User { Id = 33 }; + var user = new APIUser { Id = 33 }; AddRepeatStep("add user multiple times", () => Client.AddUser(user), 3); AddAssert("room has 2 users", () => Client.Room?.Users.Count == 2); @@ -23,7 +23,7 @@ namespace osu.Game.Tests.OnlinePlay [Test] public void TestUserRemovedOnLeave() { - var user = new User { Id = 44 }; + var user = new APIUser { Id = 44 }; AddStep("add user", () => Client.AddUser(user)); AddAssert("room has 2 users", () => Client.Room?.Users.Count == 2); diff --git a/osu.Game.Tests/Scores/IO/ImportScoreTest.cs b/osu.Game.Tests/Scores/IO/ImportScoreTest.cs index 2cd02329b7..be7803734e 100644 --- a/osu.Game.Tests/Scores/IO/ImportScoreTest.cs +++ b/osu.Game.Tests/Scores/IO/ImportScoreTest.cs @@ -11,12 +11,12 @@ using osu.Framework.Allocation; using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.IO.Archives; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Tests.Scores.IO { @@ -38,7 +38,7 @@ namespace osu.Game.Tests.Scores.IO Accuracy = 0.8, MaxCombo = 500, Combo = 250, - User = new User { Username = "Test user" }, + User = new APIUser { Username = "Test user" }, Date = DateTimeOffset.Now, OnlineScoreID = 12345, }; diff --git a/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenDefault.cs b/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenDefault.cs index f7d42a2ee6..ec16578b71 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenDefault.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneBackgroundScreenDefault.cs @@ -10,10 +10,10 @@ using osu.Framework.Testing; using osu.Game.Configuration; using osu.Game.Graphics.Backgrounds; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Screens; using osu.Game.Screens.Backgrounds; using osu.Game.Skinning; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Background { @@ -113,7 +113,7 @@ namespace osu.Game.Tests.Visual.Background AddStep($"set background mode to {source}", () => config.SetValue(OsuSetting.MenuBackgroundSource, source)); private void setSupporter(bool isSupporter) => - AddStep($"set supporter {isSupporter}", () => ((DummyAPIAccess)API).LocalUser.Value = new User + AddStep($"set supporter {isSupporter}", () => ((DummyAPIAccess)API).LocalUser.Value = new APIUser { IsSupporter = isSupporter, Id = API.LocalUser.Value.Id + 1, diff --git a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs index 693c66ccb0..69ea1dc520 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs @@ -18,6 +18,7 @@ using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Scoring; @@ -29,7 +30,6 @@ using osu.Game.Screens.Ranking; using osu.Game.Screens.Select; using osu.Game.Tests.Beatmaps; using osu.Game.Tests.Resources; -using osu.Game.Users; using osuTK; using osuTK.Graphics; @@ -231,7 +231,7 @@ namespace osu.Game.Tests.Visual.Background AddStep("Transition to Results", () => player.Push(results = new FadeAccessibleResults(new ScoreInfo { - User = new User { Username = "osu!" }, + User = new APIUser { Username = "osu!" }, BeatmapInfo = new TestBeatmap(Ruleset.Value).BeatmapInfo, Ruleset = Ruleset.Value, }))); diff --git a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs index 2aeb4ab4e2..2f2594d5ed 100644 --- a/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs +++ b/osu.Game.Tests/Visual/Beatmaps/TestSceneBeatmapCard.cs @@ -13,8 +13,8 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables.Cards; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; -using osu.Game.Users; using osuTK; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Beatmaps { @@ -75,7 +75,7 @@ namespace osu.Game.Tests.Visual.Beatmaps Title = "undownloadable beatmap", Artist = "test", Source = "more tests", - Author = new User + Author = new APIUser { Username = "BanchoBot", Id = 3, @@ -120,7 +120,7 @@ namespace osu.Game.Tests.Visual.Beatmaps OnlineID = 1, Title = "many difficulties beatmap", Artist = "test", - Author = new User + Author = new APIUser { Username = "BanchoBot", Id = 3, diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs index 0441c5641e..74212de210 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs @@ -7,8 +7,8 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Testing; using osu.Framework.Utils; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Screens.Play.HUD; -using osu.Game.Users; using osuTK; namespace osu.Game.Tests.Visual.Gameplay @@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.Gameplay playerScore.Value = 1222333; }); - AddStep("add local player", () => createLeaderboardScore(playerScore, new User { Username = "You", Id = 3 }, true)); + AddStep("add local player", () => createLeaderboardScore(playerScore, new APIUser { Username = "You", Id = 3 }, true)); AddStep("toggle expanded", () => leaderboard.Expanded.Value = !leaderboard.Expanded.Value); AddSliderStep("set player score", 50, 5000000, 1222333, v => playerScore.Value = v); } @@ -50,8 +50,8 @@ namespace osu.Game.Tests.Visual.Gameplay var player2Score = new BindableDouble(1234567); var player3Score = new BindableDouble(1111111); - AddStep("add player 2", () => createLeaderboardScore(player2Score, new User { Username = "Player 2" })); - AddStep("add player 3", () => createLeaderboardScore(player3Score, new User { Username = "Player 3" })); + AddStep("add player 2", () => createLeaderboardScore(player2Score, new APIUser { Username = "Player 2" })); + AddStep("add player 3", () => createLeaderboardScore(player3Score, new APIUser { Username = "Player 3" })); AddUntilStep("is player 2 position #1", () => leaderboard.CheckPositionByUsername("Player 2", 1)); AddUntilStep("is player position #2", () => leaderboard.CheckPositionByUsername("You", 2)); @@ -72,38 +72,38 @@ namespace osu.Game.Tests.Visual.Gameplay public void TestRandomScores() { int playerNumber = 1; - AddRepeatStep("add player with random score", () => createRandomScore(new User { Username = $"Player {playerNumber++}" }), 10); + AddRepeatStep("add player with random score", () => createRandomScore(new APIUser { Username = $"Player {playerNumber++}" }), 10); } [Test] public void TestExistingUsers() { - AddStep("add peppy", () => createRandomScore(new User { Username = "peppy", Id = 2 })); - AddStep("add smoogipoo", () => createRandomScore(new User { Username = "smoogipoo", Id = 1040328 })); - AddStep("add flyte", () => createRandomScore(new User { Username = "flyte", Id = 3103765 })); - AddStep("add frenzibyte", () => createRandomScore(new User { Username = "frenzibyte", Id = 14210502 })); + AddStep("add peppy", () => createRandomScore(new APIUser { Username = "peppy", Id = 2 })); + AddStep("add smoogipoo", () => createRandomScore(new APIUser { Username = "smoogipoo", Id = 1040328 })); + AddStep("add flyte", () => createRandomScore(new APIUser { Username = "flyte", Id = 3103765 })); + AddStep("add frenzibyte", () => createRandomScore(new APIUser { Username = "frenzibyte", Id = 14210502 })); } [Test] public void TestMaxHeight() { int playerNumber = 1; - AddRepeatStep("add 3 other players", () => createRandomScore(new User { Username = $"Player {playerNumber++}" }), 3); + AddRepeatStep("add 3 other players", () => createRandomScore(new APIUser { Username = $"Player {playerNumber++}" }), 3); checkHeight(4); - AddRepeatStep("add 4 other players", () => createRandomScore(new User { Username = $"Player {playerNumber++}" }), 4); + AddRepeatStep("add 4 other players", () => createRandomScore(new APIUser { Username = $"Player {playerNumber++}" }), 4); checkHeight(8); - AddRepeatStep("add 4 other players", () => createRandomScore(new User { Username = $"Player {playerNumber++}" }), 4); + AddRepeatStep("add 4 other players", () => createRandomScore(new APIUser { Username = $"Player {playerNumber++}" }), 4); checkHeight(8); void checkHeight(int panelCount) => AddAssert($"leaderboard height is {panelCount} panels high", () => leaderboard.DrawHeight == (GameplayLeaderboardScore.PANEL_HEIGHT + leaderboard.Spacing) * panelCount); } - private void createRandomScore(User user) => createLeaderboardScore(new BindableDouble(RNG.Next(0, 5_000_000)), user); + private void createRandomScore(APIUser user) => createLeaderboardScore(new BindableDouble(RNG.Next(0, 5_000_000)), user); - private void createLeaderboardScore(BindableDouble score, User user, bool isTracked = false) + private void createLeaderboardScore(BindableDouble score, APIUser user, bool isTracked = false) { var leaderboardScore = leaderboard.Add(user, isTracked); leaderboardScore.TotalScore.BindTo(score); diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs index 1ba0965ceb..c1260f0231 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneHitErrorMeter.cs @@ -235,8 +235,17 @@ namespace osu.Game.Tests.Visual.Gameplay public override IEnumerable Objects => new[] { new HitCircle { HitWindows = HitWindows } }; - public override event Action NewResult; - public override event Action RevertResult; + public override event Action NewResult + { + add => throw new InvalidOperationException(); + remove => throw new InvalidOperationException(); + } + + public override event Action RevertResult + { + add => throw new InvalidOperationException(); + remove => throw new InvalidOperationException(); + } public override Playfield Playfield { get; } public override Container Overlays { get; } @@ -251,9 +260,6 @@ namespace osu.Game.Tests.Visual.Gameplay public TestDrawableRuleset() : base(new OsuRuleset()) { - // won't compile without this. - NewResult?.Invoke(null); - RevertResult?.Invoke(null); } public override void SetReplayScore(Score replayScore) => throw new NotImplementedException(); diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs index 64d9addc77..c4a99eeb6c 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneReplayDownloadButton.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Game.Online; using osu.Game.Online.API.Requests.Responses; using osu.Game.Scoring; -using osu.Game.Users; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Testing; @@ -16,6 +15,7 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osu.Game.Screens.Ranking; using osuTK.Input; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Gameplay { @@ -139,7 +139,7 @@ namespace osu.Game.Tests.Visual.Gameplay RulesetID = 0, Beatmap = CreateAPIBeatmapSet(new OsuRuleset().RulesetInfo).Beatmaps.First(), HasReplay = replayAvailable, - User = new User + User = new APIUser { Id = 39828, Username = @"WubWoofWolf", diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs index 21c5d89aca..20e859dd2b 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectator.cs @@ -9,6 +9,7 @@ using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Database; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Spectator; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Replays; @@ -18,13 +19,12 @@ using osu.Game.Screens.Play; using osu.Game.Tests.Beatmaps.IO; using osu.Game.Tests.Visual.Multiplayer; using osu.Game.Tests.Visual.Spectator; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Gameplay { public class TestSceneSpectator : ScreenTestScene { - private readonly User streamingUser = new User { Id = MultiplayerTestScene.PLAYER_1_ID, Username = "Test user" }; + private readonly APIUser streamingUser = new APIUser { Id = MultiplayerTestScene.PLAYER_1_ID, Username = "Test user" }; [Cached(typeof(UserLookupCache))] private UserLookupCache lookupCache = new TestUserLookupCache(); diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorHost.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorHost.cs index 89fea1f92d..2a82c65c7c 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorHost.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorHost.cs @@ -4,11 +4,11 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Spectator; using osu.Game.Rulesets; using osu.Game.Rulesets.Mania; using osu.Game.Tests.Visual.Spectator; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Gameplay { @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual.Gameplay public override void SetUpSteps() { - AddStep("set dummy user", () => dummyAPIAccess.LocalUser.Value = new User + AddStep("set dummy user", () => dummyAPIAccess.LocalUser.Value = new APIUser { Id = dummy_user_id, Username = "DummyUser" diff --git a/osu.Game.Tests/Visual/Menus/TestSceneDisclaimer.cs b/osu.Game.Tests/Visual/Menus/TestSceneDisclaimer.cs index 9cbdee3632..db5891bd4e 100644 --- a/osu.Game.Tests/Visual/Menus/TestSceneDisclaimer.cs +++ b/osu.Game.Tests/Visual/Menus/TestSceneDisclaimer.cs @@ -3,8 +3,8 @@ using osu.Framework.Allocation; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Screens.Menu; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Menus { @@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.Menus AddStep("toggle support", () => { - ((DummyAPIAccess)API).LocalUser.Value = new User + ((DummyAPIAccess)API).LocalUser.Value = new APIUser { Username = API.LocalUser.Value.Username, Id = API.LocalUser.Value.Id + 1, diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoom.cs index 84a6e95883..721862c177 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.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Online.Rooms.RoomStatuses; using osu.Game.Overlays; @@ -17,7 +18,6 @@ using osu.Game.Rulesets.Osu; using osu.Game.Screens.OnlinePlay.Lounge; using osu.Game.Screens.OnlinePlay.Lounge.Components; using osu.Game.Tests.Beatmaps; -using osu.Game.Users; using osuTK; namespace osu.Game.Tests.Visual.Multiplayer @@ -174,11 +174,11 @@ namespace osu.Game.Tests.Visual.Multiplayer private DrawableRoom createLoungeRoom(Room room) { - room.Host.Value ??= new User { Username = "peppy", Id = 2 }; + room.Host.Value ??= new APIUser { Username = "peppy", Id = 2 }; if (room.RecentParticipants.Count == 0) { - room.RecentParticipants.AddRange(Enumerable.Range(0, 20).Select(i => new User + room.RecentParticipants.AddRange(Enumerable.Range(0, 20).Select(i => new APIUser { Id = i, Username = $"User {i}" diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomParticipantsList.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomParticipantsList.cs index 982dfc5cd9..60f47a01a9 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomParticipantsList.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomParticipantsList.cs @@ -5,10 +5,10 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Testing; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Lounge.Components; using osu.Game.Tests.Visual.OnlinePlay; -using osu.Game.Users; using osu.Game.Users.Drawables; namespace osu.Game.Tests.Visual.Multiplayer @@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Multiplayer Name = { Value = "test room" }, Host = { - Value = new User + Value = new APIUser { Id = 2, Username = "peppy", @@ -137,7 +137,7 @@ namespace osu.Game.Tests.Visual.Multiplayer private void addUser(int id) { - SelectedRoom.Value.RecentParticipants.Add(new User + SelectedRoom.Value.RecentParticipants.Add(new APIUser { Id = id, Username = $"User {id}" diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs index afd48d5191..8ac0a2cbe5 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneDrawableRoomPlaylist.cs @@ -14,6 +14,7 @@ using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics.Containers; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Overlays.BeatmapListing.Panels; using osu.Game.Rulesets; @@ -21,7 +22,6 @@ using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Screens.OnlinePlay; using osu.Game.Tests.Beatmaps; -using osu.Game.Users; using osuTK; using osuTK.Input; @@ -294,7 +294,7 @@ namespace osu.Game.Tests.Visual.Multiplayer Metadata = new BeatmapMetadata { Artist = "Artist", - Author = new User { Username = "Creator name here" }, + Author = new APIUser { Username = "Creator name here" }, Title = "Long title used to check background colour", }, BeatmapSet = new BeatmapSetInfo() diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboard.cs index a7a5f3af39..955710bd50 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMatchLeaderboard.cs @@ -10,8 +10,8 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Tests.Visual.OnlinePlay; -using osu.Game.Users; using osuTK; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Multiplayer { @@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.Multiplayer new APIUserScoreAggregate { UserID = 2, - User = new User { Id = 2, Username = "peppy" }, + User = new APIUser { Id = 2, Username = "peppy" }, TotalScore = 995533, RoomID = 3, CompletedBeatmaps = 1, @@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Multiplayer new APIUserScoreAggregate { UserID = 1040328, - User = new User { Id = 1040328, Username = "smoogipoo" }, + User = new APIUser { Id = 1040328, Username = "smoogipoo" }, TotalScore = 981100, RoomID = 3, CompletedBeatmaps = 1, diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs index bd5320354e..a61e505970 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs @@ -6,11 +6,11 @@ using System.Linq; using NUnit.Framework; 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; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Multiplayer { @@ -35,7 +35,7 @@ namespace osu.Game.Tests.Visual.Multiplayer foreach ((int userId, var _) in clocks) { SpectatorClient.StartPlay(userId, 0); - OnlinePlayDependencies.Client.AddUser(new User { Id = userId }); + OnlinePlayDependencies.Client.AddUser(new APIUser { Id = userId }); } }); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs index 7ff8c82145..fdd01446b9 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Beatmaps; 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.Rulesets.UI; @@ -19,7 +20,6 @@ using osu.Game.Screens.Play; using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.PlayerSettings; using osu.Game.Tests.Beatmaps.IO; -using osu.Game.Users; using osuTK.Graphics; namespace osu.Game.Tests.Visual.Multiplayer @@ -59,8 +59,8 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("start players silently", () => { - OnlinePlayDependencies.Client.AddUser(new User { Id = PLAYER_1_ID }, true); - OnlinePlayDependencies.Client.AddUser(new User { Id = PLAYER_2_ID }, true); + OnlinePlayDependencies.Client.AddUser(new APIUser { Id = PLAYER_1_ID }, true); + OnlinePlayDependencies.Client.AddUser(new APIUser { Id = PLAYER_2_ID }, true); playingUsers.Add(new MultiplayerRoomUser(PLAYER_1_ID)); playingUsers.Add(new MultiplayerRoomUser(PLAYER_2_ID)); @@ -120,13 +120,13 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("start players", () => { - var player1 = OnlinePlayDependencies.Client.AddUser(new User { Id = PLAYER_1_ID }, true); + var player1 = OnlinePlayDependencies.Client.AddUser(new APIUser { Id = PLAYER_1_ID }, true); player1.MatchState = new TeamVersusUserState { TeamID = 0, }; - var player2 = OnlinePlayDependencies.Client.AddUser(new User { Id = PLAYER_2_ID }, true); + var player2 = OnlinePlayDependencies.Client.AddUser(new APIUser { Id = PLAYER_2_ID }, true); player2.MatchState = new TeamVersusUserState { TeamID = 1, @@ -367,7 +367,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { var user = new MultiplayerRoomUser(id) { - User = new User { Id = id }, + User = new APIUser { Id = id }, }; OnlinePlayDependencies.Client.AddUser(user.User, true); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs index 38cf9d662f..e831d5b564 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayer.cs @@ -17,6 +17,7 @@ using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; using osu.Game.Online.Rooms; using osu.Game.Overlays.Mods; @@ -32,7 +33,6 @@ using osu.Game.Screens.Play; using osu.Game.Screens.Ranking; using osu.Game.Screens.Spectate; using osu.Game.Tests.Resources; -using osu.Game.Users; using osuTK.Input; namespace osu.Game.Tests.Visual.Multiplayer @@ -129,12 +129,12 @@ namespace osu.Game.Tests.Visual.Multiplayer private void addRandomPlayer() { int randomUser = RNG.Next(200000, 500000); - client.AddUser(new User { Id = randomUser, Username = $"user {randomUser}" }); + client.AddUser(new APIUser { Id = randomUser, Username = $"user {randomUser}" }); } private void removeLastUser() { - User lastUser = client.Room?.Users.Last().User; + APIUser lastUser = client.Room?.Users.Last().User; if (lastUser == null || lastUser == client.LocalUser?.User) return; @@ -144,7 +144,7 @@ namespace osu.Game.Tests.Visual.Multiplayer private void kickLastUser() { - User lastUser = client.Room?.Users.Last().User; + APIUser lastUser = client.Room?.Users.Last().User; if (lastUser == null || lastUser == client.LocalUser?.User) return; @@ -414,7 +414,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("join other user (ready, host)", () => { - client.AddUser(new User { Id = MultiplayerTestScene.PLAYER_1_ID, Username = "Other" }); + client.AddUser(new APIUser { Id = MultiplayerTestScene.PLAYER_1_ID, Username = "Other" }); client.TransferHost(MultiplayerTestScene.PLAYER_1_ID); client.ChangeUserState(MultiplayerTestScene.PLAYER_1_ID, MultiplayerUserState.Ready); }); @@ -454,7 +454,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("join other user (ready, host)", () => { - client.AddUser(new User { Id = MultiplayerTestScene.PLAYER_1_ID, Username = "Other" }); + client.AddUser(new APIUser { Id = MultiplayerTestScene.PLAYER_1_ID, Username = "Other" }); client.TransferHost(MultiplayerTestScene.PLAYER_1_ID); client.ChangeUserState(MultiplayerTestScene.PLAYER_1_ID, MultiplayerUserState.Ready); }); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs index 832998d5d3..902629765f 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs @@ -11,6 +11,7 @@ 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; @@ -20,7 +21,6 @@ using osu.Game.Scoring; using osu.Game.Screens.Play.HUD; using osu.Game.Tests.Visual.OnlinePlay; using osu.Game.Tests.Visual.Spectator; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Multiplayer { @@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.Multiplayer foreach (int user in users) { SpectatorClient.StartPlay(user, Beatmap.Value.BeatmapInfo.OnlineBeatmapID ?? 0); - multiplayerUsers.Add(OnlinePlayDependencies.Client.AddUser(new User { Id = user }, true)); + multiplayerUsers.Add(OnlinePlayDependencies.Client.AddUser(new APIUser { Id = user }, true)); } Children = new Drawable[] diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs index 3d48ddc7ca..af4e696fce 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs @@ -7,6 +7,7 @@ using NUnit.Framework; 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; @@ -15,7 +16,6 @@ using osu.Game.Screens.OnlinePlay.Multiplayer; using osu.Game.Screens.Play.HUD; using osu.Game.Tests.Visual.OnlinePlay; using osu.Game.Tests.Visual.Spectator; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Multiplayer { @@ -62,7 +62,7 @@ namespace osu.Game.Tests.Visual.Multiplayer foreach (int user in users) { SpectatorClient.StartPlay(user, Beatmap.Value.BeatmapInfo.OnlineBeatmapID ?? 0); - var roomUser = OnlinePlayDependencies.Client.AddUser(new User { Id = user }, true); + var roomUser = OnlinePlayDependencies.Client.AddUser(new APIUser { Id = user }, true); roomUser.MatchState = new TeamVersusUserState { diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs index 21364fe154..bb5735a3b5 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerMatchSubScreen.cs @@ -9,6 +9,7 @@ using osu.Framework.Platform; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; using osu.Game.Online.Rooms; using osu.Game.Rulesets; @@ -18,7 +19,6 @@ using osu.Game.Screens.OnlinePlay.Multiplayer; using osu.Game.Screens.OnlinePlay.Multiplayer.Match; using osu.Game.Tests.Beatmaps; using osu.Game.Tests.Resources; -using osu.Game.Users; using osuTK.Input; namespace osu.Game.Tests.Visual.Multiplayer @@ -119,7 +119,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("join other user (ready)", () => { - Client.AddUser(new User { Id = PLAYER_1_ID }); + Client.AddUser(new APIUser { Id = PLAYER_1_ID }); Client.ChangeUserState(PLAYER_1_ID, MultiplayerUserState.Ready); }); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs index 2549681519..671b85164b 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerParticipantsList.cs @@ -11,6 +11,7 @@ using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Graphics.UserInterface; using osu.Game.Online; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Multiplayer; using osu.Game.Online.Rooms; using osu.Game.Rulesets.Mods; @@ -34,7 +35,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddAssert("one unique panel", () => this.ChildrenOfType().Select(p => p.User).Distinct().Count() == 1); - AddStep("add user", () => Client.AddUser(new User + AddStep("add user", () => Client.AddUser(new APIUser { Id = 3, Username = "Second", @@ -63,11 +64,11 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestRemoveUser() { - User secondUser = null; + APIUser secondUser = null; AddStep("add a user", () => { - Client.AddUser(secondUser = new User + Client.AddUser(secondUser = new APIUser { Id = 3, Username = "Second", @@ -146,7 +147,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestCrownChangesStateWhenHostTransferred() { - AddStep("add user", () => Client.AddUser(new User + AddStep("add user", () => Client.AddUser(new APIUser { Id = 3, Username = "Second", @@ -165,7 +166,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestKickButtonOnlyPresentWhenHost() { - AddStep("add user", () => Client.AddUser(new User + AddStep("add user", () => Client.AddUser(new APIUser { Id = 3, Username = "Second", @@ -186,7 +187,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestKickButtonKicks() { - AddStep("add user", () => Client.AddUser(new User + AddStep("add user", () => Client.AddUser(new APIUser { Id = 3, Username = "Second", @@ -205,7 +206,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { for (int i = 0; i < 20; i++) { - Client.AddUser(new User + Client.AddUser(new APIUser { Id = i, Username = $"User {i}", @@ -249,7 +250,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add user", () => { - Client.AddUser(new User + Client.AddUser(new APIUser { Id = 0, Username = "User 0", @@ -295,7 +296,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("add user with mods", () => { - Client.AddUser(new User + Client.AddUser(new APIUser { Id = 0, Username = "Baka", diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerReadyButton.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerReadyButton.cs index 820b403a10..e9612bf55c 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerReadyButton.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerReadyButton.cs @@ -14,12 +14,12 @@ 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.Rooms; using osu.Game.Rulesets; using osu.Game.Screens.OnlinePlay.Multiplayer.Match; using osu.Game.Tests.Resources; -using osu.Game.Users; using osuTK; using osuTK.Input; @@ -108,7 +108,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add second user as host", () => { - Client.AddUser(new User { Id = 2, Username = "Another user" }); + Client.AddUser(new APIUser { Id = 2, Username = "Another user" }); Client.TransferHost(2); }); @@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual.Multiplayer Client.TransferHost(Client.Room?.Users[0].UserID ?? 0); if (!allReady) - Client.AddUser(new User { Id = 2, Username = "Another user" }); + Client.AddUser(new APIUser { Id = 2, Username = "Another user" }); }); addClickButtonStep(); @@ -142,7 +142,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add host", () => { - Client.AddUser(new User { Id = 2, Username = "Another user" }); + Client.AddUser(new APIUser { Id = 2, Username = "Another user" }); Client.TransferHost(2); }); @@ -158,7 +158,7 @@ namespace osu.Game.Tests.Visual.Multiplayer AddStep("setup", () => { Client.TransferHost(Client.Room?.Users[0].UserID ?? 0); - Client.AddUser(new User { Id = 2, Username = "Another user" }); + Client.AddUser(new APIUser { Id = 2, Username = "Another user" }); }); addClickButtonStep(); @@ -177,7 +177,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { Client.TransferHost(Client.Room?.Users[0].UserID ?? 0); for (int i = 0; i < users; i++) - Client.AddUser(new User { Id = i, Username = "Another user" }); + Client.AddUser(new APIUser { Id = i, Username = "Another user" }); }); if (!isHost) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerResults.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerResults.cs index 5032cdaec7..c0b21c4421 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerResults.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerResults.cs @@ -3,11 +3,11 @@ using System; using NUnit.Framework; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Rulesets.Osu; using osu.Game.Scoring; using osu.Game.Screens.OnlinePlay.Multiplayer; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Multiplayer { @@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual.Multiplayer MaxCombo = 500, Combo = 250, BeatmapInfo = beatmapInfo, - User = new User { Username = "Test user" }, + User = new APIUser { Username = "Test user" }, Date = DateTimeOffset.Now, OnlineScoreID = 12345, Ruleset = rulesetInfo, diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs index 3d08d5da9e..76c8de93c7 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerSpectateButton.cs @@ -14,12 +14,12 @@ using osu.Framework.Platform; using osu.Framework.Testing; 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.Rooms; using osu.Game.Rulesets; using osu.Game.Screens.OnlinePlay.Multiplayer.Match; using osu.Game.Tests.Resources; -using osu.Game.Users; using osuTK; using osuTK.Input; @@ -145,7 +145,7 @@ namespace osu.Game.Tests.Visual.Multiplayer [Test] public void TestReadyButtonEnabledWhenHostAndUsersReady() { - AddStep("add user", () => Client.AddUser(new User { Id = PLAYER_1_ID })); + AddStep("add user", () => Client.AddUser(new APIUser { Id = PLAYER_1_ID })); AddStep("set user ready", () => Client.ChangeUserState(PLAYER_1_ID, MultiplayerUserState.Ready)); addClickSpectateButtonStep(); @@ -157,7 +157,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add user and transfer host", () => { - Client.AddUser(new User { Id = PLAYER_1_ID }); + Client.AddUser(new APIUser { Id = PLAYER_1_ID }); Client.TransferHost(PLAYER_1_ID); }); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs index 99d5fd46e9..d391c39c89 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerTeamResults.cs @@ -5,11 +5,11 @@ using System; using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Bindables; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Rulesets.Osu; using osu.Game.Scoring; using osu.Game.Screens.OnlinePlay.Multiplayer; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Multiplayer { @@ -35,7 +35,7 @@ namespace osu.Game.Tests.Visual.Multiplayer MaxCombo = 500, Combo = 250, BeatmapInfo = beatmapInfo, - User = new User { Username = "Test user" }, + User = new APIUser { Username = "Test user" }, Date = DateTimeOffset.Now, OnlineScoreID = 12345, Ruleset = rulesetInfo, diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs index 9e03743e8d..823ac07cf7 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneRankRangePill.cs @@ -3,8 +3,8 @@ using NUnit.Framework; using osu.Framework.Graphics; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Screens.OnlinePlay.Lounge.Components; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Multiplayer { @@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add user", () => { - Client.AddUser(new User + Client.AddUser(new APIUser { Id = 2, Statistics = { GlobalRank = 1234 } @@ -41,19 +41,19 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add users", () => { - Client.AddUser(new User + Client.AddUser(new APIUser { Id = 2, Statistics = { GlobalRank = 1234 } }); - Client.AddUser(new User + Client.AddUser(new APIUser { Id = 3, Statistics = { GlobalRank = 3333 } }); - Client.AddUser(new User + Client.AddUser(new APIUser { Id = 4, Statistics = { GlobalRank = 4321 } @@ -75,13 +75,13 @@ namespace osu.Game.Tests.Visual.Multiplayer { AddStep("add users", () => { - Client.AddUser(new User + Client.AddUser(new APIUser { Id = 2, Statistics = { GlobalRank = min } }); - Client.AddUser(new User + Client.AddUser(new APIUser { Id = 3, Statistics = { GlobalRank = max } diff --git a/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs index 06cc613c17..8f0da8d182 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs @@ -8,6 +8,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.AccountCreation; using osu.Game.Overlays.Settings; @@ -20,7 +21,7 @@ namespace osu.Game.Tests.Visual.Online private readonly Container userPanelArea; private readonly AccountCreationOverlay accountCreation; - private IBindable localUser; + private IBindable localUser; public TestSceneAccountCreationOverlay() { diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapListingOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapListingOverlay.cs index c7a065fdd7..cbb6dce4d6 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapListingOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapListingOverlay.cs @@ -14,8 +14,8 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.BeatmapListing; using osu.Game.Scoring; -using osu.Game.Users; using osuTK.Input; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Online { @@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.Online }; // non-supporter user - api.LocalUser.Value = new User + api.LocalUser.Value = new APIUser { Username = "TestBot", Id = API.LocalUser.Value.Id + 1, diff --git a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs index 63ce057667..86863c0b5d 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneBeatmapSetOverlay.cs @@ -7,11 +7,11 @@ using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Overlays.BeatmapSet; using osu.Game.Rulesets; -using osu.Game.Users; using System; using System.Collections.Generic; using System.Linq; using osu.Game.Online.API.Requests.Responses; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Online { @@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual.Online Artist = @"naru narusegawa", Source = @"hinata sou", Tags = @"test tag tag more tag", - Author = new User + Author = new APIUser { Username = @"BanchoBot", Id = 3, diff --git a/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs b/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs index 73e1fc9b35..e6eaffc4c1 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChannelTabControl.cs @@ -11,9 +11,9 @@ 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 osu.Game.Users; using osuTK.Graphics; namespace osu.Game.Tests.Visual.Online @@ -108,7 +108,7 @@ namespace osu.Game.Tests.Visual.Online } private void addRandomPrivateChannel() => - channelTabControl.AddChannel(new Channel(new User + channelTabControl.AddChannel(new Channel(new APIUser { Id = RNG.Next(1000, 10000000), Username = "Test User " + RNG.Next(1000) diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatLineTruncation.cs b/osu.Game.Tests/Visual/Online/TestSceneChatLineTruncation.cs index 8408b7dd60..444bd7e5fb 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatLineTruncation.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatLineTruncation.cs @@ -6,9 +6,9 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Chat; using osu.Game.Overlays.Chat; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Online { @@ -55,14 +55,14 @@ namespace osu.Game.Tests.Visual.Online { private static long messageCounter; - internal static readonly User TEST_SENDER_BACKGROUND = new User + internal static readonly APIUser TEST_SENDER_BACKGROUND = new APIUser { Username = @"i-am-important", Id = 42, Colour = "#250cc9", }; - internal static readonly User TEST_SENDER = new User + internal static readonly APIUser TEST_SENDER = new APIUser { Username = @"Somebody", Id = 1, @@ -75,7 +75,7 @@ namespace osu.Game.Tests.Visual.Online { Content = text; IsAction = isAction; - Sender = new User + Sender = new APIUser { Username = username ?? $"user {number}", Id = number, diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs b/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs index 74f53ebdca..a03c00eb58 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatLink.cs @@ -10,10 +10,10 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; 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 osu.Game.Users; using osuTK.Graphics; namespace osu.Game.Tests.Visual.Online @@ -168,14 +168,14 @@ namespace osu.Game.Tests.Visual.Online { private static long messageCounter; - internal static readonly User TEST_SENDER_BACKGROUND = new User + internal static readonly APIUser TEST_SENDER_BACKGROUND = new APIUser { Username = @"i-am-important", Id = 42, Colour = "#250cc9", }; - internal static readonly User TEST_SENDER = new User + internal static readonly APIUser TEST_SENDER = new APIUser { Username = @"Somebody", Id = 1, @@ -188,7 +188,7 @@ namespace osu.Game.Tests.Visual.Online { Content = text; IsAction = isAction; - Sender = new User + Sender = new APIUser { Username = $"User {number}", Id = number, diff --git a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs index 99c3b398ab..7028ecf39f 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs @@ -18,12 +18,12 @@ 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 osu.Game.Users; using osuTK.Input; namespace osu.Game.Tests.Visual.Online @@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.Online public TestSceneChatOverlay() { channels = Enumerable.Range(1, 10) - .Select(index => new Channel(new User()) + .Select(index => new Channel(new APIUser()) { Name = $"Channel no. {index}", Topic = index == 3 ? null : $"We talk about the number {index} here", @@ -98,7 +98,7 @@ namespace osu.Game.Tests.Visual.Online case GetUserRequest getUser: if (getUser.Lookup.Equals("some body", StringComparison.OrdinalIgnoreCase)) { - getUser.TriggerSuccess(new User + getUser.TriggerSuccess(new APIUser { Username = "some body", Id = 1, @@ -149,7 +149,7 @@ namespace osu.Game.Tests.Visual.Online { ChannelId = channel1.Id, Content = "hello from channel 1!", - Sender = new User + Sender = new APIUser { Id = 2, Username = "test_user" diff --git a/osu.Game.Tests/Visual/Online/TestSceneCurrentlyPlayingDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneCurrentlyPlayingDisplay.cs index 2f11fec6d1..b5a03b558d 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneCurrentlyPlayingDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneCurrentlyPlayingDisplay.cs @@ -9,6 +9,7 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Testing; using osu.Game.Database; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Spectator; using osu.Game.Overlays.Dashboard; using osu.Game.Tests.Visual.Spectator; @@ -18,7 +19,7 @@ namespace osu.Game.Tests.Visual.Online { public class TestSceneCurrentlyPlayingDisplay : OsuTestScene { - private readonly User streamingUser = new User { Id = 2, Username = "Test user" }; + private readonly APIUser streamingUser = new APIUser { Id = 2, Username = "Test user" }; private TestSpectatorClient spectatorClient; private CurrentlyPlayingDisplay currentlyPlaying; @@ -83,13 +84,13 @@ namespace osu.Game.Tests.Visual.Online "pishifat" }; - protected override Task ComputeValueAsync(int lookup, CancellationToken token = default) + protected override Task ComputeValueAsync(int lookup, CancellationToken token = default) { // tests against failed lookups if (lookup == 13) - return Task.FromResult(null); + return Task.FromResult(null); - return Task.FromResult(new User + return Task.FromResult(new APIUser { Id = lookup, Username = usernames[lookup % usernames.Length], diff --git a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs index a3c8935fa8..01dde97d38 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneDirectPanel.cs @@ -10,8 +10,8 @@ using osu.Game.Beatmaps; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.BeatmapListing.Panels; using osu.Game.Rulesets; -using osu.Game.Users; using osuTK; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Online { @@ -74,7 +74,7 @@ namespace osu.Game.Tests.Visual.Online Title = "undownloadable beatmap", Artist = "test", Source = "more tests", - Author = new User + Author = new APIUser { Username = "BanchoBot", Id = 3, @@ -121,7 +121,7 @@ namespace osu.Game.Tests.Visual.Online Title = "undownloadable beatmap", Artist = "test", Source = "more tests", - Author = new User + Author = new APIUser { Username = "BanchoBot", Id = 3, diff --git a/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs index e8d9ff72af..471d361c4e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneFriendDisplay.cs @@ -7,6 +7,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Dashboard.Friends; using osu.Game.Users; @@ -44,9 +45,9 @@ namespace osu.Game.Tests.Visual.Online // No need to do anything, fetch is performed automatically. } - private List getUsers() => new List + private List getUsers() => new List { - new User + new APIUser { Username = "flyte", Id = 3103765, @@ -55,7 +56,7 @@ namespace osu.Game.Tests.Visual.Online Country = new Country { FlagName = "JP" }, CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" }, - new User + new APIUser { Username = "peppy", Id = 2, @@ -66,7 +67,7 @@ namespace osu.Game.Tests.Visual.Online IsSupporter = true, SupportLevel = 3, }, - new User + new APIUser { Username = "Evast", Id = 8195163, diff --git a/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs b/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs index 3ecca85ef1..2639a6506c 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneHistoricalSection.cs @@ -7,9 +7,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Profile.Sections; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Online { @@ -37,8 +37,8 @@ namespace osu.Game.Tests.Visual.Online Child = section = new HistoricalSection(), }); - AddStep("Show peppy", () => section.User.Value = new User { Id = 2 }); - AddStep("Show WubWoofWolf", () => section.User.Value = new User { Id = 39828 }); + AddStep("Show peppy", () => section.User.Value = new APIUser { Id = 2 }); + AddStep("Show WubWoofWolf", () => section.User.Value = new APIUser { Id = 39828 }); } } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs index d193856217..175d2ea36b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneMessageNotifier.cs @@ -15,14 +15,14 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Chat; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; -using osu.Game.Users; using osuTK.Input; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Online { public class TestSceneMessageNotifier : OsuManualInputManagerTestScene { - private User friend; + private APIUser friend; private Channel publicChannel; private Channel privateMessageChannel; private TestContainer testContainer; @@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual.Online daa.HandleRequest = dummyAPIHandleRequest; } - friend = new User { Id = 0, Username = "Friend" }; + friend = new APIUser { Id = 0, Username = "Friend" }; publicChannel = new Channel { Id = 1, Name = "osu" }; privateMessageChannel = new Channel(friend) { Id = 2, Name = friend.Username, Type = ChannelType.PM }; @@ -178,9 +178,9 @@ namespace osu.Game.Tests.Visual.Online AddAssert("1 notification fired", () => testContainer.NotificationOverlay.UnreadCount.Value == 1); } - private void receiveMessage(User sender, Channel channel, string content) => channel.AddNewMessages(createMessage(sender, channel, content)); + private void receiveMessage(APIUser sender, Channel channel, string content) => channel.AddNewMessages(createMessage(sender, channel, content)); - private Message createMessage(User sender, Channel channel, string content) => new Message(messageIdCounter++) + private Message createMessage(APIUser sender, Channel channel, string content) => new Message(messageIdCounter++) { Content = content, Sender = sender, diff --git a/osu.Game.Tests/Visual/Online/TestSceneOfflineCommentsContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneOfflineCommentsContainer.cs index 4f7947b69c..0587e8884f 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneOfflineCommentsContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneOfflineCommentsContainer.cs @@ -11,9 +11,9 @@ using osu.Game.Overlays.Comments; using osu.Game.Overlays; using osu.Framework.Allocation; using osu.Game.Online.API.Requests.Responses; -using osu.Game.Users; using JetBrains.Annotations; using osu.Framework.Testing; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Online { @@ -154,9 +154,9 @@ namespace osu.Game.Tests.Visual.Online { 5 }, - Users = new List + Users = new List { - new User + new APIUser { Id = 1, Username = "Good_Admin" diff --git a/osu.Game.Tests/Visual/Online/TestScenePlayHistorySubsection.cs b/osu.Game.Tests/Visual/Online/TestScenePlayHistorySubsection.cs index cf5ecf5bf2..fecc1af03c 100644 --- a/osu.Game.Tests/Visual/Online/TestScenePlayHistorySubsection.cs +++ b/osu.Game.Tests/Visual/Online/TestScenePlayHistorySubsection.cs @@ -4,7 +4,6 @@ using osu.Game.Overlays.Profile.Sections.Historical; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Game.Users; using NUnit.Framework; using osu.Game.Overlays; using osu.Framework.Allocation; @@ -12,7 +11,7 @@ using System; using System.Linq; using osu.Framework.Testing; using osu.Framework.Graphics.Shapes; -using static osu.Game.Users.User; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Tests.Visual.Online { @@ -21,7 +20,7 @@ namespace osu.Game.Tests.Visual.Online [Cached] private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Red); - private readonly Bindable user = new Bindable(); + private readonly Bindable user = new Bindable(); private readonly PlayHistorySubsection section; public TestScenePlayHistorySubsection() @@ -101,80 +100,80 @@ namespace osu.Game.Tests.Visual.Online private int getChartValuesLength() => this.ChildrenOfType().Single().Values.Length; - private static readonly User user_with_null_values = new User + private static readonly APIUser user_with_null_values = new APIUser { Id = 1 }; - private static readonly User user_with_empty_values = new User + private static readonly APIUser user_with_empty_values = new APIUser { Id = 2, - MonthlyPlaycounts = Array.Empty() + MonthlyPlaycounts = Array.Empty() }; - private static readonly User user_with_one_value = new User + private static readonly APIUser user_with_one_value = new APIUser { Id = 3, MonthlyPlaycounts = new[] { - new UserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 100 } + new APIUserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 100 } } }; - private static readonly User user_with_two_values = new User + private static readonly APIUser user_with_two_values = new APIUser { Id = 4, MonthlyPlaycounts = new[] { - new UserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 1 }, - new UserHistoryCount { Date = new DateTime(2010, 6, 1), Count = 2 } + new APIUserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 1 }, + new APIUserHistoryCount { Date = new DateTime(2010, 6, 1), Count = 2 } } }; - private static readonly User user_with_constant_values = new User + private static readonly APIUser user_with_constant_values = new APIUser { Id = 5, MonthlyPlaycounts = new[] { - new UserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 5 }, - new UserHistoryCount { Date = new DateTime(2010, 6, 1), Count = 5 }, - new UserHistoryCount { Date = new DateTime(2010, 7, 1), Count = 5 } + new APIUserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 5 }, + new APIUserHistoryCount { Date = new DateTime(2010, 6, 1), Count = 5 }, + new APIUserHistoryCount { Date = new DateTime(2010, 7, 1), Count = 5 } } }; - private static readonly User user_with_zero_values = new User + private static readonly APIUser user_with_zero_values = new APIUser { Id = 6, MonthlyPlaycounts = new[] { - new UserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 0 }, - new UserHistoryCount { Date = new DateTime(2010, 6, 1), Count = 0 }, - new UserHistoryCount { Date = new DateTime(2010, 7, 1), Count = 0 } + new APIUserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 0 }, + new APIUserHistoryCount { Date = new DateTime(2010, 6, 1), Count = 0 }, + new APIUserHistoryCount { Date = new DateTime(2010, 7, 1), Count = 0 } } }; - private static readonly User user_with_filled_values = new User + private static readonly APIUser user_with_filled_values = new APIUser { Id = 7, MonthlyPlaycounts = new[] { - new UserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 1000 }, - new UserHistoryCount { Date = new DateTime(2010, 6, 1), Count = 20 }, - new UserHistoryCount { Date = new DateTime(2010, 7, 1), Count = 20000 }, - new UserHistoryCount { Date = new DateTime(2010, 8, 1), Count = 30 }, - new UserHistoryCount { Date = new DateTime(2010, 9, 1), Count = 50 }, - new UserHistoryCount { Date = new DateTime(2010, 10, 1), Count = 2000 }, - new UserHistoryCount { Date = new DateTime(2010, 11, 1), Count = 2100 } + new APIUserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 1000 }, + new APIUserHistoryCount { Date = new DateTime(2010, 6, 1), Count = 20 }, + new APIUserHistoryCount { Date = new DateTime(2010, 7, 1), Count = 20000 }, + new APIUserHistoryCount { Date = new DateTime(2010, 8, 1), Count = 30 }, + new APIUserHistoryCount { Date = new DateTime(2010, 9, 1), Count = 50 }, + new APIUserHistoryCount { Date = new DateTime(2010, 10, 1), Count = 2000 }, + new APIUserHistoryCount { Date = new DateTime(2010, 11, 1), Count = 2100 } } }; - private static readonly User user_with_missing_values = new User + private static readonly APIUser user_with_missing_values = new APIUser { Id = 8, MonthlyPlaycounts = new[] { - new UserHistoryCount { Date = new DateTime(2020, 1, 1), Count = 100 }, - new UserHistoryCount { Date = new DateTime(2020, 7, 1), Count = 200 } + new APIUserHistoryCount { Date = new DateTime(2020, 1, 1), Count = 100 }, + new APIUserHistoryCount { Date = new DateTime(2020, 7, 1), Count = 200 } } }; } diff --git a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs index 6a847e4269..cbbe8b8eac 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneProfileRulesetSelector.cs @@ -7,10 +7,10 @@ using osu.Game.Rulesets.Catch; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Taiko; -using osu.Game.Users; using osu.Framework.Bindables; using osu.Game.Overlays; using osu.Framework.Allocation; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Tests.Visual.Online { @@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual.Online public TestSceneProfileRulesetSelector() { ProfileRulesetSelector selector; - var user = new Bindable(); + var user = new Bindable(); Child = selector = new ProfileRulesetSelector { @@ -36,10 +36,10 @@ namespace osu.Game.Tests.Visual.Online AddStep("set taiko as default", () => selector.SetDefaultRuleset(new TaikoRuleset().RulesetInfo)); AddStep("set catch as default", () => selector.SetDefaultRuleset(new CatchRuleset().RulesetInfo)); - AddStep("User with osu as default", () => user.Value = new User { PlayMode = "osu" }); - AddStep("User with mania as default", () => user.Value = new User { PlayMode = "mania" }); - AddStep("User with taiko as default", () => user.Value = new User { PlayMode = "taiko" }); - AddStep("User with catch as default", () => user.Value = new User { PlayMode = "fruits" }); + 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("null user", () => user.Value = null); } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs b/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs index f577140e17..61574a7f23 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankGraph.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Users; @@ -81,7 +82,7 @@ namespace osu.Game.Tests.Visual.Online { GlobalRank = 89000, PP = 12345, - RankHistory = new User.RankHistoryData + RankHistory = new APIRankHistory { Data = data, } @@ -94,7 +95,7 @@ namespace osu.Game.Tests.Visual.Online { GlobalRank = 89000, PP = 12345, - RankHistory = new User.RankHistoryData + RankHistory = new APIRankHistory { Data = dataWithZeros, } @@ -107,7 +108,7 @@ namespace osu.Game.Tests.Visual.Online { GlobalRank = 12000, PP = 12345, - RankHistory = new User.RankHistoryData + RankHistory = new APIRankHistory { Data = smallData, } @@ -120,7 +121,7 @@ namespace osu.Game.Tests.Visual.Online { GlobalRank = 12000, PP = 12345, - RankHistory = new User.RankHistoryData + RankHistory = new APIRankHistory { Data = edgyData, } diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs index 23899154c4..50969aad9b 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs @@ -15,6 +15,7 @@ using osu.Game.Rulesets.Osu.Mods; using osu.Game.Scoring; using osu.Game.Users; using osuTK.Graphics; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Online { @@ -50,7 +51,7 @@ namespace osu.Game.Tests.Visual.Online { new APIScoreInfo { - User = new User + User = new APIUser { Id = 6602580, Username = @"waaiiru", @@ -75,7 +76,7 @@ namespace osu.Game.Tests.Visual.Online }, new APIScoreInfo { - User = new User + User = new APIUser { Id = 4608074, Username = @"Skycries", @@ -99,7 +100,7 @@ namespace osu.Game.Tests.Visual.Online }, new APIScoreInfo { - User = new User + User = new APIUser { Id = 1014222, Username = @"eLy", @@ -122,7 +123,7 @@ namespace osu.Game.Tests.Visual.Online }, new APIScoreInfo { - User = new User + User = new APIUser { Id = 1541390, Username = @"Toukai", @@ -144,7 +145,7 @@ namespace osu.Game.Tests.Visual.Online }, new APIScoreInfo { - User = new User + User = new APIUser { Id = 7151382, Username = @"Mayuri Hana", @@ -167,7 +168,7 @@ namespace osu.Game.Tests.Visual.Online { Score = new APIScoreInfo { - User = new User + User = new APIUser { Id = 7151382, Username = @"Mayuri Hana", @@ -190,7 +191,7 @@ namespace osu.Game.Tests.Visual.Online { Score = new APIScoreInfo { - User = new User + User = new APIUser { Id = 7151382, Username = @"Mayuri Hana", @@ -215,7 +216,7 @@ namespace osu.Game.Tests.Visual.Online { new APIScoreInfo { - User = new User + User = new APIUser { Id = 6602580, Username = @"waaiiru", diff --git a/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs b/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs index b3b8d75c46..b7bce012ce 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs @@ -4,13 +4,13 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Online.Chat; -using osu.Game.Users; using osuTK; using System; using System.Linq; using NUnit.Framework; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Containers; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Chat; using osuTK.Input; @@ -18,26 +18,26 @@ namespace osu.Game.Tests.Visual.Online { public class TestSceneStandAloneChatDisplay : OsuManualInputManagerTestScene { - private readonly User admin = new User + private readonly APIUser admin = new APIUser { Username = "HappyStick", Id = 2, Colour = "f2ca34" }; - private readonly User redUser = new User + private readonly APIUser redUser = new APIUser { Username = "BanchoBot", Id = 3, }; - private readonly User blueUser = new User + private readonly APIUser blueUser = new APIUser { Username = "Zallius", Id = 4, }; - private readonly User longUsernameUser = new User + private readonly APIUser longUsernameUser = new APIUser { Username = "Very Long Long Username", Id = 5, diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserHistoryGraph.cs b/osu.Game.Tests/Visual/Online/TestSceneUserHistoryGraph.cs index 484c59695e..3f4a5cd420 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserHistoryGraph.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserHistoryGraph.cs @@ -2,11 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osu.Game.Overlays.Profile.Sections.Historical; -using osu.Framework.Graphics; -using osu.Game.Overlays; using osu.Framework.Allocation; -using static osu.Game.Users.User; +using osu.Framework.Graphics; +using osu.Game.Online.API.Requests.Responses; +using osu.Game.Overlays; +using osu.Game.Overlays.Profile.Sections.Historical; namespace osu.Game.Tests.Visual.Online { @@ -29,28 +29,28 @@ namespace osu.Game.Tests.Visual.Online var values = new[] { - new UserHistoryCount { Date = new DateTime(2000, 1, 1), Count = 10 }, - new UserHistoryCount { Date = new DateTime(2000, 2, 1), Count = 20 }, - new UserHistoryCount { Date = new DateTime(2000, 3, 1), Count = 100 }, - new UserHistoryCount { Date = new DateTime(2000, 4, 1), Count = 15 }, - new UserHistoryCount { Date = new DateTime(2000, 5, 1), Count = 30 } + new APIUserHistoryCount { Date = new DateTime(2000, 1, 1), Count = 10 }, + new APIUserHistoryCount { Date = new DateTime(2000, 2, 1), Count = 20 }, + new APIUserHistoryCount { Date = new DateTime(2000, 3, 1), Count = 100 }, + new APIUserHistoryCount { Date = new DateTime(2000, 4, 1), Count = 15 }, + new APIUserHistoryCount { Date = new DateTime(2000, 5, 1), Count = 30 } }; var moreValues = new[] { - new UserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 1000 }, - new UserHistoryCount { Date = new DateTime(2010, 6, 1), Count = 20 }, - new UserHistoryCount { Date = new DateTime(2010, 7, 1), Count = 20000 }, - new UserHistoryCount { Date = new DateTime(2010, 8, 1), Count = 30 }, - new UserHistoryCount { Date = new DateTime(2010, 9, 1), Count = 50 }, - new UserHistoryCount { Date = new DateTime(2010, 10, 1), Count = 2000 }, - new UserHistoryCount { Date = new DateTime(2010, 11, 1), Count = 2100 } + new APIUserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 1000 }, + new APIUserHistoryCount { Date = new DateTime(2010, 6, 1), Count = 20 }, + new APIUserHistoryCount { Date = new DateTime(2010, 7, 1), Count = 20000 }, + new APIUserHistoryCount { Date = new DateTime(2010, 8, 1), Count = 30 }, + new APIUserHistoryCount { Date = new DateTime(2010, 9, 1), Count = 50 }, + new APIUserHistoryCount { Date = new DateTime(2010, 10, 1), Count = 2000 }, + new APIUserHistoryCount { Date = new DateTime(2010, 11, 1), Count = 2100 } }; AddStep("Set fake values", () => graph.Values = values); AddStep("Set more values", () => graph.Values = moreValues); AddStep("Set null values", () => graph.Values = null); - AddStep("Set empty values", () => graph.Values = Array.Empty()); + AddStep("Set empty values", () => graph.Values = Array.Empty()); } } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs index a048ae2c54..19e06beaad 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserPanel.cs @@ -7,6 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Users; using osuTK; @@ -42,27 +43,27 @@ namespace osu.Game.Tests.Visual.Online Spacing = new Vector2(10f), Children = new Drawable[] { - new UserBrickPanel(new User + new UserBrickPanel(new APIUser { Username = @"flyte", Id = 3103765, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" }), - new UserBrickPanel(new User + new UserBrickPanel(new APIUser { Username = @"peppy", Id = 2, Colour = "99EB47", CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg", }), - flyte = new UserGridPanel(new User + flyte = new UserGridPanel(new APIUser { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" }, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" }) { Width = 300 }, - peppy = new UserGridPanel(new User + peppy = new UserGridPanel(new APIUser { Username = @"peppy", Id = 2, @@ -71,7 +72,7 @@ namespace osu.Game.Tests.Visual.Online IsSupporter = true, SupportLevel = 3, }) { Width = 300 }, - evast = new TestUserListPanel(new User + evast = new TestUserListPanel(new APIUser { Username = @"Evast", Id = 8195163, @@ -134,7 +135,7 @@ namespace osu.Game.Tests.Visual.Online private class TestUserListPanel : UserListPanel { - public TestUserListPanel(User user) + public TestUserListPanel(APIUser user) : base(user) { } diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs index 04b741b2bb..76997bded7 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileHeader.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Allocation; 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.Profile; using osu.Game.Users; @@ -30,26 +31,26 @@ namespace osu.Game.Tests.Visual.Online AddStep("Show test dummy", () => header.User.Value = TestSceneUserProfileOverlay.TEST_USER); - AddStep("Show null dummy", () => header.User.Value = new User + AddStep("Show null dummy", () => header.User.Value = new APIUser { Username = "Null" }); - AddStep("Show online dummy", () => header.User.Value = new User + AddStep("Show online dummy", () => header.User.Value = new APIUser { Username = "IAmOnline", LastVisit = DateTimeOffset.Now, IsOnline = true, }); - AddStep("Show offline dummy", () => header.User.Value = new User + AddStep("Show offline dummy", () => header.User.Value = new APIUser { Username = "IAmOffline", LastVisit = DateTimeOffset.Now, IsOnline = false, }); - addOnlineStep("Show ppy", new User + addOnlineStep("Show ppy", new APIUser { Username = @"peppy", Id = 2, @@ -58,7 +59,7 @@ namespace osu.Game.Tests.Visual.Online CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" }); - addOnlineStep("Show flyte", new User + addOnlineStep("Show flyte", new APIUser { Username = @"flyte", Id = 3103765, @@ -67,7 +68,7 @@ namespace osu.Game.Tests.Visual.Online }); } - private void addOnlineStep(string name, User fallback) + private void addOnlineStep(string name, APIUser fallback) { AddStep(name, () => { diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs index 70271b0b08..ce8136199f 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfileOverlay.cs @@ -6,6 +6,7 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Profile; using osu.Game.Users; @@ -22,7 +23,7 @@ namespace osu.Game.Tests.Visual.Online [Resolved] private IAPIProvider api { get; set; } - public static readonly User TEST_USER = new User + public static readonly APIUser TEST_USER = new APIUser { Username = @"Somebody", Id = 1, @@ -41,7 +42,7 @@ namespace osu.Game.Tests.Visual.Online Current = 727, Progress = 69, }, - RankHistory = new User.RankHistoryData + RankHistory = new APIRankHistory { Mode = @"osu", Data = Enumerable.Range(2345, 45).Concat(Enumerable.Range(2109, 40)).ToArray() @@ -58,7 +59,7 @@ namespace osu.Game.Tests.Visual.Online }, Title = "osu!volunteer", Colour = "ff0000", - Achievements = Array.Empty(), + Achievements = Array.Empty(), }; public TestSceneUserProfileOverlay() @@ -70,42 +71,42 @@ namespace osu.Game.Tests.Visual.Online { base.LoadComplete(); - AddStep("Show offline dummy", () => profile.ShowUser(TEST_USER, false)); + AddStep("Show offline dummy", () => profile.ShowUser(TEST_USER)); - AddStep("Show null dummy", () => profile.ShowUser(new User + AddStep("Show null dummy", () => profile.ShowUser(new APIUser { Username = @"Null", Id = 1, - }, false)); + })); - AddStep("Show ppy", () => profile.ShowUser(new User + AddStep("Show ppy", () => profile.ShowUser(new APIUser { Username = @"peppy", Id = 2, IsSupporter = true, Country = new Country { FullName = @"Australia", FlagName = @"AU" }, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c3.jpg" - }, api.IsLoggedIn)); + })); - AddStep("Show flyte", () => profile.ShowUser(new User + AddStep("Show flyte", () => profile.ShowUser(new APIUser { Username = @"flyte", Id = 3103765, Country = new Country { FullName = @"Japan", FlagName = @"JP" }, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c6.jpg" - }, api.IsLoggedIn)); + })); - AddStep("Show bancho", () => profile.ShowUser(new User + AddStep("Show bancho", () => profile.ShowUser(new APIUser { Username = @"BanchoBot", Id = 3, IsBot = true, Country = new Country { FullName = @"Saint Helena", FlagName = @"SH" }, CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg" - }, api.IsLoggedIn)); + })); - AddStep("Show ppy from username", () => profile.ShowUser(@"peppy")); - AddStep("Show flyte from username", () => profile.ShowUser(@"flyte")); + AddStep("Show ppy from username", () => profile.ShowUser(new APIUser { Username = @"peppy" })); + AddStep("Show flyte from username", () => profile.ShowUser(new APIUser { Username = @"flyte" })); AddStep("Hide", profile.Hide); AddStep("Show without reload", profile.Show); diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserProfilePreviousUsernames.cs b/osu.Game.Tests/Visual/Online/TestSceneUserProfilePreviousUsernames.cs index b5d2d15392..30774689a2 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserProfilePreviousUsernames.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserProfilePreviousUsernames.cs @@ -4,8 +4,8 @@ using System; using NUnit.Framework; using osu.Framework.Graphics; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Profile.Header.Components; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Online { @@ -48,13 +48,13 @@ namespace osu.Game.Tests.Visual.Online AddUntilStep("Is hidden", () => container.Alpha == 0); } - private static readonly User[] users = + private static readonly APIUser[] users = { - new User { Id = 1, PreviousUsernames = new[] { "username1" } }, - new User { Id = 2, PreviousUsernames = new[] { "longusername", "longerusername" } }, - new User { Id = 3, PreviousUsernames = new[] { "test", "angelsim", "verylongusername" } }, - new User { Id = 4, PreviousUsernames = new[] { "ihavenoidea", "howcani", "makethistext", "anylonger" } }, - new User { Id = 5, PreviousUsernames = Array.Empty() }, + new APIUser { Id = 1, PreviousUsernames = new[] { "username1" } }, + new APIUser { Id = 2, PreviousUsernames = new[] { "longusername", "longerusername" } }, + new APIUser { Id = 3, PreviousUsernames = new[] { "test", "angelsim", "verylongusername" } }, + new APIUser { Id = 4, PreviousUsernames = new[] { "ihavenoidea", "howcani", "makethistext", "anylonger" } }, + new APIUser { Id = 5, PreviousUsernames = Array.Empty() }, null }; } diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs b/osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs index c22cff4af6..b9272e7294 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserRanks.cs @@ -8,9 +8,9 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Profile.Sections; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Online { @@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.Online } }); - AddStep("Show cookiezi", () => ranks.User.Value = new User { Id = 124493 }); + AddStep("Show cookiezi", () => ranks.User.Value = new APIUser { Id = 124493 }); } } } diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs b/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs index 15cfd3ee54..e7b6a94642 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs @@ -9,10 +9,10 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Rulesets; using osu.Game.Rulesets.Mania; -using osu.Game.Users; using osu.Framework.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Taiko; namespace osu.Game.Tests.Visual.Online @@ -23,7 +23,7 @@ namespace osu.Game.Tests.Visual.Online [Resolved] private IAPIProvider api { get; set; } - private readonly Bindable user = new Bindable(); + private readonly Bindable user = new Bindable(); private GetUserRequest request; private readonly LoadingLayer loading; @@ -71,7 +71,7 @@ namespace osu.Game.Tests.Visual.Online private class UserTestContainer : FillFlowContainer { - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); public UserTestContainer() { @@ -85,7 +85,7 @@ namespace osu.Game.Tests.Visual.Online User.BindValueChanged(onUserUpdate, true); } - private void onUserUpdate(ValueChangedEvent user) + private void onUserUpdate(ValueChangedEvent user) { Clear(); diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsParticipantsList.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsParticipantsList.cs index 76a78c0a3c..1288b9e765 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsParticipantsList.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsParticipantsList.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using osu.Framework.Graphics; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Components; using osu.Game.Tests.Visual.OnlinePlay; @@ -19,7 +20,7 @@ namespace osu.Game.Tests.Visual.Playlists for (int i = 0; i < 50; i++) { - SelectedRoom.Value.RecentParticipants.Add(new User + SelectedRoom.Value.RecentParticipants.Add(new APIUser { Username = "peppy", Statistics = new UserStatistics { GlobalRank = 1234 }, diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs index d948aebbbf..4284bc6358 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsResultsScreen.cs @@ -14,6 +14,7 @@ using osu.Game.Graphics.Containers; 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.Rooms; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; @@ -21,7 +22,6 @@ using osu.Game.Scoring; using osu.Game.Screens.OnlinePlay.Playlists; using osu.Game.Screens.Ranking; using osu.Game.Tests.Beatmaps; -using osu.Game.Users; namespace osu.Game.Tests.Visual.Playlists { @@ -260,7 +260,7 @@ namespace osu.Game.Tests.Visual.Playlists Rank = userScore.Rank, MaxCombo = userScore.MaxCombo, TotalScore = userScore.TotalScore - i, - User = new User + User = new APIUser { Id = 2, Username = $"peppy{i}", @@ -278,7 +278,7 @@ namespace osu.Game.Tests.Visual.Playlists Rank = userScore.Rank, MaxCombo = userScore.MaxCombo, TotalScore = userScore.TotalScore + i, - User = new User + User = new APIUser { Id = 2, Username = $"peppy{i}", @@ -314,7 +314,7 @@ namespace osu.Game.Tests.Visual.Playlists Rank = ScoreRank.X, MaxCombo = 1000, TotalScore = startTotalScore + (sort == "score_asc" ? i : -i), - User = new User + User = new APIUser { Id = 2, Username = $"peppy{i}", diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs b/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs index df8500fab2..944941723e 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; @@ -15,7 +16,6 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Screens.Ranking.Expanded.Accuracy; using osu.Game.Tests.Beatmaps; -using osu.Game.Users; using osuTK; namespace osu.Game.Tests.Visual.Ranking @@ -66,7 +66,7 @@ namespace osu.Game.Tests.Visual.Ranking private ScoreInfo createScore(double accuracy, ScoreRank rank) => new ScoreInfo { - User = new User + User = new APIUser { Id = 2, Username = "peppy", diff --git a/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs b/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs index 899f351a2a..9983993d9c 100644 --- a/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs +++ b/osu.Game.Tests/Visual/Ranking/TestSceneExpandedPanelMiddleContent.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Linq; +using JetBrains.Annotations; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; @@ -11,6 +12,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Graphics.Sprites; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; @@ -18,7 +20,6 @@ using osu.Game.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Screens.Ranking.Expanded; using osu.Game.Tests.Beatmaps; -using osu.Game.Users; using osuTK; namespace osu.Game.Tests.Visual.Ranking @@ -31,7 +32,7 @@ namespace osu.Game.Tests.Visual.Ranking [Test] public void TestMapWithKnownMapper() { - var author = new User { Username = "mapper_name" }; + var author = new APIUser { Username = "mapper_name" }; AddStep("show example score", () => showPanel(new TestScoreInfo(new OsuRuleset().RulesetInfo) { @@ -42,7 +43,7 @@ namespace osu.Game.Tests.Visual.Ranking [Test] public void TestExcessMods() { - var author = new User { Username = "mapper_name" }; + var author = new APIUser { Username = "mapper_name" }; AddStep("show excess mods score", () => showPanel(new TestScoreInfo(new OsuRuleset().RulesetInfo, true) { @@ -57,7 +58,7 @@ namespace osu.Game.Tests.Visual.Ranking { AddStep("show example score", () => showPanel(new TestScoreInfo(new OsuRuleset().RulesetInfo) { - BeatmapInfo = createTestBeatmap(null) + BeatmapInfo = createTestBeatmap(new APIUser()) })); AddAssert("mapped by text not present", () => @@ -74,7 +75,7 @@ namespace osu.Game.Tests.Visual.Ranking var ruleset = new OsuRuleset(); var mods = new Mod[] { ruleset.GetAutoplayMod() }; - var beatmap = createTestBeatmap(null); + var beatmap = createTestBeatmap(new APIUser()); showPanel(new TestScoreInfo(ruleset.RulesetInfo) { @@ -90,7 +91,7 @@ namespace osu.Game.Tests.Visual.Ranking private void showPanel(ScoreInfo score) => Child = new ExpandedPanelMiddleContentContainer(score); - private BeatmapInfo createTestBeatmap(User author) + private BeatmapInfo createTestBeatmap([NotNull] APIUser author) { var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0)).BeatmapInfo; diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs index 7a38d213d9..9a142f3ca8 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapCarousel.cs @@ -400,7 +400,7 @@ namespace osu.Game.Tests.Visual.SongSelect loadBeatmaps(); AddStep("Sort by author", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Author }, false)); - AddAssert("Check zzzzz is at bottom", () => carousel.BeatmapSets.Last().Metadata.AuthorString == "zzzzz"); + AddAssert("Check zzzzz is at bottom", () => carousel.BeatmapSets.Last().Metadata.Author.Username == "zzzzz"); AddStep("Sort by artist", () => carousel.Filter(new FilterCriteria { Sort = SortMode.Artist }, false)); AddAssert($"Check #{set_count} is at bottom", () => carousel.BeatmapSets.Last().Metadata.Title.EndsWith($"#{set_count}!", StringComparison.Ordinal)); } diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs index 13b769c80a..855a59b5f5 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapLeaderboard.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Platform; using osu.Framework.Testing; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Leaderboards; using osu.Game.Overlays; using osu.Game.Rulesets; @@ -133,7 +134,7 @@ namespace osu.Game.Tests.Visual.SongSelect MaxCombo = 244, TotalScore = 1707827, Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock() }, - User = new User + User = new APIUser { Id = 6602580, Username = @"waaiiru", @@ -156,7 +157,7 @@ namespace osu.Game.Tests.Visual.SongSelect MaxCombo = 244, TotalScore = 1707827, Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), }, - User = new User + User = new APIUser { Id = 6602580, Username = @"waaiiru", @@ -198,7 +199,7 @@ namespace osu.Game.Tests.Visual.SongSelect TotalScore = 1707827, //Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), }, BeatmapInfo = beatmapInfo, - User = new User + User = new APIUser { Id = 6602580, Username = @"waaiiru", @@ -217,7 +218,7 @@ namespace osu.Game.Tests.Visual.SongSelect TotalScore = 1707827, //Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), }, BeatmapInfo = beatmapInfo, - User = new User + User = new APIUser { Id = 4608074, Username = @"Skycries", @@ -236,7 +237,7 @@ namespace osu.Game.Tests.Visual.SongSelect TotalScore = 1707827, //Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), }, BeatmapInfo = beatmapInfo, - User = new User + User = new APIUser { Id = 1014222, Username = @"eLy", @@ -255,7 +256,7 @@ namespace osu.Game.Tests.Visual.SongSelect TotalScore = 1707827, //Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), }, BeatmapInfo = beatmapInfo, - User = new User + User = new APIUser { Id = 1541390, Username = @"Toukai", @@ -274,7 +275,7 @@ namespace osu.Game.Tests.Visual.SongSelect TotalScore = 1707827, //Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), }, BeatmapInfo = beatmapInfo, - User = new User + User = new APIUser { Id = 2243452, Username = @"Satoruu", @@ -293,7 +294,7 @@ namespace osu.Game.Tests.Visual.SongSelect TotalScore = 1707827, //Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), }, BeatmapInfo = beatmapInfo, - User = new User + User = new APIUser { Id = 2705430, Username = @"Mooha", @@ -312,7 +313,7 @@ namespace osu.Game.Tests.Visual.SongSelect TotalScore = 1707827, //Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), }, BeatmapInfo = beatmapInfo, - User = new User + User = new APIUser { Id = 7151382, Username = @"Mayuri Hana", @@ -331,7 +332,7 @@ namespace osu.Game.Tests.Visual.SongSelect TotalScore = 1707827, //Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), }, BeatmapInfo = beatmapInfo, - User = new User + User = new APIUser { Id = 2051389, Username = @"FunOrange", @@ -350,7 +351,7 @@ namespace osu.Game.Tests.Visual.SongSelect TotalScore = 1707827, //Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), }, BeatmapInfo = beatmapInfo, - User = new User + User = new APIUser { Id = 6169483, Username = @"-Hebel-", @@ -369,7 +370,7 @@ namespace osu.Game.Tests.Visual.SongSelect TotalScore = 1707827, //Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), }, BeatmapInfo = beatmapInfo, - User = new User + User = new APIUser { Id = 6702666, Username = @"prhtnsm", diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs index c22b6a54e9..68d5836cac 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneBeatmapRecommendations.cs @@ -9,6 +9,7 @@ using osu.Framework.Testing; using osu.Game.Beatmaps; 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; @@ -40,9 +41,9 @@ namespace osu.Game.Tests.Visual.SongSelect base.SetUpSteps(); - User getUser(int? rulesetID) + APIUser getUser(int? rulesetID) { - return new User + return new APIUser { Username = @"Dummy", Id = 1001, diff --git a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs index 4811fc979e..4861354921 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestScenePlaySongSelect.cs @@ -18,6 +18,7 @@ using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; @@ -29,7 +30,6 @@ using osu.Game.Screens.Play; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Carousel; using osu.Game.Screens.Select.Filter; -using osu.Game.Users; using osuTK.Input; namespace osu.Game.Tests.Visual.SongSelect @@ -807,7 +807,7 @@ namespace osu.Game.Tests.Visual.SongSelect songSelect.PresentScore(new ScoreInfo { - User = new User { Username = "woo" }, + User = new APIUser { Username = "woo" }, BeatmapInfo = getPresentBeatmap(), Ruleset = getPresentBeatmap().Ruleset }); @@ -839,7 +839,7 @@ namespace osu.Game.Tests.Visual.SongSelect songSelect.PresentScore(new ScoreInfo { - User = new User { Username = "woo" }, + User = new APIUser { Username = "woo" }, BeatmapInfo = getPresentBeatmap(), Ruleset = getPresentBeatmap().Ruleset }); diff --git a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs index b8b8792b9b..7af9e9eb40 100644 --- a/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestSceneUserTopScoreContainer.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Game.Online.API.Requests.Responses; using osuTK.Graphics; using osu.Game.Online.Leaderboards; using osu.Game.Overlays; @@ -60,7 +61,7 @@ namespace osu.Game.Tests.Visual.SongSelect MaxCombo = 244, TotalScore = 1707827, Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), }, - User = new User + User = new APIUser { Id = 6602580, Username = @"waaiiru", @@ -78,7 +79,7 @@ namespace osu.Game.Tests.Visual.SongSelect Accuracy = 1, MaxCombo = 244, TotalScore = 1707827, - User = new User + User = new APIUser { Id = 4608074, Username = @"Skycries", @@ -96,7 +97,7 @@ namespace osu.Game.Tests.Visual.SongSelect Accuracy = 1, MaxCombo = 244, TotalScore = 1707827, - User = new User + User = new APIUser { Id = 1541390, Username = @"Toukai", diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDashboardBeatmapListing.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDashboardBeatmapListing.cs index 06c64a566e..17ac812eb0 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDashboardBeatmapListing.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDashboardBeatmapListing.cs @@ -7,11 +7,11 @@ using osu.Game.Overlays.Dashboard.Home; using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Framework.Allocation; -using osu.Game.Users; using System; using osu.Framework.Graphics.Shapes; using System.Collections.Generic; using osu.Game.Online.API.Requests.Responses; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.UserInterface { @@ -62,7 +62,7 @@ namespace osu.Game.Tests.Visual.UserInterface { Title = "Very Long Title (TV size) [TATOE]", Artist = "This artist has a really long name how is this possible", - Author = new User + Author = new APIUser { Username = "author", Id = 100 @@ -77,7 +77,7 @@ namespace osu.Game.Tests.Visual.UserInterface { Title = "Very Long Title (TV size) [TATOE]", Artist = "This artist has a really long name how is this possible", - Author = new User + Author = new APIUser { Username = "author", Id = 100 @@ -96,7 +96,7 @@ namespace osu.Game.Tests.Visual.UserInterface { Title = "Very Long Title (TV size) [TATOE]", Artist = "This artist has a really long name how is this possible", - Author = new User + Author = new APIUser { Username = "author", Id = 100 @@ -111,7 +111,7 @@ namespace osu.Game.Tests.Visual.UserInterface { Title = "Very Long Title (TV size) [TATOE]", Artist = "This artist has a really long name how is this possible", - Author = new User + Author = new APIUser { Username = "author", Id = 100 diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs index 9a75d3c309..07759d598e 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs @@ -15,13 +15,13 @@ using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Leaderboards; using osu.Game.Overlays; using osu.Game.Rulesets; using osu.Game.Scoring; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Tests.Resources; -using osu.Game.Users; using osuTK; using osuTK.Input; @@ -64,7 +64,7 @@ namespace osu.Game.Tests.Visual.UserInterface ID = 1, Title = "TestSong", Artist = "TestArtist", - Author = new User + Author = new APIUser { Username = "TestAuthor" }, @@ -98,7 +98,7 @@ namespace osu.Game.Tests.Visual.UserInterface TotalScore = RNG.Next(1, 1000000), MaxCombo = RNG.Next(1, 1000), Rank = ScoreRank.XH, - User = new User { Username = "TestUser" }, + User = new APIUser { Username = "TestUser" }, }; importedScores.Add(scoreManager.Import(score).Result.Value); diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneFriendsOnlineStatusControl.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneFriendsOnlineStatusControl.cs index 9fa5c83dba..ea3cfbd497 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneFriendsOnlineStatusControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneFriendsOnlineStatusControl.cs @@ -6,9 +6,9 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Dashboard.Friends; -using osu.Game.Users; namespace osu.Game.Tests.Visual.UserInterface { @@ -29,17 +29,17 @@ namespace osu.Game.Tests.Visual.UserInterface [Test] public void Populate() { - AddStep("Populate", () => control.Populate(new List + AddStep("Populate", () => control.Populate(new List { - new User + new APIUser { IsOnline = true }, - new User + new APIUser { IsOnline = false }, - new User + new APIUser { IsOnline = false } diff --git a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs index 376c59ec2d..bb47683be1 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneDrawableTournamentTeam.cs @@ -3,13 +3,13 @@ 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; using osu.Game.Tournament.Screens.Drawings.Components; using osu.Game.Tournament.Screens.Gameplay.Components; using osu.Game.Tournament.Screens.Ladder.Components; -using osu.Game.Users; namespace osu.Game.Tournament.Tests.Components { @@ -24,13 +24,13 @@ namespace osu.Game.Tournament.Tests.Components FullName = { Value = "Australia" }, Players = { - new User { Username = "ASecretBox" }, - new User { Username = "Dereban" }, - new User { Username = "mReKk" }, - new User { Username = "uyghti" }, - new User { Username = "Parkes" }, - new User { Username = "Shiroha" }, - new User { Username = "Jordan The Bear" }, + 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" }, } }; diff --git a/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs index 9905e17824..05989566c3 100644 --- a/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs +++ b/osu.Game.Tournament.Tests/Components/TestSceneTournamentMatchChatDisplay.cs @@ -4,12 +4,12 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Chat; using osu.Game.Tests.Visual; using osu.Game.Tournament.Components; using osu.Game.Tournament.IPC; using osu.Game.Tournament.Models; -using osu.Game.Users; namespace osu.Game.Tournament.Tests.Components { @@ -18,20 +18,20 @@ namespace osu.Game.Tournament.Tests.Components private readonly Channel testChannel = new Channel(); private readonly Channel testChannel2 = new Channel(); - private readonly User admin = new User + private readonly APIUser admin = new APIUser { Username = "HappyStick", Id = 2, Colour = "f2ca34" }; - private readonly User redUser = new User + private readonly APIUser redUser = new APIUser { Username = "BanchoBot", Id = 3, }; - private readonly User blueUser = new User + private readonly APIUser blueUser = new APIUser { Username = "Zallius", Id = 4, @@ -57,11 +57,11 @@ namespace osu.Game.Tournament.Tests.Components { Team1 = { - Value = new TournamentTeam { Players = new BindableList { redUser } } + Value = new TournamentTeam { Players = new BindableList { redUser } } }, Team2 = { - Value = new TournamentTeam { Players = new BindableList { blueUser } } + Value = new TournamentTeam { Players = new BindableList { blueUser } } } }; diff --git a/osu.Game.Tournament.Tests/TournamentTestScene.cs b/osu.Game.Tournament.Tests/TournamentTestScene.cs index 81741a43a9..8c05b4e915 100644 --- a/osu.Game.Tournament.Tests/TournamentTestScene.cs +++ b/osu.Game.Tournament.Tests/TournamentTestScene.cs @@ -14,6 +14,7 @@ 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 { @@ -120,11 +121,11 @@ namespace osu.Game.Tournament.Tests }, Players = { - new User { Username = "Hello", Statistics = new UserStatistics { GlobalRank = 12 } }, - new User { Username = "Hello", Statistics = new UserStatistics { GlobalRank = 16 } }, - new User { Username = "Hello", Statistics = new UserStatistics { GlobalRank = 20 } }, - new User { Username = "Hello", Statistics = new UserStatistics { GlobalRank = 24 } }, - new User { Username = "Hello", Statistics = new UserStatistics { GlobalRank = 30 } }, + 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 } }, } } }, @@ -137,11 +138,11 @@ namespace osu.Game.Tournament.Tests FullName = { Value = "United States" }, Players = { - new User { Username = "Hello" }, - new User { Username = "Hello" }, - new User { Username = "Hello" }, - new User { Username = "Hello" }, - new User { Username = "Hello" }, + new APIUser { Username = "Hello" }, + new APIUser { Username = "Hello" }, + new APIUser { Username = "Hello" }, + new APIUser { Username = "Hello" }, + new APIUser { Username = "Hello" }, } } }, diff --git a/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs b/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs index e949bf9881..4d9afc23ac 100644 --- a/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs +++ b/osu.Game.Tournament/Components/DrawableTeamWithPlayers.cs @@ -5,8 +5,8 @@ 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 osu.Game.Users; using osuTK; using osuTK.Graphics; @@ -54,7 +54,7 @@ namespace osu.Game.Tournament.Components }, }; - TournamentSpriteText createPlayerText(User p) => + TournamentSpriteText createPlayerText(APIUser p) => new TournamentSpriteText { Text = p.Username, diff --git a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs index f3550f7465..364cccd076 100644 --- a/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs +++ b/osu.Game.Tournament/Components/TournamentBeatmapPanel.cs @@ -93,7 +93,7 @@ namespace osu.Game.Tournament.Components }, new TournamentSpriteText { - Text = Beatmap.Metadata.Author, + Text = Beatmap.Metadata.Author.Username, Padding = new MarginPadding { Right = 20 }, Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 14) }, diff --git a/osu.Game.Tournament/Models/TournamentTeam.cs b/osu.Game.Tournament/Models/TournamentTeam.cs index d895e4b538..24dee3b372 100644 --- a/osu.Game.Tournament/Models/TournamentTeam.cs +++ b/osu.Game.Tournament/Models/TournamentTeam.cs @@ -5,7 +5,7 @@ using System; using System.Linq; using Newtonsoft.Json; using osu.Framework.Bindables; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Tournament.Models { @@ -57,7 +57,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 0d2e64f300..6adddb5204 100644 --- a/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs +++ b/osu.Game.Tournament/Screens/Editors/TeamEditorScreen.cs @@ -13,6 +13,7 @@ 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; @@ -199,14 +200,14 @@ namespace osu.Game.Tournament.Screens.Editors public void CreateNew() { - var user = new User(); + var user = new APIUser(); team.Players.Add(user); flow.Add(new PlayerRow(team, user)); } public class PlayerRow : CompositeDrawable { - private readonly User user; + private readonly APIUser user; [Resolved] protected IAPIProvider API { get; private set; } @@ -218,7 +219,7 @@ namespace osu.Game.Tournament.Screens.Editors private readonly Container drawableContainer; - public PlayerRow(TournamentTeam team, User user) + public PlayerRow(TournamentTeam team, APIUser user) { this.user = user; diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index ee281466a2..d2f146c4c2 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -18,8 +18,8 @@ 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; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tournament { @@ -241,7 +241,7 @@ namespace osu.Game.Tournament private void updateLoadProgressMessage(string s) => Schedule(() => initialisationText.Text = s); - public void PopulateUser(User user, Action success = null, Action failure = null, bool immediate = false) + public void PopulateUser(APIUser user, Action success = null, Action failure = null, bool immediate = false) { var req = new GetUserRequest(user.Id, Ruleset.Value); diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index e0e5b5e63d..0dc095c40a 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -18,10 +18,10 @@ using osu.Game.Database; using osu.Game.IO; using osu.Game.IO.Archives; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Notifications; using osu.Game.Rulesets; using osu.Game.Skinning; -using osu.Game.Users; namespace osu.Game.Beatmaps { @@ -68,7 +68,7 @@ namespace osu.Game.Beatmaps /// /// Create a new . /// - public WorkingBeatmap CreateNew(RulesetInfo ruleset, User user) + public WorkingBeatmap CreateNew(RulesetInfo ruleset, APIUser user) { var metadata = new BeatmapMetadata { @@ -250,15 +250,11 @@ namespace osu.Game.Beatmaps public IBindable>> DownloadFailed => beatmapModelDownloader.DownloadFailed; - public bool Download(IBeatmapSetInfo model, bool minimiseDownloadSize = false) - { - return beatmapModelDownloader.Download(model, minimiseDownloadSize); - } + public bool Download(IBeatmapSetInfo model, bool minimiseDownloadSize = false) => + beatmapModelDownloader.Download(model, minimiseDownloadSize); - public ArchiveDownloadRequest GetExistingDownload(IBeatmapSetInfo model) - { - return beatmapModelDownloader.GetExistingDownload(model); - } + public ArchiveDownloadRequest GetExistingDownload(IBeatmapSetInfo model) => + beatmapModelDownloader.GetExistingDownload(model); #endregion diff --git a/osu.Game/Beatmaps/BeatmapMetadata.cs b/osu.Game/Beatmaps/BeatmapMetadata.cs index 5d3b4007ae..b395f16c24 100644 --- a/osu.Game/Beatmaps/BeatmapMetadata.cs +++ b/osu.Game/Beatmaps/BeatmapMetadata.cs @@ -7,6 +7,7 @@ using System.ComponentModel.DataAnnotations.Schema; using Newtonsoft.Json; using osu.Framework.Testing; using osu.Game.Database; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Users; #nullable enable @@ -36,41 +37,33 @@ namespace osu.Game.Beatmaps public List BeatmapSets { get; set; } = new List(); /// - /// Helper property to deserialize a username to . + /// The author of the beatmaps in this set. + /// + [JsonIgnore] + public APIUser Author = new APIUser(); + + /// + /// Helper property to deserialize a username to . /// [JsonProperty(@"user_id")] [Column("AuthorID")] public int AuthorID { - get => Author?.Id ?? 1; - set - { - Author ??= new User(); - Author.Id = value; - } + get => Author.Id; // This should not be used, but is required to make EF work correctly. + set => Author.Id = value; } /// - /// Helper property to deserialize a username to . + /// Helper property to deserialize a username to . /// [JsonProperty(@"creator")] [Column("Author")] public string AuthorString { - get => Author?.Username ?? string.Empty; - set - { - Author ??= new User(); - Author.Username = value; - } + get => Author.Username; // This should not be used, but is required to make EF work correctly. + set => Author.Username = value; } - /// - /// The author of the beatmaps in this set. - /// - [JsonIgnore] - public User? Author; - public string Source { get; set; } = string.Empty; [JsonProperty(@"tags")] @@ -90,6 +83,6 @@ namespace osu.Game.Beatmaps public override string ToString() => this.GetDisplayTitle(); - string IBeatmapMetadataInfo.Author => AuthorString; + IUser IBeatmapMetadataInfo.Author => Author; } } diff --git a/osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs b/osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs index fcaad17059..27cd7f8d9a 100644 --- a/osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs +++ b/osu.Game/Beatmaps/BeatmapMetadataInfoExtensions.cs @@ -13,7 +13,7 @@ namespace osu.Game.Beatmaps /// public static string[] GetSearchableTerms(this IBeatmapMetadataInfo metadataInfo) => new[] { - metadataInfo.Author, + metadataInfo.Author.Username, metadataInfo.Artist, metadataInfo.ArtistUnicode, metadataInfo.Title, @@ -27,7 +27,7 @@ namespace osu.Game.Beatmaps /// public static string GetDisplayTitle(this IBeatmapMetadataInfo metadataInfo) { - string author = string.IsNullOrEmpty(metadataInfo.Author) ? string.Empty : $"({metadataInfo.Author})"; + string author = string.IsNullOrEmpty(metadataInfo.Author.Username) ? string.Empty : $"({metadataInfo.Author})"; return $"{metadataInfo.Artist} - {metadataInfo.Title} {author}".Trim(); } @@ -36,7 +36,7 @@ namespace osu.Game.Beatmaps /// public static RomanisableString GetDisplayTitleRomanisable(this IBeatmapMetadataInfo metadataInfo, bool includeCreator = true) { - string author = !includeCreator || string.IsNullOrEmpty(metadataInfo.Author) ? string.Empty : $"({metadataInfo.Author})"; + string author = !includeCreator || string.IsNullOrEmpty(metadataInfo.Author.Username) ? string.Empty : $"({metadataInfo.Author})"; string artistUnicode = string.IsNullOrEmpty(metadataInfo.ArtistUnicode) ? metadataInfo.Artist : metadataInfo.ArtistUnicode; string titleUnicode = string.IsNullOrEmpty(metadataInfo.TitleUnicode) ? metadataInfo.Title : metadataInfo.TitleUnicode; diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs index 3ed5055b7f..9117da5d32 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapEncoder.cs @@ -129,7 +129,7 @@ namespace osu.Game.Beatmaps.Formats if (!string.IsNullOrEmpty(beatmap.Metadata.TitleUnicode)) writer.WriteLine(FormattableString.Invariant($"TitleUnicode: {beatmap.Metadata.TitleUnicode}")); writer.WriteLine(FormattableString.Invariant($"Artist: {beatmap.Metadata.Artist}")); if (!string.IsNullOrEmpty(beatmap.Metadata.ArtistUnicode)) writer.WriteLine(FormattableString.Invariant($"ArtistUnicode: {beatmap.Metadata.ArtistUnicode}")); - writer.WriteLine(FormattableString.Invariant($"Creator: {beatmap.Metadata.AuthorString}")); + writer.WriteLine(FormattableString.Invariant($"Creator: {beatmap.Metadata.Author.Username}")); writer.WriteLine(FormattableString.Invariant($"Version: {beatmap.BeatmapInfo.Version}")); if (!string.IsNullOrEmpty(beatmap.Metadata.Source)) writer.WriteLine(FormattableString.Invariant($"Source: {beatmap.Metadata.Source}")); if (!string.IsNullOrEmpty(beatmap.Metadata.Tags)) writer.WriteLine(FormattableString.Invariant($"Tags: {beatmap.Metadata.Tags}")); diff --git a/osu.Game/Beatmaps/IBeatmapMetadataInfo.cs b/osu.Game/Beatmaps/IBeatmapMetadataInfo.cs index 55aee7d7bc..968ad14928 100644 --- a/osu.Game/Beatmaps/IBeatmapMetadataInfo.cs +++ b/osu.Game/Beatmaps/IBeatmapMetadataInfo.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using osu.Game.Users; #nullable enable @@ -35,7 +36,7 @@ namespace osu.Game.Beatmaps /// /// The author of this beatmap. /// - string Author { get; } // eventually should be linked to a persisted User. + IUser Author { get; } /// /// The source of this beatmap. diff --git a/osu.Game/Database/RealmContextFactory.cs b/osu.Game/Database/RealmContextFactory.cs index 85f7dd6b89..20667bb3d1 100644 --- a/osu.Game/Database/RealmContextFactory.cs +++ b/osu.Game/Database/RealmContextFactory.cs @@ -3,6 +3,7 @@ using System; using System.Linq; +using System.Reflection; using System.Threading; using osu.Framework.Allocation; using osu.Framework.Development; @@ -35,8 +36,9 @@ namespace osu.Game.Database /// 6 First tracked version (~20211018) /// 7 Changed OnlineID fields to non-nullable to add indexing support (20211018) /// 8 Rebind scroll adjust keys to not have control modifier (20211029) + /// 9 Converted BeatmapMetadata.Author from string to RealmUser (20211104) /// - private const int schema_version = 8; + private const int schema_version = 9; /// /// Lock object which is held during sections, blocking context creation during blocking periods. @@ -151,50 +153,80 @@ namespace osu.Game.Database private void onMigration(Migration migration, ulong lastSchemaVersion) { - if (lastSchemaVersion < 8) + for (ulong i = lastSchemaVersion; i <= schema_version; i++) + applyMigrationsForVersion(migration, i); + } + + private void applyMigrationsForVersion(Migration migration, ulong version) + { + switch (version) { - // Ctrl -/+ now adjusts UI scale so let's clear any bindings which overlap these combinations. - // New defaults will be populated by the key store afterwards. - var keyBindings = migration.NewRealm.All(); + case 7: + convertOnlineIDs(); + convertOnlineIDs(); + convertOnlineIDs(); - var increaseSpeedBinding = keyBindings.FirstOrDefault(k => k.ActionInt == (int)GlobalAction.IncreaseScrollSpeed); - if (increaseSpeedBinding != null && increaseSpeedBinding.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Control, InputKey.Plus })) - migration.NewRealm.Remove(increaseSpeedBinding); - - var decreaseSpeedBinding = keyBindings.FirstOrDefault(k => k.ActionInt == (int)GlobalAction.DecreaseScrollSpeed); - if (decreaseSpeedBinding != null && decreaseSpeedBinding.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Control, InputKey.Minus })) - migration.NewRealm.Remove(decreaseSpeedBinding); - } - - if (lastSchemaVersion < 7) - { - convertOnlineIDs(); - convertOnlineIDs(); - convertOnlineIDs(); - - void convertOnlineIDs() where T : RealmObject - { - string className = typeof(T).Name.Replace(@"Realm", string.Empty); - - // version was not bumped when the beatmap/ruleset models were added - // therefore we must manually check for their presence to avoid throwing on the `DynamicApi` calls. - if (!migration.OldRealm.Schema.TryFindObjectSchema(className, out _)) - return; - - var oldItems = migration.OldRealm.DynamicApi.All(className); - var newItems = migration.NewRealm.DynamicApi.All(className); - - int itemCount = newItems.Count(); - - for (int i = 0; i < itemCount; i++) + void convertOnlineIDs() where T : RealmObject { - dynamic? oldItem = oldItems.ElementAt(i); - dynamic? newItem = newItems.ElementAt(i); + string className = getMappedOrOriginalName(typeof(T)); - long? nullableOnlineID = oldItem?.OnlineID; - newItem.OnlineID = (int)(nullableOnlineID ?? -1); + // version was not bumped when the beatmap/ruleset models were added + // therefore we must manually check for their presence to avoid throwing on the `DynamicApi` calls. + if (!migration.OldRealm.Schema.TryFindObjectSchema(className, out _)) + return; + + var oldItems = migration.OldRealm.DynamicApi.All(className); + var newItems = migration.NewRealm.DynamicApi.All(className); + + int itemCount = newItems.Count(); + + for (int i = 0; i < itemCount; i++) + { + dynamic? oldItem = oldItems.ElementAt(i); + dynamic? newItem = newItems.ElementAt(i); + + long? nullableOnlineID = oldItem?.OnlineID; + newItem.OnlineID = (int)(nullableOnlineID ?? -1); + } } - } + + break; + + case 8: + // Ctrl -/+ now adjusts UI scale so let's clear any bindings which overlap these combinations. + // New defaults will be populated by the key store afterwards. + var keyBindings = migration.NewRealm.All(); + + var increaseSpeedBinding = keyBindings.FirstOrDefault(k => k.ActionInt == (int)GlobalAction.IncreaseScrollSpeed); + if (increaseSpeedBinding != null && increaseSpeedBinding.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Control, InputKey.Plus })) + migration.NewRealm.Remove(increaseSpeedBinding); + + var decreaseSpeedBinding = keyBindings.FirstOrDefault(k => k.ActionInt == (int)GlobalAction.DecreaseScrollSpeed); + if (decreaseSpeedBinding != null && decreaseSpeedBinding.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Control, InputKey.Minus })) + migration.NewRealm.Remove(decreaseSpeedBinding); + + break; + + case 9: + // Pretty pointless to do this as beatmaps aren't really loaded via realm yet, but oh well. + var oldMetadata = migration.OldRealm.DynamicApi.All(getMappedOrOriginalName(typeof(RealmBeatmapMetadata))); + var newMetadata = migration.NewRealm.All(); + + int metadataCount = newMetadata.Count(); + + for (int i = 0; i < metadataCount; i++) + { + dynamic? oldItem = oldMetadata.ElementAt(i); + var newItem = newMetadata.ElementAt(i); + + string username = oldItem.Author; + newItem.Author = new RealmUser + { + Username = username + }; + } + + break; } } @@ -252,6 +284,9 @@ namespace osu.Game.Database }); } + // https://github.com/realm/realm-dotnet/blob/32f4ebcc88b3e80a3b254412665340cd9f3bd6b5/Realm/Realm/Extensions/ReflectionExtensions.cs#L46 + private static string getMappedOrOriginalName(MemberInfo member) => member.GetCustomAttribute()?.Mapping ?? member.Name; + private bool isDisposed; public void Dispose() diff --git a/osu.Game/Database/UserLookupCache.cs b/osu.Game/Database/UserLookupCache.cs index 3626f5e83a..dae2d2549c 100644 --- a/osu.Game/Database/UserLookupCache.cs +++ b/osu.Game/Database/UserLookupCache.cs @@ -9,33 +9,33 @@ using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Game.Online.API; using osu.Game.Online.API.Requests; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Database { - public class UserLookupCache : MemoryCachingComponent + public class UserLookupCache : MemoryCachingComponent { [Resolved] private IAPIProvider api { get; set; } /// - /// Perform an API lookup on the specified user, populating a model. + /// Perform an API lookup on the specified user, populating a model. /// /// The user to lookup. /// An optional cancellation token. /// The populated user, or null if the user does not exist or the request could not be satisfied. [ItemCanBeNull] - public Task GetUserAsync(int userId, CancellationToken token = default) => GetAsync(userId, token); + public Task GetUserAsync(int userId, CancellationToken token = default) => GetAsync(userId, token); /// - /// Perform an API lookup on the specified users, populating a model. + /// Perform an API lookup on the specified users, populating a model. /// /// The users to lookup. /// An optional cancellation token. /// The populated users. May include null results for failed retrievals. - public Task GetUsersAsync(int[] userIds, CancellationToken token = default) + public Task GetUsersAsync(int[] userIds, CancellationToken token = default) { - var userLookupTasks = new List>(); + var userLookupTasks = new List>(); foreach (int u in userIds) { @@ -51,18 +51,18 @@ namespace osu.Game.Database return Task.WhenAll(userLookupTasks); } - protected override async Task ComputeValueAsync(int lookup, CancellationToken token = default) + protected override async Task ComputeValueAsync(int lookup, CancellationToken token = default) => await queryUser(lookup).ConfigureAwait(false); - private readonly Queue<(int id, TaskCompletionSource)> pendingUserTasks = new Queue<(int, TaskCompletionSource)>(); + private readonly Queue<(int id, TaskCompletionSource)> pendingUserTasks = new Queue<(int, TaskCompletionSource)>(); private Task pendingRequestTask; private readonly object taskAssignmentLock = new object(); - private Task queryUser(int userId) + private Task queryUser(int userId) { lock (taskAssignmentLock) { - var tcs = new TaskCompletionSource(); + var tcs = new TaskCompletionSource(); // Add to the queue. pendingUserTasks.Enqueue((userId, tcs)); @@ -78,14 +78,14 @@ namespace osu.Game.Database private void performLookup() { // contains at most 50 unique user IDs from userTasks, which is used to perform the lookup. - var userTasks = new Dictionary>>(); + var userTasks = new Dictionary>>(); // Grab at most 50 unique user IDs from the queue. lock (taskAssignmentLock) { while (pendingUserTasks.Count > 0 && userTasks.Count < 50) { - (int id, TaskCompletionSource task) next = pendingUserTasks.Dequeue(); + (int id, TaskCompletionSource task) next = pendingUserTasks.Dequeue(); // Perform a secondary check for existence, in case the user was queried in a previous batch. if (CheckExists(next.id, out var existing)) @@ -95,7 +95,7 @@ namespace osu.Game.Database if (userTasks.TryGetValue(next.id, out var tasks)) tasks.Add(next.task); else - userTasks[next.id] = new List> { next.task }; + userTasks[next.id] = new List> { next.task }; } } } @@ -115,7 +115,7 @@ namespace osu.Game.Database createNewTask(); } - List foundUsers = request.Response?.Users; + List foundUsers = request.Response?.Users; if (foundUsers != null) { diff --git a/osu.Game/Graphics/Backgrounds/Background.cs b/osu.Game/Graphics/Backgrounds/Background.cs index cfc1eb1806..353054a1f1 100644 --- a/osu.Game/Graphics/Backgrounds/Background.cs +++ b/osu.Game/Graphics/Backgrounds/Background.cs @@ -58,10 +58,9 @@ namespace osu.Game.Graphics.Backgrounds { RemoveInternal(Sprite); - AddInternal(bufferedContainer = new BufferedContainer + AddInternal(bufferedContainer = new BufferedContainer(cachedFrameBuffer: true) { RelativeSizeAxes = Axes.Both, - CacheDrawnFrameBuffer = true, RedrawOnScale = false, Child = Sprite }); diff --git a/osu.Game/Graphics/Containers/LinkFlowContainer.cs b/osu.Game/Graphics/Containers/LinkFlowContainer.cs index 7d1210d0e3..41b7df228e 100644 --- a/osu.Game/Graphics/Containers/LinkFlowContainer.cs +++ b/osu.Game/Graphics/Containers/LinkFlowContainer.cs @@ -70,8 +70,8 @@ namespace osu.Game.Graphics.Containers createLink(new TextPartManual(text), new LinkDetails(action, linkArgument), tooltipText); } - public void AddUserLink(User user, Action creationParameters = null) - => createLink(CreateChunkFor(user.Username, true, CreateSpriteText, creationParameters), new LinkDetails(LinkAction.OpenUserProfile, user.Id.ToString()), "view profile"); + public void AddUserLink(IUser user, Action creationParameters = null) + => createLink(CreateChunkFor(user.Username, true, CreateSpriteText, creationParameters), new LinkDetails(LinkAction.OpenUserProfile, user.OnlineID.ToString()), "view profile"); private void createLink(ITextPart textPart, LinkDetails link, LocalisableString tooltipText, Action action = null) { diff --git a/osu.Game/Graphics/Sprites/GlowingSpriteText.cs b/osu.Game/Graphics/Sprites/GlowingSpriteText.cs index fb273d7293..9c43383a29 100644 --- a/osu.Game/Graphics/Sprites/GlowingSpriteText.cs +++ b/osu.Game/Graphics/Sprites/GlowingSpriteText.cs @@ -69,12 +69,11 @@ namespace osu.Game.Graphics.Sprites Children = new Drawable[] { - new BufferedContainer + new BufferedContainer(cachedFrameBuffer: true) { Anchor = Anchor.Centre, Origin = Anchor.Centre, BlurSigma = new Vector2(4), - CacheDrawnFrameBuffer = true, RedrawOnScale = false, RelativeSizeAxes = Axes.Both, Blending = BlendingParameters.Additive, diff --git a/osu.Game/Graphics/UserInterface/LoadingButton.cs b/osu.Game/Graphics/UserInterface/LoadingButton.cs index 81dc023d7e..a75cf0639c 100644 --- a/osu.Game/Graphics/UserInterface/LoadingButton.cs +++ b/osu.Game/Graphics/UserInterface/LoadingButton.cs @@ -1,7 +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.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osuTK; @@ -22,15 +24,9 @@ namespace osu.Game.Graphics.UserInterface Enabled.Value = !isLoading; if (value) - { loading.Show(); - OnLoadStarted(); - } else - { loading.Hide(); - OnLoadFinished(); - } } } @@ -44,18 +40,34 @@ namespace osu.Game.Graphics.UserInterface protected LoadingButton() { - AddRange(new[] + Add(loading = new LoadingSpinner { - CreateContent(), - loading = new LoadingSpinner - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Size = new Vector2(12) - } + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(12), + Depth = -1, }); } + [BackgroundDependencyLoader] + private void load() + { + Add(CreateContent()); + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + loading.State.BindValueChanged(s => + { + if (s.NewValue == Visibility.Visible) + OnLoadStarted(); + else + OnLoadFinished(); + }, true); + } + protected override bool OnClick(ClickEvent e) { if (!Enabled.Value) diff --git a/osu.Game/Models/RealmBeatmapMetadata.cs b/osu.Game/Models/RealmBeatmapMetadata.cs index 6ea7170d0f..db1b09e6ad 100644 --- a/osu.Game/Models/RealmBeatmapMetadata.cs +++ b/osu.Game/Models/RealmBeatmapMetadata.cs @@ -5,6 +5,7 @@ using System; using Newtonsoft.Json; using osu.Framework.Testing; using osu.Game.Beatmaps; +using osu.Game.Users; using Realms; #nullable enable @@ -26,7 +27,7 @@ namespace osu.Game.Models [JsonProperty("artist_unicode")] public string ArtistUnicode { get; set; } = string.Empty; - public string Author { get; set; } = string.Empty; // eventually should be linked to a persisted User. + public RealmUser Author { get; set; } = new RealmUser(); public string Source { get; set; } = string.Empty; @@ -41,5 +42,7 @@ namespace osu.Game.Models public string AudioFile { get; set; } = string.Empty; public string BackgroundFile { get; set; } = string.Empty; + + IUser IBeatmapMetadataInfo.Author => Author; } } diff --git a/osu.Game/Models/RealmUser.cs b/osu.Game/Models/RealmUser.cs new file mode 100644 index 0000000000..154ece502f --- /dev/null +++ b/osu.Game/Models/RealmUser.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.Game.Users; +using Realms; + +namespace osu.Game.Models +{ + public class RealmUser : EmbeddedObject, IUser + { + public int OnlineID { get; set; } = 1; + + public string Username { get; set; } + + public bool IsBot => false; + } +} diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 94508e3a81..8d91548149 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -17,6 +17,7 @@ using osu.Framework.Graphics; using osu.Framework.Logging; using osu.Game.Configuration; using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Users; namespace osu.Game.Online.API @@ -41,13 +42,13 @@ namespace osu.Game.Online.API private string password; - public IBindable LocalUser => localUser; - public IBindableList Friends => friends; + public IBindable LocalUser => localUser; + public IBindableList Friends => friends; public IBindable Activity => activity; - private Bindable localUser { get; } = new Bindable(createGuestUser()); + private Bindable localUser { get; } = new Bindable(createGuestUser()); - private BindableList friends { get; } = new BindableList(); + private BindableList friends { get; } = new BindableList(); private Bindable activity { get; } = new Bindable(); @@ -436,7 +437,7 @@ namespace osu.Game.Online.API flushQueue(); } - private static User createGuestUser() => new GuestUser(); + private static APIUser createGuestUser() => new GuestUser(); protected override void Dispose(bool isDisposing) { @@ -447,7 +448,7 @@ namespace osu.Game.Online.API } } - internal class GuestUser : User + internal class GuestUser : APIUser { public GuestUser() { diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index 69d72226ba..43195811dc 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -6,7 +6,7 @@ using JetBrains.Annotations; using Newtonsoft.Json; using osu.Framework.IO.Network; using osu.Framework.Logging; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API { @@ -69,7 +69,7 @@ namespace osu.Game.Online.API /// /// The currently logged in user. Note that this will only be populated during . /// - protected User User { get; private set; } + protected APIUser User { get; private set; } /// /// Invoked on successful completion of an API request. diff --git a/osu.Game/Online/API/DummyAPIAccess.cs b/osu.Game/Online/API/DummyAPIAccess.cs index 8f91a4d198..7131c3a7d4 100644 --- a/osu.Game/Online/API/DummyAPIAccess.cs +++ b/osu.Game/Online/API/DummyAPIAccess.cs @@ -6,19 +6,20 @@ using System.Threading; using System.Threading.Tasks; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Users; namespace osu.Game.Online.API { public class DummyAPIAccess : Component, IAPIProvider { - public Bindable LocalUser { get; } = new Bindable(new User + public Bindable LocalUser { get; } = new Bindable(new APIUser { Username = @"Dummy", Id = 1001, }); - public BindableList Friends { get; } = new BindableList(); + public BindableList Friends { get; } = new BindableList(); public Bindable Activity { get; } = new Bindable(); @@ -90,7 +91,7 @@ namespace osu.Game.Online.API } LastLoginError = null; - LocalUser.Value = new User + LocalUser.Value = new APIUser { Username = username, Id = 1001, @@ -115,8 +116,8 @@ namespace osu.Game.Online.API public void SetState(APIState newState) => state.Value = newState; - IBindable IAPIProvider.LocalUser => LocalUser; - IBindableList IAPIProvider.Friends => Friends; + IBindable IAPIProvider.LocalUser => LocalUser; + IBindableList IAPIProvider.Friends => Friends; IBindable IAPIProvider.Activity => Activity; public void FailNextLogin() => shouldFailNextLogin = true; diff --git a/osu.Game/Online/API/IAPIProvider.cs b/osu.Game/Online/API/IAPIProvider.cs index 72ca37bcf4..a97eae77e3 100644 --- a/osu.Game/Online/API/IAPIProvider.cs +++ b/osu.Game/Online/API/IAPIProvider.cs @@ -6,6 +6,7 @@ using System; using System.Threading.Tasks; using osu.Framework.Bindables; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Users; namespace osu.Game.Online.API @@ -16,13 +17,13 @@ namespace osu.Game.Online.API /// The local user. /// This is not thread-safe and should be scheduled locally if consumed from a drawable component. /// - IBindable LocalUser { get; } + IBindable LocalUser { get; } /// /// The user's friends. /// This is not thread-safe and should be scheduled locally if consumed from a drawable component. /// - IBindableList Friends { get; } + IBindableList Friends { get; } /// /// The current user's activity. diff --git a/osu.Game/Online/API/Requests/CreateNewPrivateMessageRequest.cs b/osu.Game/Online/API/Requests/CreateNewPrivateMessageRequest.cs index 37ffc04e04..e5761149e7 100644 --- a/osu.Game/Online/API/Requests/CreateNewPrivateMessageRequest.cs +++ b/osu.Game/Online/API/Requests/CreateNewPrivateMessageRequest.cs @@ -3,17 +3,17 @@ using System.Net.Http; using osu.Framework.IO.Network; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Chat; -using osu.Game.Users; namespace osu.Game.Online.API.Requests { public class CreateNewPrivateMessageRequest : APIRequest { - private readonly User user; + private readonly APIUser user; private readonly Message message; - public CreateNewPrivateMessageRequest(User user, Message message) + public CreateNewPrivateMessageRequest(APIUser user, Message message) { this.user = user; this.message = message; diff --git a/osu.Game/Online/API/Requests/GetFriendsRequest.cs b/osu.Game/Online/API/Requests/GetFriendsRequest.cs index 46890aa889..63a221d91a 100644 --- a/osu.Game/Online/API/Requests/GetFriendsRequest.cs +++ b/osu.Game/Online/API/Requests/GetFriendsRequest.cs @@ -2,11 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests { - public class GetFriendsRequest : APIRequest> + public class GetFriendsRequest : APIRequest> { protected override string Target => @"friends"; } diff --git a/osu.Game/Online/API/Requests/GetUserRequest.cs b/osu.Game/Online/API/Requests/GetUserRequest.cs index 730e4e02ed..e32451fc2f 100644 --- a/osu.Game/Online/API/Requests/GetUserRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserRequest.cs @@ -1,12 +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.Game.Users; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; namespace osu.Game.Online.API.Requests { - public class GetUserRequest : APIRequest + public class GetUserRequest : APIRequest { public readonly string Lookup; public readonly RulesetInfo Ruleset; diff --git a/osu.Game/Online/API/Requests/GetUsersResponse.cs b/osu.Game/Online/API/Requests/GetUsersResponse.cs index 6f49d5cd53..022050de5c 100644 --- a/osu.Game/Online/API/Requests/GetUsersResponse.cs +++ b/osu.Game/Online/API/Requests/GetUsersResponse.cs @@ -3,13 +3,13 @@ using System.Collections.Generic; using Newtonsoft.Json; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.API.Requests { public class GetUsersResponse : ResponseWithCursor { [JsonProperty("users")] - public List Users; + public List Users; } } diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs index 47536879b2..1ff039a6b4 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Beatmaps; using osu.Game.Database; -using osu.Game.Users; #nullable enable @@ -72,34 +71,26 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty("artist_unicode")] public string ArtistUnicode { get; set; } = string.Empty; - public User? Author = new User(); + public APIUser Author = new APIUser(); /// - /// Helper property to deserialize a username to . + /// Helper property to deserialize a username to . /// [JsonProperty(@"user_id")] public int AuthorID { - get => Author?.Id ?? 1; - set - { - Author ??= new User(); - Author.Id = value; - } + get => Author.Id; + set => Author.Id = value; } /// - /// Helper property to deserialize a username to . + /// Helper property to deserialize a username to . /// [JsonProperty(@"creator")] public string AuthorString { - get => Author?.Username ?? string.Empty; - set - { - Author ??= new User(); - Author.Username = value; - } + get => Author.Username; + set => Author.Username = value; } [JsonProperty(@"availability")] diff --git a/osu.Game/Online/API/Requests/Responses/APIPlayStyle.cs b/osu.Game/Online/API/Requests/Responses/APIPlayStyle.cs new file mode 100644 index 0000000000..9573ae1825 --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIPlayStyle.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.ComponentModel; + +namespace osu.Game.Online.API.Requests.Responses +{ + public enum APIPlayStyle + { + [Description("Keyboard")] + Keyboard, + + [Description("Mouse")] + Mouse, + + [Description("Tablet")] + Tablet, + + [Description("Touch Screen")] + Touch, + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APIRankHistory.cs b/osu.Game/Online/API/Requests/Responses/APIRankHistory.cs new file mode 100644 index 0000000000..064badcccb --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIRankHistory.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 Newtonsoft.Json; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIRankHistory + { + [JsonProperty(@"mode")] + public string Mode; + + [JsonProperty(@"data")] + public int[] Data; + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APIScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/APIScoreInfo.cs index 82f56d27fd..d0677eacab 100644 --- a/osu.Game/Online/API/Requests/Responses/APIScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/APIScoreInfo.cs @@ -12,7 +12,6 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Scoring.Legacy; -using osu.Game.Users; namespace osu.Game.Online.API.Requests.Responses { @@ -25,7 +24,7 @@ namespace osu.Game.Online.API.Requests.Responses public int MaxCombo { get; set; } [JsonProperty(@"user")] - public User User { get; set; } + public APIUser User { get; set; } [JsonProperty(@"id")] public long OnlineID { get; set; } diff --git a/osu.Game/Online/API/Requests/Responses/APIUser.cs b/osu.Game/Online/API/Requests/Responses/APIUser.cs index ff422b8292..49edfd036b 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUser.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUser.cs @@ -1,14 +1,245 @@ // 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 Newtonsoft.Json; +using osu.Framework.Bindables; using osu.Game.Users; namespace osu.Game.Online.API.Requests.Responses { - public class APIUser + public class APIUser : IEquatable, IUser { + [JsonProperty(@"id")] + public int Id { get; set; } = 1; + + [JsonProperty(@"join_date")] + public DateTimeOffset JoinDate; + + [JsonProperty(@"username")] + public string Username { get; set; } + + [JsonProperty(@"previous_usernames")] + public string[] PreviousUsernames; + + [JsonProperty(@"country")] + public Country Country; + + public readonly Bindable Status = new Bindable(); + + public readonly Bindable Activity = new Bindable(); + + [JsonProperty(@"profile_colour")] + public string Colour; + + [JsonProperty(@"avatar_url")] + public string AvatarUrl; + + [JsonProperty(@"cover_url")] + public string CoverUrl + { + get => Cover?.Url; + set => Cover = new UserCover { Url = value }; + } + + [JsonProperty(@"cover")] + public UserCover Cover; + + public class UserCover + { + [JsonProperty(@"custom_url")] + public string CustomUrl; + + [JsonProperty(@"url")] + public string Url; + + [JsonProperty(@"id")] + public int? Id; + } + + [JsonProperty(@"is_admin")] + public bool IsAdmin; + + [JsonProperty(@"is_supporter")] + public bool IsSupporter; + + [JsonProperty(@"support_level")] + public int SupportLevel; + + [JsonProperty(@"is_gmt")] + public bool IsGMT; + + [JsonProperty(@"is_qat")] + public bool IsQAT; + + [JsonProperty(@"is_bng")] + public bool IsBNG; + + [JsonProperty(@"is_bot")] + public bool IsBot { get; set; } + + [JsonProperty(@"is_active")] + public bool Active; + + [JsonProperty(@"is_online")] + public bool IsOnline; + + [JsonProperty(@"pm_friends_only")] + public bool PMFriendsOnly; + + [JsonProperty(@"interests")] + public string Interests; + + [JsonProperty(@"occupation")] + public string Occupation; + + [JsonProperty(@"title")] + public string Title; + + [JsonProperty(@"location")] + public string Location; + + [JsonProperty(@"last_visit")] + public DateTimeOffset? LastVisit; + + [JsonProperty(@"twitter")] + public string Twitter; + + [JsonProperty(@"discord")] + public string Discord; + + [JsonProperty(@"website")] + public string Website; + + [JsonProperty(@"post_count")] + public int PostCount; + + [JsonProperty(@"comments_count")] + public int CommentsCount; + + [JsonProperty(@"follower_count")] + public int FollowerCount; + + [JsonProperty(@"mapping_follower_count")] + public int MappingFollowerCount; + + [JsonProperty(@"favourite_beatmapset_count")] + public int FavouriteBeatmapsetCount; + + [JsonProperty(@"graveyard_beatmapset_count")] + public int GraveyardBeatmapsetCount; + + [JsonProperty(@"loved_beatmapset_count")] + public int LovedBeatmapsetCount; + + [JsonProperty(@"ranked_beatmapset_count")] + public int RankedBeatmapsetCount; + + [JsonProperty(@"pending_beatmapset_count")] + public int PendingBeatmapsetCount; + + [JsonProperty(@"scores_best_count")] + public int ScoresBestCount; + + [JsonProperty(@"scores_first_count")] + public int ScoresFirstCount; + + [JsonProperty(@"scores_recent_count")] + public int ScoresRecentCount; + + [JsonProperty(@"beatmap_playcounts_count")] + public int BeatmapPlaycountsCount; + [JsonProperty] - public User User; + private string[] playstyle + { + set => PlayStyles = value?.Select(str => Enum.Parse(typeof(APIPlayStyle), str, true)).Cast().ToArray(); + } + + public APIPlayStyle[] PlayStyles; + + [JsonProperty(@"playmode")] + public string PlayMode; + + [JsonProperty(@"profile_order")] + public string[] ProfileOrder; + + [JsonProperty(@"kudosu")] + public KudosuCount Kudosu; + + public class KudosuCount + { + [JsonProperty(@"total")] + public int Total; + + [JsonProperty(@"available")] + public int Available; + } + + private UserStatistics statistics; + + /// + /// User statistics for the requested ruleset (in the case of a or response). + /// Otherwise empty. + /// + [JsonProperty(@"statistics")] + public UserStatistics Statistics + { + get => statistics ??= new UserStatistics(); + set + { + if (statistics != null) + // we may already have rank history populated + value.RankHistory = statistics.RankHistory; + + statistics = value; + } + } + + [JsonProperty(@"rank_history")] + private APIRankHistory rankHistory + { + set => statistics.RankHistory = value; + } + + [JsonProperty("badges")] + public Badge[] Badges; + + [JsonProperty("user_achievements")] + public APIUserAchievement[] Achievements; + + [JsonProperty("monthly_playcounts")] + public APIUserHistoryCount[] MonthlyPlaycounts; + + [JsonProperty("replays_watched_counts")] + public APIUserHistoryCount[] ReplaysWatchedCounts; + + /// + /// All user statistics per ruleset's short name (in the case of a response). + /// Otherwise empty. Can be altered for testing purposes. + /// + // todo: this should likely be moved to a separate UserCompact class at some point. + [JsonProperty("statistics_rulesets")] + [CanBeNull] + public Dictionary RulesetsStatistics { get; set; } + + public override string ToString() => Username; + + /// + /// A user instance for displaying locally created system messages. + /// + public static readonly APIUser SYSTEM_USER = new APIUser + { + Id = 0, + Username = "system", + Colour = @"9c0101", + }; + + public int OnlineID => Id; + + public bool Equals(APIUser other) => OnlineID == other?.OnlineID; } } diff --git a/osu.Game/Online/API/Requests/Responses/APIUserAchievement.cs b/osu.Game/Online/API/Requests/Responses/APIUserAchievement.cs new file mode 100644 index 0000000000..cfba9118c2 --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIUserAchievement.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; +using Newtonsoft.Json; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIUserAchievement + { + [JsonProperty("achievement_id")] + public int ID; + + [JsonProperty("achieved_at")] + public DateTimeOffset AchievedAt; + } +} diff --git a/osu.Game/Users/Team.cs b/osu.Game/Online/API/Requests/Responses/APIUserContainer.cs similarity index 51% rename from osu.Game/Users/Team.cs rename to osu.Game/Online/API/Requests/Responses/APIUserContainer.cs index b56a083fdf..9eb4a2a4e3 100644 --- a/osu.Game/Users/Team.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUserContainer.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. -namespace osu.Game.Users +using Newtonsoft.Json; + +namespace osu.Game.Online.API.Requests.Responses { - public class Team + public class APIUserContainer { - public string Name; + [JsonProperty] + public APIUser User; } } diff --git a/osu.Game/Online/API/Requests/Responses/APIUserHistoryCount.cs b/osu.Game/Online/API/Requests/Responses/APIUserHistoryCount.cs new file mode 100644 index 0000000000..1226c88c08 --- /dev/null +++ b/osu.Game/Online/API/Requests/Responses/APIUserHistoryCount.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; +using Newtonsoft.Json; + +namespace osu.Game.Online.API.Requests.Responses +{ + public class APIUserHistoryCount + { + [JsonProperty("start_date")] + public DateTime Date; + + [JsonProperty("count")] + public long Count; + } +} diff --git a/osu.Game/Online/API/Requests/Responses/APIUserScoreAggregate.cs b/osu.Game/Online/API/Requests/Responses/APIUserScoreAggregate.cs index 172fa3a583..9a7f0832a6 100644 --- a/osu.Game/Online/API/Requests/Responses/APIUserScoreAggregate.cs +++ b/osu.Game/Online/API/Requests/Responses/APIUserScoreAggregate.cs @@ -3,7 +3,6 @@ using Newtonsoft.Json; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Online.API.Requests.Responses { @@ -31,7 +30,7 @@ namespace osu.Game.Online.API.Requests.Responses public long UserID { get; set; } [JsonProperty("user")] - public User User { get; set; } + public APIUser User { get; set; } [JsonProperty("position")] public int? Position { get; set; } diff --git a/osu.Game/Online/API/Requests/Responses/Comment.cs b/osu.Game/Online/API/Requests/Responses/Comment.cs index 32d489432d..13379a40a6 100644 --- a/osu.Game/Online/API/Requests/Responses/Comment.cs +++ b/osu.Game/Online/API/Requests/Responses/Comment.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using Newtonsoft.Json; -using osu.Game.Users; using System; namespace osu.Game.Online.API.Requests.Responses @@ -20,7 +19,7 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"user_id")] public long? UserId { get; set; } - public User User { get; set; } + public APIUser User { get; set; } [JsonProperty(@"message")] public string Message { get; set; } @@ -61,7 +60,7 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"pinned")] public bool Pinned { get; set; } - public User EditedUser { get; set; } + public APIUser EditedUser { get; set; } public bool IsTopLevel => !ParentId.HasValue; diff --git a/osu.Game/Online/API/Requests/Responses/CommentBundle.cs b/osu.Game/Online/API/Requests/Responses/CommentBundle.cs index 4070df493d..8436381090 100644 --- a/osu.Game/Online/API/Requests/Responses/CommentBundle.cs +++ b/osu.Game/Online/API/Requests/Responses/CommentBundle.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using Newtonsoft.Json; -using osu.Game.Users; using System.Collections.Generic; using System.Linq; @@ -43,10 +42,10 @@ namespace osu.Game.Online.API.Requests.Responses } } - private List users; + private List users; [JsonProperty(@"users")] - public List Users + public List Users { get => users; set diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index 9b463a6348..9cbb2f37e4 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -8,7 +8,7 @@ using System.Linq; using Newtonsoft.Json; using osu.Framework.Bindables; using osu.Framework.Lists; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.Chat { @@ -19,7 +19,7 @@ namespace osu.Game.Online.Chat /// /// Contains every joined user except the current logged in user. Currently only returned for PM channels. /// - public readonly ObservableCollection Users = new ObservableCollection(); + public readonly ObservableCollection Users = new ObservableCollection(); [JsonProperty(@"users")] private int[] userIds @@ -27,7 +27,7 @@ namespace osu.Game.Online.Chat set { foreach (int id in value) - Users.Add(new User { Id = id }); + Users.Add(new APIUser { Id = id }); } } @@ -98,7 +98,7 @@ namespace osu.Game.Online.Chat /// Create a private messaging channel with the specified user. /// /// The user to create the private conversation with. - public Channel(User user) + public Channel(APIUser user) { Type = ChannelType.PM; Users.Add(user); diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 52c9387185..edaf135e93 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -11,8 +11,8 @@ using osu.Framework.Logging; using osu.Game.Database; using osu.Game.Online.API; using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Chat.Tabs; -using osu.Game.Users; namespace osu.Game.Online.Chat { @@ -91,7 +91,7 @@ namespace osu.Game.Online.Chat /// Opens a new private channel. /// /// The user the private channel is opened with. - public void OpenPrivateChannel(User user) + public void OpenPrivateChannel(APIUser user) { if (user == null) throw new ArgumentNullException(nameof(user)); diff --git a/osu.Game/Online/Chat/InfoMessage.cs b/osu.Game/Online/Chat/InfoMessage.cs index cea336aae2..e97245df45 100644 --- a/osu.Game/Online/Chat/InfoMessage.cs +++ b/osu.Game/Online/Chat/InfoMessage.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.Chat { @@ -14,7 +14,7 @@ namespace osu.Game.Online.Chat Timestamp = DateTimeOffset.Now; Content = message; - Sender = User.SYSTEM_USER; + Sender = APIUser.SYSTEM_USER; } } } diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 4f33153e56..dcd15f9028 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using Newtonsoft.Json; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Online.Chat { @@ -26,7 +26,7 @@ namespace osu.Game.Online.Chat public string Content; [JsonProperty(@"sender")] - public User Sender; + public APIUser Sender; [JsonConstructor] public Message() diff --git a/osu.Game/Online/Chat/MessageNotifier.cs b/osu.Game/Online/Chat/MessageNotifier.cs index 6840c036ff..ca6317566f 100644 --- a/osu.Game/Online/Chat/MessageNotifier.cs +++ b/osu.Game/Online/Chat/MessageNotifier.cs @@ -12,9 +12,9 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; -using osu.Game.Users; namespace osu.Game.Online.Chat { @@ -35,7 +35,7 @@ namespace osu.Game.Online.Chat private Bindable notifyOnUsername; private Bindable notifyOnPrivateMessage; - private readonly IBindable localUser = new Bindable(); + private readonly IBindable localUser = new Bindable(); private readonly IBindableList joinedChannels = new BindableList(); [BackgroundDependencyLoader] diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs index 6c4747ea54..567e59e8a0 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs @@ -22,8 +22,8 @@ using osu.Game.Online.Rooms; using osu.Game.Online.Rooms.RoomStatuses; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; -using osu.Game.Users; using osu.Game.Utils; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Online.Multiplayer { @@ -402,7 +402,7 @@ namespace osu.Game.Online.Multiplayer { Debug.Assert(APIRoom != null); - APIRoom.RecentParticipants.Add(user.User ?? new User + APIRoom.RecentParticipants.Add(user.User ?? new APIUser { Id = user.UserID, Username = "[Unresolved]" @@ -614,7 +614,7 @@ namespace osu.Game.Online.Multiplayer } /// - /// Populates the for a given . + /// Populates the for a given . /// /// The to populate. protected async Task PopulateUser(MultiplayerRoomUser multiplayerUser) => multiplayerUser.User ??= await userLookupCache.GetUserAsync(multiplayerUser.UserID).ConfigureAwait(false); diff --git a/osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs b/osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs index 5d11e2921a..519bfff116 100644 --- a/osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs +++ b/osu.Game/Online/Multiplayer/MultiplayerRoomUser.cs @@ -9,8 +9,8 @@ using System.Linq; using MessagePack; using Newtonsoft.Json; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; -using osu.Game.Users; namespace osu.Game.Online.Multiplayer { @@ -40,7 +40,7 @@ namespace osu.Game.Online.Multiplayer public IEnumerable Mods { get; set; } = Enumerable.Empty(); [IgnoreMember] - public User? User { get; set; } + public APIUser? User { get; set; } [JsonConstructor] public MultiplayerRoomUser(int userId) diff --git a/osu.Game/Online/Rooms/MultiplayerScore.cs b/osu.Game/Online/Rooms/MultiplayerScore.cs index 375e0b6b9f..cfb81f0bad 100644 --- a/osu.Game/Online/Rooms/MultiplayerScore.cs +++ b/osu.Game/Online/Rooms/MultiplayerScore.cs @@ -9,10 +9,10 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; using osu.Game.Beatmaps; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Online.Rooms { @@ -22,7 +22,7 @@ namespace osu.Game.Online.Rooms public long ID { get; set; } [JsonProperty("user")] - public User User { get; set; } + public APIUser User { get; set; } [JsonProperty("rank")] [JsonConverter(typeof(StringEnumConverter))] diff --git a/osu.Game/Online/Rooms/Room.cs b/osu.Game/Online/Rooms/Room.cs index 39fc7f1da8..48c5412aa3 100644 --- a/osu.Game/Online/Rooms/Room.cs +++ b/osu.Game/Online/Rooms/Room.cs @@ -7,8 +7,8 @@ using Newtonsoft.Json; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Game.IO.Serialization.Converters; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms.RoomStatuses; -using osu.Game.Users; using osu.Game.Utils; namespace osu.Game.Online.Rooms @@ -25,7 +25,7 @@ namespace osu.Game.Online.Rooms [Cached] [JsonProperty("host")] - public readonly Bindable Host = new Bindable(); + public readonly Bindable Host = new Bindable(); [Cached] [JsonProperty("playlist")] @@ -86,7 +86,7 @@ namespace osu.Game.Online.Rooms [Cached] [JsonProperty("recent_participants")] - public readonly BindableList RecentParticipants = new BindableList(); + public readonly BindableList RecentParticipants = new BindableList(); [Cached] [JsonProperty("participant_count")] diff --git a/osu.Game/Online/Solo/SubmittableScore.cs b/osu.Game/Online/Solo/SubmittableScore.cs index bafb308a13..373c302844 100644 --- a/osu.Game/Online/Solo/SubmittableScore.cs +++ b/osu.Game/Online/Solo/SubmittableScore.cs @@ -10,7 +10,7 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; -using osu.Game.Users; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Online.Solo { @@ -48,7 +48,7 @@ namespace osu.Game.Online.Solo public APIMod[] Mods { get; set; } [JsonProperty("user")] - public User User { get; set; } + public APIUser User { get; set; } [JsonProperty("statistics")] public Dictionary Statistics { get; set; } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index a7ed7fedf5..ea8682e696 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -53,8 +53,10 @@ using osu.Game.Database; using osu.Game.Extensions; using osu.Game.IO; using osu.Game.Localisation; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Performance; using osu.Game.Skinning.Editor; +using osu.Game.Users; namespace osu.Game { @@ -323,10 +325,9 @@ namespace osu.Game break; case LinkAction.OpenUserProfile: - if (int.TryParse(link.Argument, out int userId)) - ShowUser(userId); - else - ShowUser(link.Argument); + ShowUser(int.TryParse(link.Argument, out int userId) + ? new APIUser { Id = userId } + : new APIUser { Username = link.Argument }); break; @@ -383,14 +384,8 @@ namespace osu.Game /// /// Show a user's profile as an overlay. /// - /// The user to display. - public void ShowUser(int userId) => waitForReady(() => userProfile, _ => userProfile.ShowUser(userId)); - - /// - /// Show a user's profile as an overlay. - /// - /// The user to display. - public void ShowUser(string username) => waitForReady(() => userProfile, _ => userProfile.ShowUser(username)); + /// The user to display. + public void ShowUser(IUser user) => waitForReady(() => userProfile, _ => userProfile.ShowUser(user)); /// /// Show a beatmap's set as an overlay, displaying the given beatmap. diff --git a/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs index e0632ace58..461a06a634 100644 --- a/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs +++ b/osu.Game/Overlays/BeatmapListing/BeatmapSearchMultipleSelectionFilterRow.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -22,6 +23,11 @@ namespace osu.Game.Overlays.BeatmapListing public BeatmapSearchMultipleSelectionFilterRow(LocalisableString header) : base(header) + { + } + + [BackgroundDependencyLoader] + private void load() { Current.BindTo(filter.Current); } @@ -31,6 +37,7 @@ namespace osu.Game.Overlays.BeatmapListing /// /// Creates a filter control that can be used to simultaneously select multiple values of type . /// + [NotNull] protected virtual MultipleSelectionFilter CreateMultipleSelectionFilter() => new MultipleSelectionFilter(); protected class MultipleSelectionFilter : FillFlowContainer diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs index c90e2e2085..9131f6f74c 100644 --- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs +++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs @@ -13,9 +13,9 @@ using osuTK.Graphics; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; -using osu.Game.Users; using osu.Game.Graphics.Containers; using osu.Game.Online.API.Requests.Responses; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.BeatmapSet { @@ -144,7 +144,7 @@ namespace osu.Game.Overlays.BeatmapSet }; } - public Field(string first, User second, FontUsage secondFont) + public Field(string first, APIUser second, FontUsage secondFont) { AutoSizeAxes = Axes.Both; Direction = FillDirection.Horizontal; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs index d4873f241c..8fe7450873 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs @@ -14,8 +14,8 @@ using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Notifications; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; using osuTK; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.BeatmapSet.Buttons { @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons private PostBeatmapFavouriteRequest request; private LoadingLayer loading; - private readonly IBindable localUser = new Bindable(); + private readonly IBindable localUser = new Bindable(); public LocalisableString TooltipText { diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/HeaderDownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/HeaderDownloadButton.cs index bd7723d3c0..ee40f114d2 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/HeaderDownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/HeaderDownloadButton.cs @@ -17,9 +17,9 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.BeatmapListing.Panels; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; using osuTK; using osuTK.Graphics; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; using CommonStrings = osu.Game.Localisation.CommonStrings; namespace osu.Game.Overlays.BeatmapSet.Buttons @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons public LocalisableString TooltipText => BeatmapsetsStrings.ShowDetailsDownloadDefault; - private readonly IBindable localUser = new Bindable(); + private readonly IBindable localUser = new Bindable(); private ShakeContainer shakeContainer; private HeaderButton button; @@ -165,7 +165,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons }, true); } - private void userChanged(ValueChangedEvent e) => button.Enabled.Value = !(e.NewValue is GuestUser); + private void userChanged(ValueChangedEvent e) => button.Enabled.Value = !(e.NewValue is GuestUser); private void enabledChanged(ValueChangedEvent e) => this.FadeColour(e.NewValue ? Color4.White : Color4.Gray, 200, Easing.OutQuint); diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 69739b3352..15e700fc91 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -18,8 +18,8 @@ using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Scoring; using osu.Game.Screens.Select.Leaderboards; -using osu.Game.Users; using osuTK; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.BeatmapSet.Scores { @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores public readonly Bindable Beatmap = new Bindable(); private readonly Bindable ruleset = new Bindable(); private readonly Bindable scope = new Bindable(BeatmapLeaderboardScope.Global); - private readonly IBindable user = new Bindable(); + private readonly IBindable user = new Bindable(); private readonly Box background; private readonly ScoreTable scoreTable; @@ -227,7 +227,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores scope.Value = BeatmapLeaderboardScope.Global; } - private void onUserChanged(ValueChangedEvent user) + private void onUserChanged(ValueChangedEvent user) { if (modSelector.SelectedMods.Any()) modSelector.DeselectAll(); diff --git a/osu.Game/Overlays/Changelog/ChangelogEntry.cs b/osu.Game/Overlays/Changelog/ChangelogEntry.cs index 55edb40283..da062ca617 100644 --- a/osu.Game/Overlays/Changelog/ChangelogEntry.cs +++ b/osu.Game/Overlays/Changelog/ChangelogEntry.cs @@ -12,9 +12,9 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Online.API.Requests.Responses; -using osu.Game.Users; using osuTK; using osuTK.Graphics; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.Changelog { @@ -131,7 +131,7 @@ namespace osu.Game.Overlays.Changelog if (entry.GithubUser.UserId != null) { - title.AddUserLink(new User + title.AddUserLink(new APIUser { Username = entry.GithubUser.OsuUsername, Id = entry.GithubUser.UserId.Value diff --git a/osu.Game/Overlays/Changelog/ChangelogHeader.cs b/osu.Game/Overlays/Changelog/ChangelogHeader.cs index 52dea63ab7..49a33ee5d6 100644 --- a/osu.Game/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game/Overlays/Changelog/ChangelogHeader.cs @@ -26,6 +26,8 @@ namespace osu.Game.Overlays.Changelog public static LocalisableString ListingString => LayoutStrings.HeaderChangelogIndex; + private readonly Bindable currentStream = new Bindable(); + private Box streamsBackground; public ChangelogHeader() @@ -39,7 +41,7 @@ namespace osu.Game.Overlays.Changelog Build.ValueChanged += showBuild; - Streams.Current.ValueChanged += e => + currentStream.ValueChanged += e => { if (e.NewValue?.LatestBuild != null && !e.NewValue.Equals(Build.Value?.UpdateStream)) Build.Value = e.NewValue.LatestBuild; @@ -67,7 +69,7 @@ namespace osu.Game.Overlays.Changelog else { Current.Value = ListingString; - Streams.Current.Value = null; + currentStream.Value = null; } } @@ -92,7 +94,7 @@ namespace osu.Game.Overlays.Changelog Horizontal = 65, Vertical = 20 }, - Child = Streams = new ChangelogUpdateStreamControl() + Child = Streams = new ChangelogUpdateStreamControl { Current = currentStream }, } } }; @@ -110,7 +112,7 @@ namespace osu.Game.Overlays.Changelog if (Build.Value == null) return; - Streams.Current.Value = Streams.Items.FirstOrDefault(s => s.Name == Build.Value.UpdateStream.Name); + currentStream.Value = Streams.Items.FirstOrDefault(s => s.Name == Build.Value.UpdateStream.Name); } private class ChangelogHeaderTitle : OverlayTitle diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 6f4f568eb2..97cd913b56 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -17,8 +17,8 @@ using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Chat; -using osu.Game.Users; using osuTK; using osuTK.Graphics; @@ -217,14 +217,14 @@ namespace osu.Game.Overlays.Chat private class MessageSender : OsuClickableContainer, IHasContextMenu { - private readonly User sender; + private readonly APIUser sender; private Action startChatAction; [Resolved] private IAPIProvider api { get; set; } - public MessageSender(User sender) + public MessageSender(APIUser sender) { this.sender = sender; } @@ -240,7 +240,7 @@ namespace osu.Game.Overlays.Chat { get { - if (sender.Equals(User.SYSTEM_USER)) + if (sender.Equals(APIUser.SYSTEM_USER)) return Array.Empty(); List items = new List diff --git a/osu.Game/Overlays/Comments/CommentEditor.cs b/osu.Game/Overlays/Comments/CommentEditor.cs index 20a8ab64f7..3ff4cfad4a 100644 --- a/osu.Game/Overlays/Comments/CommentEditor.cs +++ b/osu.Game/Overlays/Comments/CommentEditor.cs @@ -175,6 +175,8 @@ namespace osu.Game.Overlays.Comments protected override IEnumerable EffectTargets => new[] { background }; + private readonly string text; + [Resolved] private OverlayColourProvider colourProvider { get; set; } @@ -184,10 +186,10 @@ namespace osu.Game.Overlays.Comments public CommitButton(string text) { + this.text = text; + AutoSizeAxes = Axes.Both; LoadingAnimationSize = new Vector2(10); - - drawableText.Text = text; } [BackgroundDependencyLoader] @@ -232,7 +234,8 @@ namespace osu.Game.Overlays.Comments Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), - Margin = new MarginPadding { Horizontal = 20 } + Margin = new MarginPadding { Horizontal = 20 }, + Text = text, } } }; diff --git a/osu.Game/Overlays/Comments/CommentsContainer.cs b/osu.Game/Overlays/Comments/CommentsContainer.cs index 6b3d816e84..970fc5ccef 100644 --- a/osu.Game/Overlays/Comments/CommentsContainer.cs +++ b/osu.Game/Overlays/Comments/CommentsContainer.cs @@ -13,10 +13,10 @@ using System.Threading; using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Threading; -using osu.Game.Users; using System.Collections.Generic; using JetBrains.Annotations; using osu.Game.Graphics.Sprites; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.Comments { @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Comments public readonly Bindable Sort = new Bindable(); public readonly BindableBool ShowDeleted = new BindableBool(); - protected readonly IBindable User = new Bindable(); + protected readonly IBindable User = new Bindable(); [Resolved] private IAPIProvider api { get; set; } diff --git a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs index 454dd500fe..269ed81bb5 100644 --- a/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs +++ b/osu.Game/Overlays/Dashboard/CurrentlyPlayingDisplay.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Screens; 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.OnlinePlay.Match.Components; using osu.Game.Screens.Play; @@ -91,7 +92,7 @@ namespace osu.Game.Overlays.Dashboard } }); - private PlayingUserPanel createUserPanel(User user) => + private PlayingUserPanel createUserPanel(APIUser user) => new PlayingUserPanel(user).With(panel => { panel.Anchor = Anchor.TopCentre; @@ -100,12 +101,12 @@ namespace osu.Game.Overlays.Dashboard private class PlayingUserPanel : CompositeDrawable { - public readonly User User; + public readonly APIUser User; [Resolved(canBeNull: true)] private OsuGame game { get; set; } - public PlayingUserPanel(User user) + public PlayingUserPanel(APIUser user) { User = user; diff --git a/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs b/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs index 0922ce5ecc..765f037d70 100644 --- a/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs +++ b/osu.Game/Overlays/Dashboard/Friends/FriendDisplay.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Users; using osuTK; @@ -18,9 +19,9 @@ namespace osu.Game.Overlays.Dashboard.Friends { public class FriendDisplay : CompositeDrawable { - private List users = new List(); + private List users = new List(); - public List Users + public List Users { get => users; set @@ -41,7 +42,7 @@ namespace osu.Game.Overlays.Dashboard.Friends private Container itemsPlaceholder; private LoadingLayer loading; - private readonly IBindableList apiFriends = new BindableList(); + private readonly IBindableList apiFriends = new BindableList(); public FriendDisplay() { @@ -169,7 +170,7 @@ namespace osu.Game.Overlays.Dashboard.Friends LoadComponentAsync(createTable(sortedUsers), addContentToPlaceholder, (cancellationToken = new CancellationTokenSource()).Token); } - private List getUsersInCurrentGroup() + private List getUsersInCurrentGroup() { switch (onlineStreamControl.Current.Value?.Status) { @@ -201,7 +202,7 @@ namespace osu.Game.Overlays.Dashboard.Friends currentContent.FadeIn(200, Easing.OutQuint); } - private FillFlowContainer createTable(List users) + private FillFlowContainer createTable(List users) { var style = userListToolbar.DisplayStyle.Value; @@ -214,7 +215,7 @@ namespace osu.Game.Overlays.Dashboard.Friends }; } - private UserPanel createUserPanel(User user, OverlayPanelDisplayStyle style) + private UserPanel createUserPanel(APIUser user, OverlayPanelDisplayStyle style) { switch (style) { @@ -235,7 +236,7 @@ namespace osu.Game.Overlays.Dashboard.Friends } } - private List sortUsers(List unsorted) + private List sortUsers(List unsorted) { switch (userListToolbar.SortCriteria.Value) { diff --git a/osu.Game/Overlays/Dashboard/Friends/FriendOnlineStreamControl.cs b/osu.Game/Overlays/Dashboard/Friends/FriendOnlineStreamControl.cs index d7f66e35b5..7275cdff7c 100644 --- a/osu.Game/Overlays/Dashboard/Friends/FriendOnlineStreamControl.cs +++ b/osu.Game/Overlays/Dashboard/Friends/FriendOnlineStreamControl.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Dashboard.Friends { @@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Dashboard.Friends { protected override OverlayStreamItem CreateStreamItem(FriendStream value) => new FriendsOnlineStatusItem(value); - public void Populate(List users) + public void Populate(List users) { Clear(); diff --git a/osu.Game/Overlays/NowPlayingOverlay.cs b/osu.Game/Overlays/NowPlayingOverlay.cs index 5619d7b38a..f37e6bedf7 100644 --- a/osu.Game/Overlays/NowPlayingOverlay.cs +++ b/osu.Game/Overlays/NowPlayingOverlay.cs @@ -366,14 +366,13 @@ namespace osu.Game.Overlays private readonly WorkingBeatmap beatmap; public Background(WorkingBeatmap beatmap = null) + : base(cachedFrameBuffer: true) { this.beatmap = beatmap; Depth = float.MaxValue; RelativeSizeAxes = Axes.Both; - CacheDrawnFrameBuffer = true; - Children = new Drawable[] { sprite = new Sprite diff --git a/osu.Game/Overlays/OverlayScrollContainer.cs b/osu.Game/Overlays/OverlayScrollContainer.cs index ca5fc90027..7fe188eb04 100644 --- a/osu.Game/Overlays/OverlayScrollContainer.cs +++ b/osu.Game/Overlays/OverlayScrollContainer.cs @@ -37,11 +37,7 @@ namespace osu.Game.Overlays Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Margin = new MarginPadding(20), - Action = () => - { - ScrollToStart(); - Button.State = Visibility.Hidden; - } + Action = scrollToTop }); } @@ -58,6 +54,12 @@ namespace osu.Game.Overlays Button.State = Target > button_scroll_position ? Visibility.Visible : Visibility.Hidden; } + private void scrollToTop() + { + ScrollToStart(); + Button.State = Visibility.Hidden; + } + public class ScrollToTopButton : OsuHoverContainer { private const int fade_duration = 500; diff --git a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs index fe61e532e1..ea52cec2e1 100644 --- a/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BottomHeaderContainer.cs @@ -14,7 +14,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Online.API; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; using osuTK; using osuTK.Graphics; @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Profile.Header { public class BottomHeaderContainer : CompositeDrawable { - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); private LinkFlowContainer topLinkContainer; private LinkFlowContainer bottomLinkContainer; @@ -75,7 +75,7 @@ namespace osu.Game.Overlays.Profile.Header User.BindValueChanged(user => updateDisplay(user.NewValue)); } - private void updateDisplay(User user) + private void updateDisplay(APIUser user) { topLinkContainer.Clear(); bottomLinkContainer.Clear(); diff --git a/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs index 180a288729..a13f5ed6ce 100644 --- a/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/CentreHeaderContainer.cs @@ -9,9 +9,9 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; using osuTK; namespace osu.Game.Overlays.Profile.Header @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Header public class CentreHeaderContainer : CompositeDrawable { public readonly BindableBool DetailsVisible = new BindableBool(true); - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); private OverlinedInfoContainer hiddenDetailGlobal; private OverlinedInfoContainer hiddenDetailCountry; @@ -145,7 +145,7 @@ namespace osu.Game.Overlays.Profile.Header User.BindValueChanged(user => updateDisplay(user.NewValue)); } - private void updateDisplay(User user) + private void updateDisplay(APIUser user) { hiddenDetailGlobal.Content = user?.Statistics?.GlobalRank?.ToLocalisableString("\\##,##0") ?? (LocalisableString)"-"; hiddenDetailCountry.Content = user?.Statistics?.CountryRank?.ToLocalisableString("\\##,##0") ?? (LocalisableString)"-"; diff --git a/osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs b/osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs index 8f66120055..1b21bfc982 100644 --- a/osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/FollowersButton.cs @@ -5,14 +5,14 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; namespace osu.Game.Overlays.Profile.Header.Components { public class FollowersButton : ProfileHeaderStatisticsButton { - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); public override LocalisableString TooltipText => FriendsStrings.ButtonsDisabled; diff --git a/osu.Game/Overlays/Profile/Header/Components/LevelBadge.cs b/osu.Game/Overlays/Profile/Header/Components/LevelBadge.cs index 1deed1a748..e1302788da 100644 --- a/osu.Game/Overlays/Profile/Header/Components/LevelBadge.cs +++ b/osu.Game/Overlays/Profile/Header/Components/LevelBadge.cs @@ -11,14 +11,14 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; namespace osu.Game.Overlays.Profile.Header.Components { public class LevelBadge : CompositeDrawable, IHasTooltip { - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); public LocalisableString TooltipText { get; private set; } @@ -51,7 +51,7 @@ namespace osu.Game.Overlays.Profile.Header.Components User.BindValueChanged(user => updateLevel(user.NewValue)); } - private void updateLevel(User user) + private void updateLevel(APIUser user) { levelText.Text = user?.Statistics?.Level.Current.ToString() ?? "0"; TooltipText = UsersStrings.ShowStatsLevel(user?.Statistics?.Level.Current.ToString()); diff --git a/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs b/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs index 2c8c421eba..8f6b935128 100644 --- a/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs +++ b/osu.Game/Overlays/Profile/Header/Components/LevelProgressBar.cs @@ -11,15 +11,15 @@ using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; using osuTK.Graphics; namespace osu.Game.Overlays.Profile.Header.Components { public class LevelProgressBar : CompositeDrawable, IHasTooltip { - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); public LocalisableString TooltipText { get; } @@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Profile.Header.Components User.BindValueChanged(user => updateProgress(user.NewValue)); } - private void updateProgress(User user) + private void updateProgress(APIUser user) { levelProgressBar.Length = user?.Statistics?.Level.Progress / 100f ?? 0; levelProgressText.Text = user?.Statistics?.Level.Progress.ToLocalisableString("0'%'"); diff --git a/osu.Game/Overlays/Profile/Header/Components/MappingSubscribersButton.cs b/osu.Game/Overlays/Profile/Header/Components/MappingSubscribersButton.cs index 5cdf3a5ef9..6d1024ff18 100644 --- a/osu.Game/Overlays/Profile/Header/Components/MappingSubscribersButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/MappingSubscribersButton.cs @@ -5,14 +5,14 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; namespace osu.Game.Overlays.Profile.Header.Components { public class MappingSubscribersButton : ProfileHeaderStatisticsButton { - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); public override LocalisableString TooltipText => FollowsStrings.MappingFollowers; diff --git a/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs b/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs index 07f1f1c3ed..e3dc5f818a 100644 --- a/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs +++ b/osu.Game/Overlays/Profile/Header/Components/MessageUserButton.cs @@ -7,16 +7,16 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Localisation; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Chat; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; using osuTK; namespace osu.Game.Overlays.Profile.Header.Components { public class MessageUserButton : ProfileHeaderButton { - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); public override LocalisableString TooltipText => UsersStrings.CardSendMessage; diff --git a/osu.Game/Overlays/Profile/Header/Components/OverlinedTotalPlayTime.cs b/osu.Game/Overlays/Profile/Header/Components/OverlinedTotalPlayTime.cs index 1a40944632..1ead2cd2f5 100644 --- a/osu.Game/Overlays/Profile/Header/Components/OverlinedTotalPlayTime.cs +++ b/osu.Game/Overlays/Profile/Header/Components/OverlinedTotalPlayTime.cs @@ -7,14 +7,14 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Localisation; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; namespace osu.Game.Overlays.Profile.Header.Components { public class OverlinedTotalPlayTime : CompositeDrawable, IHasTooltip { - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); public LocalisableString TooltipText { get; set; } @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Profile.Header.Components User.BindValueChanged(updateTime, true); } - private void updateTime(ValueChangedEvent user) + private void updateTime(ValueChangedEvent user) { TooltipText = (user.NewValue?.Statistics?.PlayTime ?? 0) / 3600 + " hours"; info.Content = formatTime(user.NewValue?.Statistics?.PlayTime); diff --git a/osu.Game/Overlays/Profile/Header/Components/PreviousUsernames.cs b/osu.Game/Overlays/Profile/Header/Components/PreviousUsernames.cs index b1076ba39b..229bbaef83 100644 --- a/osu.Game/Overlays/Profile/Header/Components/PreviousUsernames.cs +++ b/osu.Game/Overlays/Profile/Header/Components/PreviousUsernames.cs @@ -12,8 +12,8 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; using osuTK; namespace osu.Game.Overlays.Profile.Header.Components @@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Profile.Header.Components private const int width = 310; private const int move_offset = 15; - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); private readonly TextFlowContainer text; private readonly Box background; @@ -107,7 +107,7 @@ namespace osu.Game.Overlays.Profile.Header.Components User.BindValueChanged(onUserChanged, true); } - private void onUserChanged(ValueChangedEvent user) + private void onUserChanged(ValueChangedEvent user) { text.Text = string.Empty; diff --git a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs index 41a3ee8ad6..eaa9703834 100644 --- a/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs +++ b/osu.Game/Overlays/Profile/Header/Components/ProfileRulesetSelector.cs @@ -3,14 +3,14 @@ using osu.Framework.Bindables; using osu.Framework.Graphics.UserInterface; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; -using osu.Game.Users; namespace osu.Game.Overlays.Profile.Header.Components { public class ProfileRulesetSelector : OverlayRulesetSelector { - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); protected override void LoadComplete() { diff --git a/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs index 8ca6961950..79e553062d 100644 --- a/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/DetailHeaderContainer.cs @@ -11,11 +11,11 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Leaderboards; using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Resources.Localisation.Web; using osu.Game.Scoring; -using osu.Game.Users; using osuTK; namespace osu.Game.Overlays.Profile.Header @@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Profile.Header private FillFlowContainer fillFlow; private RankGraph rankGraph; - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); private bool expanded = true; @@ -171,7 +171,7 @@ namespace osu.Game.Overlays.Profile.Header }; } - private void updateDisplay(User user) + private void updateDisplay(APIUser user) { medalInfo.Content = user?.Achievements?.Length.ToString() ?? "0"; ppInfo.Content = user?.Statistics?.PP?.ToLocalisableString("#,##0") ?? (LocalisableString)"0"; diff --git a/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs index f6419db540..5f513582e5 100644 --- a/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/MedalHeaderContainer.cs @@ -8,8 +8,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Profile.Header.Components; -using osu.Game.Users; using osuTK; using osuTK.Graphics; @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Header { private FillFlowContainer badgeFlowContainer; - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider) @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.Profile.Header }; } - private void updateDisplay(User user) + private void updateDisplay(APIUser user) { var badges = user.Badges; badgeFlowContainer.Clear(); diff --git a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs index f5720cffb0..6ba5cb2f7f 100644 --- a/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs +++ b/osu.Game/Overlays/Profile/Header/TopHeaderContainer.cs @@ -13,9 +13,9 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Profile.Header.Components; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; using osu.Game.Users.Drawables; using osuTK; @@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Profile.Header { private const float avatar_size = 110; - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); [Resolved] private IAPIProvider api { get; set; } @@ -167,7 +167,7 @@ namespace osu.Game.Overlays.Profile.Header User.BindValueChanged(user => updateUser(user.NewValue)); } - private void updateUser(User user) + private void updateUser(APIUser user) { avatar.User = user; usernameText.Text = user?.Username ?? string.Empty; diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 815f9fdafc..fab2487c0d 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Localisation; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Profile.Header; using osu.Game.Resources.Localisation.Web; using osu.Game.Users; @@ -18,7 +19,7 @@ namespace osu.Game.Overlays.Profile { private UserCoverBackground coverContainer; - public Bindable User = new Bindable(); + public Bindable User = new Bindable(); private CentreHeaderContainer centreHeaderContainer; private DetailHeaderContainer detailHeaderContainer; @@ -92,7 +93,7 @@ namespace osu.Game.Overlays.Profile protected override OverlayTitle CreateTitle() => new ProfileHeaderTitle(); - private void updateDisplay(User user) => coverContainer.User = user; + private void updateDisplay(APIUser user) => coverContainer.User = user; private class ProfileHeaderTitle : OverlayTitle { diff --git a/osu.Game/Overlays/Profile/ProfileSection.cs b/osu.Game/Overlays/Profile/ProfileSection.cs index 1a5f562fff..6223b32814 100644 --- a/osu.Game/Overlays/Profile/ProfileSection.cs +++ b/osu.Game/Overlays/Profile/ProfileSection.cs @@ -12,7 +12,7 @@ using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Profile { @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Profile protected override Container Content => content; - public readonly Bindable User = new Bindable(); + public readonly Bindable User = new Bindable(); protected ProfileSection() { diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index fffa20dc11..36b94283e5 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -10,8 +10,8 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.BeatmapListing.Panels; -using osu.Game.Users; using osuTK; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.Profile.Sections.Beatmaps { @@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps private const float panel_padding = 10f; private readonly BeatmapSetType type; - public PaginatedBeatmapContainer(BeatmapSetType type, Bindable user, LocalisableString headerText) + public PaginatedBeatmapContainer(BeatmapSetType type, Bindable user, LocalisableString headerText) : base(user, headerText) { this.type = type; @@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps ItemsContainer.Spacing = new Vector2(panel_padding); } - protected override int GetCount(User user) + protected override int GetCount(APIUser user) { switch (type) { diff --git a/osu.Game/Overlays/Profile/Sections/Historical/ChartProfileSubsection.cs b/osu.Game/Overlays/Profile/Sections/Historical/ChartProfileSubsection.cs index 986b3d9874..4edbdc31bd 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/ChartProfileSubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/ChartProfileSubsection.cs @@ -7,8 +7,7 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Localisation; -using osu.Game.Users; -using static osu.Game.Users.User; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Profile.Sections.Historical { @@ -21,7 +20,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical /// protected abstract LocalisableString GraphCounterName { get; } - protected ChartProfileSubsection(Bindable user, LocalisableString headerText) + protected ChartProfileSubsection(Bindable user, LocalisableString headerText) : base(user, headerText) { } @@ -45,7 +44,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical User.BindValueChanged(onUserChanged, true); } - private void onUserChanged(ValueChangedEvent e) + private void onUserChanged(ValueChangedEvent e) { var values = GetValues(e.NewValue); @@ -62,9 +61,9 @@ namespace osu.Game.Overlays.Profile.Sections.Historical /// /// Add entries for any missing months (filled with zero values). /// - private UserHistoryCount[] fillZeroValues(UserHistoryCount[] historyEntries) + private APIUserHistoryCount[] fillZeroValues(APIUserHistoryCount[] historyEntries) { - var filledHistoryEntries = new List(); + var filledHistoryEntries = new List(); foreach (var entry in historyEntries) { @@ -72,7 +71,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical while (lastFilled?.Date.AddMonths(1) < entry.Date) { - filledHistoryEntries.Add(lastFilled = new UserHistoryCount + filledHistoryEntries.Add(lastFilled = new APIUserHistoryCount { Count = 0, Date = lastFilled.Date.AddMonths(1) @@ -85,6 +84,6 @@ namespace osu.Game.Overlays.Profile.Sections.Historical return filledHistoryEntries.ToArray(); } - protected abstract UserHistoryCount[] GetValues(User user); + protected abstract APIUserHistoryCount[] GetValues(APIUser user); } } diff --git a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs index 428d04f985..c943d129cc 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs @@ -10,13 +10,13 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.Profile.Sections.Historical { public class PaginatedMostPlayedBeatmapContainer : PaginatedProfileSubsection { - public PaginatedMostPlayedBeatmapContainer(Bindable user) + public PaginatedMostPlayedBeatmapContainer(Bindable user) : base(user, UsersStrings.ShowExtraHistoricalMostPlayedTitle) { ItemsPerPage = 5; @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical ItemsContainer.Direction = FillDirection.Vertical; } - protected override int GetCount(User user) => user.BeatmapPlaycountsCount; + protected override int GetCount(APIUser user) => user.BeatmapPlaycountsCount; protected override APIRequest> CreateRequest() => new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++, ItemsPerPage); diff --git a/osu.Game/Overlays/Profile/Sections/Historical/PlayHistorySubsection.cs b/osu.Game/Overlays/Profile/Sections/Historical/PlayHistorySubsection.cs index 83c005970e..bca88318d5 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/PlayHistorySubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/PlayHistorySubsection.cs @@ -3,9 +3,8 @@ using osu.Framework.Bindables; using osu.Framework.Localisation; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; -using static osu.Game.Users.User; namespace osu.Game.Overlays.Profile.Sections.Historical { @@ -13,11 +12,11 @@ namespace osu.Game.Overlays.Profile.Sections.Historical { protected override LocalisableString GraphCounterName => UsersStrings.ShowExtraHistoricalMonthlyPlaycountsCountLabel; - public PlayHistorySubsection(Bindable user) + public PlayHistorySubsection(Bindable user) : base(user, UsersStrings.ShowExtraHistoricalMonthlyPlaycountsTitle) { } - protected override UserHistoryCount[] GetValues(User user) => user?.MonthlyPlaycounts; + protected override APIUserHistoryCount[] GetValues(APIUser user) => user?.MonthlyPlaycounts; } } diff --git a/osu.Game/Overlays/Profile/Sections/Historical/ProfileLineChart.cs b/osu.Game/Overlays/Profile/Sections/Historical/ProfileLineChart.cs index d402438376..c049bff7b2 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/ProfileLineChart.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/ProfileLineChart.cs @@ -14,16 +14,16 @@ using osu.Game.Graphics; using osu.Framework.Graphics.Shapes; using osuTK; using osu.Framework.Localisation; -using static osu.Game.Users.User; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Profile.Sections.Historical { public class ProfileLineChart : CompositeDrawable { - private UserHistoryCount[] values; + private APIUserHistoryCount[] values; [NotNull] - public UserHistoryCount[] Values + public APIUserHistoryCount[] Values { get => values; set diff --git a/osu.Game/Overlays/Profile/Sections/Historical/ReplaysSubsection.cs b/osu.Game/Overlays/Profile/Sections/Historical/ReplaysSubsection.cs index 76d5f73bd7..22312afdc9 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/ReplaysSubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/ReplaysSubsection.cs @@ -3,9 +3,8 @@ using osu.Framework.Bindables; using osu.Framework.Localisation; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Resources.Localisation.Web; -using osu.Game.Users; -using static osu.Game.Users.User; namespace osu.Game.Overlays.Profile.Sections.Historical { @@ -13,11 +12,11 @@ namespace osu.Game.Overlays.Profile.Sections.Historical { protected override LocalisableString GraphCounterName => UsersStrings.ShowExtraHistoricalReplaysWatchedCountsCountLabel; - public ReplaysSubsection(Bindable user) + public ReplaysSubsection(Bindable user) : base(user, UsersStrings.ShowExtraHistoricalReplaysWatchedCountsTitle) { } - protected override UserHistoryCount[] GetValues(User user) => user?.ReplaysWatchedCounts; + protected override APIUserHistoryCount[] GetValues(APIUser user) => user?.ReplaysWatchedCounts; } } diff --git a/osu.Game/Overlays/Profile/Sections/Historical/UserHistoryGraph.cs b/osu.Game/Overlays/Profile/Sections/Historical/UserHistoryGraph.cs index 61f77cd6ff..f80167f9d3 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/UserHistoryGraph.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/UserHistoryGraph.cs @@ -7,7 +7,7 @@ using System.Linq; using JetBrains.Annotations; using osu.Framework.Extensions.LocalisationExtensions; using osu.Framework.Localisation; -using static osu.Game.Users.User; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Profile.Sections.Historical { @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical private readonly LocalisableString tooltipCounterName; [CanBeNull] - public UserHistoryCount[] Values + public APIUserHistoryCount[] Values { set => Data = value?.Select(v => new KeyValuePair(v.Date, v.Count)).ToArray(); } diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 762716efab..79a06ecdd4 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -10,19 +10,19 @@ using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Users; using osu.Framework.Allocation; using osu.Framework.Extensions.LocalisationExtensions; using osu.Game.Resources.Localisation.Web; using osu.Framework.Localisation; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Profile.Sections.Kudosu { public class KudosuInfo : Container { - private readonly Bindable user = new Bindable(); + private readonly Bindable user = new Bindable(); - public KudosuInfo(Bindable user) + public KudosuInfo(Bindable user) { this.user.BindTo(user); CountSection total; diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs index 76cd7ed722..c4837cc0e2 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/PaginatedKudosuHistoryContainer.cs @@ -3,18 +3,18 @@ using osu.Framework.Graphics; using osu.Game.Online.API.Requests; -using osu.Game.Users; using osu.Framework.Bindables; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API; using System.Collections.Generic; using osu.Game.Resources.Localisation.Web; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.Profile.Sections.Kudosu { public class PaginatedKudosuHistoryContainer : PaginatedProfileSubsection { - public PaginatedKudosuHistoryContainer(Bindable user) + public PaginatedKudosuHistoryContainer(Bindable user) : base(user, missingText: UsersStrings.ShowExtraKudosuEntryEmpty) { ItemsPerPage = 5; diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs b/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs index d60243cd0a..affe9ecb0c 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedProfileSubsection.cs @@ -7,7 +7,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.API; -using osu.Game.Users; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -16,6 +15,7 @@ using osu.Game.Rulesets; using osu.Game.Graphics.Sprites; using osu.Game.Graphics; using osu.Framework.Localisation; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Profile.Sections { @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Profile.Sections private OsuSpriteText missing; private readonly LocalisableString? missingText; - protected PaginatedProfileSubsection(Bindable user, LocalisableString? headerText = null, LocalisableString? missingText = null) + protected PaginatedProfileSubsection(Bindable user, LocalisableString? headerText = null, LocalisableString? missingText = null) : base(user, headerText, CounterVisibilityState.AlwaysVisible) { this.missingText = missingText; @@ -81,7 +81,7 @@ namespace osu.Game.Overlays.Profile.Sections User.BindValueChanged(onUserChanged, true); } - private void onUserChanged(ValueChangedEvent e) + private void onUserChanged(ValueChangedEvent e) { loadCancellation?.Cancel(); retrievalRequest?.Cancel(); @@ -131,7 +131,7 @@ namespace osu.Game.Overlays.Profile.Sections }, loadCancellation.Token); }); - protected virtual int GetCount(User user) => 0; + protected virtual int GetCount(APIUser user) => 0; protected virtual void OnItemsReceived(List items) { diff --git a/osu.Game/Overlays/Profile/Sections/ProfileSubsection.cs b/osu.Game/Overlays/Profile/Sections/ProfileSubsection.cs index 5a17f0d8bb..fdf8cb19ff 100644 --- a/osu.Game/Overlays/Profile/Sections/ProfileSubsection.cs +++ b/osu.Game/Overlays/Profile/Sections/ProfileSubsection.cs @@ -5,22 +5,22 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Game.Users; using JetBrains.Annotations; using osu.Framework.Localisation; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Profile.Sections { public abstract class ProfileSubsection : FillFlowContainer { - protected readonly Bindable User = new Bindable(); + protected readonly Bindable User = new Bindable(); private readonly LocalisableString headerText; private readonly CounterVisibilityState counterVisibilityState; private ProfileSubsectionHeader header; - protected ProfileSubsection(Bindable user, LocalisableString? headerText = null, CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden) + protected ProfileSubsection(Bindable user, LocalisableString? headerText = null, CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden) { this.headerText = headerText ?? string.Empty; this.counterVisibilityState = counterVisibilityState; diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index cde386bc7b..c3f10587a9 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics.Containers; using osu.Game.Online.API.Requests; -using osu.Game.Users; using System; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -12,6 +11,7 @@ using System.Collections.Generic; using osu.Game.Online.API; using osu.Framework.Allocation; using osu.Framework.Localisation; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.Profile.Sections.Ranks { @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks { private readonly ScoreType type; - public PaginatedScoreContainer(ScoreType type, Bindable user, LocalisableString headerText) + public PaginatedScoreContainer(ScoreType type, Bindable user, LocalisableString headerText) : base(user, headerText) { this.type = type; @@ -33,7 +33,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks ItemsContainer.Direction = FillDirection.Vertical; } - protected override int GetCount(User user) + protected override int GetCount(APIUser user) { switch (type) { diff --git a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs index db2e6bc1e0..c5ff896654 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs @@ -3,7 +3,6 @@ using osu.Framework.Graphics; using osu.Game.Online.API.Requests; -using osu.Game.Users; using osu.Framework.Bindables; using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API; @@ -11,12 +10,13 @@ using System.Collections.Generic; using osuTK; using osu.Framework.Allocation; using osu.Game.Resources.Localisation.Web; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Overlays.Profile.Sections.Recent { public class PaginatedRecentActivityContainer : PaginatedProfileSubsection { - public PaginatedRecentActivityContainer(Bindable user) + public PaginatedRecentActivityContainer(Bindable user) : base(user, missingText: EventsStrings.Empty) { ItemsPerPage = 10; diff --git a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs index 40485a070c..284e9cb2de 100644 --- a/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/UserInterface/MainMenuSettings.cs @@ -8,7 +8,7 @@ using osu.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Localisation; using osu.Game.Online.API; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Settings.Sections.UserInterface { @@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface { protected override LocalisableString Header => UserInterfaceStrings.MainMenuHeader; - private IBindable user; + private IBindable user; private SettingsEnumDropdown backgroundSourceDropdown; diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index 5d4430caa2..b0c9a04285 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Effects; using osu.Game.Graphics; using osu.Game.Online.API; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Users.Drawables; using osuTK; using osuTK.Graphics; @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.Toolbar { default: Text = @"Guest"; - avatar.User = new User(); + avatar.User = new APIUser(); break; case APIState.Online: diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index b0327987f2..9fac1463f2 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Game.Graphics.Containers; using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Profile; using osu.Game.Overlays.Profile.Sections; using osu.Game.Users; @@ -38,18 +39,14 @@ namespace osu.Game.Overlays protected override Color4 BackgroundColour => ColourProvider.Background6; - public void ShowUser(int userId) => ShowUser(new User { Id = userId }); - - public void ShowUser(string username) => ShowUser(new User { Username = username }); - - public void ShowUser(User user, bool fetchOnline = true) + public void ShowUser(IUser user) { - if (user == User.SYSTEM_USER) + if (user == APIUser.SYSTEM_USER) return; Show(); - if (user.Id == Header?.User.Value?.Id) + if (user.OnlineID == Header?.User.Value?.Id) return; if (sectionsContainer != null) @@ -116,22 +113,23 @@ namespace osu.Game.Overlays } }; - if (fetchOnline) - { - userReq = user.Id > 1 ? new GetUserRequest(user.Id) : new GetUserRequest(user.Username); - userReq.Success += userLoadComplete; - API.Queue(userReq); - } - else + sectionsContainer.ScrollToTop(); + + // Check arbitrarily whether this user has already been populated. + // This is only generally used by tests, but should be quite safe unless we want to force a refresh on loading a previous user in the future. + if (user is APIUser apiUser && apiUser.JoinDate != default) { userReq = null; - userLoadComplete(user); + userLoadComplete(apiUser); + return; } - sectionsContainer.ScrollToTop(); + userReq = user.OnlineID > 1 ? new GetUserRequest(user.OnlineID) : new GetUserRequest(user.Username); + userReq.Success += userLoadComplete; + API.Queue(userReq); } - private void userLoadComplete(User user) + private void userLoadComplete(APIUser user) { Header.User.Value = user; diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index 4849d6ea36..60b9c29fe0 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -30,11 +30,6 @@ namespace osu.Game.Rulesets.Mods public override bool HasImplementation => GetType().GenericTypeArguments.Length == 0; - [Obsolete("Use the mod-supporting override")] // can be removed 20210731 - public virtual Score CreateReplayScore(IBeatmap beatmap) => new Score { Replay = new Replay() }; - -#pragma warning disable 618 - public virtual Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => CreateReplayScore(beatmap); -#pragma warning restore 618 + public virtual Score CreateReplayScore(IBeatmap beatmap, IReadOnlyList mods) => new Score { Replay = new Replay() }; } } diff --git a/osu.Game/Scoring/IScoreInfo.cs b/osu.Game/Scoring/IScoreInfo.cs index 77579f23d9..21a402f8c3 100644 --- a/osu.Game/Scoring/IScoreInfo.cs +++ b/osu.Game/Scoring/IScoreInfo.cs @@ -4,14 +4,14 @@ using System; using osu.Game.Beatmaps; using osu.Game.Database; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; -using osu.Game.Users; namespace osu.Game.Scoring { public interface IScoreInfo : IHasOnlineID { - User User { get; } + APIUser User { get; } long TotalScore { get; } diff --git a/osu.Game/Scoring/Legacy/LegacyScoreDecoder.cs b/osu.Game/Scoring/Legacy/LegacyScoreDecoder.cs index 379718195c..7bfe0308f7 100644 --- a/osu.Game/Scoring/Legacy/LegacyScoreDecoder.cs +++ b/osu.Game/Scoring/Legacy/LegacyScoreDecoder.cs @@ -8,12 +8,12 @@ using osu.Game.Beatmaps; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Legacy; using osu.Game.IO.Legacy; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Replays; using osu.Game.Replays.Legacy; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Replays; -using osu.Game.Users; using SharpCompress.Compressors.LZMA; namespace osu.Game.Scoring.Legacy @@ -45,7 +45,7 @@ namespace osu.Game.Scoring.Legacy if (workingBeatmap is DummyWorkingBeatmap) throw new BeatmapNotFoundException(); - scoreInfo.User = new User { Username = sr.ReadString() }; + scoreInfo.User = new APIUser { Username = sr.ReadString() }; // MD5Hash sr.ReadString(); diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index 36608e2a74..e5b050fc01 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -10,10 +10,10 @@ using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Database; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; -using osu.Game.Users; using osu.Game.Utils; namespace osu.Game.Scoring @@ -105,7 +105,7 @@ namespace osu.Game.Scoring } [NotMapped] - public User User { get; set; } + public APIUser User { get; set; } [Column("User")] public string UserString @@ -113,7 +113,7 @@ namespace osu.Game.Scoring get => User?.Username; set { - User ??= new User(); + User ??= new APIUser(); User.Username = value; } } @@ -124,7 +124,7 @@ namespace osu.Game.Scoring get => User?.Id ?? 1; set { - User ??= new User(); + User ??= new APIUser(); User.Id = value ?? 1; } } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index f0c90cc409..4a922c45b9 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -11,8 +11,8 @@ using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics.Backgrounds; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Skinning; -using osu.Game.Users; namespace osu.Game.Screens.Backgrounds { @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Backgrounds private int currentDisplay; private const int background_count = 7; - private IBindable user; + private IBindable user; private Bindable skin; private Bindable mode; private Bindable introSequence; diff --git a/osu.Game/Screens/Edit/Setup/MetadataSection.cs b/osu.Game/Screens/Edit/Setup/MetadataSection.cs index 5bb40c09a5..34c2fa8480 100644 --- a/osu.Game/Screens/Edit/Setup/MetadataSection.cs +++ b/osu.Game/Screens/Edit/Setup/MetadataSection.cs @@ -46,7 +46,7 @@ namespace osu.Game.Screens.Edit.Setup Empty(), - creatorTextBox = createTextBox("Creator", metadata.AuthorString), + creatorTextBox = createTextBox("Creator", metadata.Author.Username), difficultyTextBox = createTextBox("Difficulty Name", Beatmap.BeatmapInfo.Version), sourceTextBox = createTextBox("Source", metadata.Source), tagsTextBox = createTextBox("Tags", metadata.Tags) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index b8abc131fd..22151db0dd 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -14,9 +14,9 @@ using osu.Framework.Utils; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Online.API; +using osu.Game.Online.API.Requests.Responses; using osuTK; using osuTK.Graphics; -using osu.Game.Users; namespace osu.Game.Screens.Menu { @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Menu private readonly OsuScreen nextScreen; - private readonly Bindable currentUser = new Bindable(); + private readonly Bindable currentUser = new Bindable(); private FillFlowContainer fill; private readonly List expendableText = new List(); @@ -168,7 +168,7 @@ namespace osu.Game.Screens.Menu if (nextScreen != null) LoadComponentAsync(nextScreen); - ((IBindable)currentUser).BindTo(api.LocalUser); + ((IBindable)currentUser).BindTo(api.LocalUser); } public override void OnEntering(IScreen last) diff --git a/osu.Game/Screens/Menu/IntroTriangles.cs b/osu.Game/Screens/Menu/IntroTriangles.cs index 48ced63182..d171e481b1 100644 --- a/osu.Game/Screens/Menu/IntroTriangles.cs +++ b/osu.Game/Screens/Menu/IntroTriangles.cs @@ -393,6 +393,7 @@ namespace osu.Game.Screens.Menu public class OutlineTriangle : BufferedContainer { public OutlineTriangle(bool outlineOnly, float size) + : base(cachedFrameBuffer: true) { Size = new Vector2(size); @@ -414,7 +415,6 @@ namespace osu.Game.Screens.Menu } Blending = BlendingParameters.Additive; - CacheDrawnFrameBuffer = true; } } } diff --git a/osu.Game/Screens/Menu/MenuLogoVisualisation.cs b/osu.Game/Screens/Menu/MenuLogoVisualisation.cs index c44beeffa5..f461136022 100644 --- a/osu.Game/Screens/Menu/MenuLogoVisualisation.cs +++ b/osu.Game/Screens/Menu/MenuLogoVisualisation.cs @@ -4,15 +4,15 @@ using osuTK.Graphics; using osu.Game.Skinning; using osu.Game.Online.API; -using osu.Game.Users; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Screens.Menu { internal class MenuLogoVisualisation : LogoVisualisation { - private IBindable user; + private IBindable user; private Bindable skin; [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index a1ae4555ed..bdcd3020f8 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -13,10 +13,10 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Skinning; using osu.Game.Online.API; -using osu.Game.Users; using System; using osu.Framework.Audio.Track; using osu.Framework.Bindables; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Screens.Menu { @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Menu private const double box_fade_in_time = 65; private const int box_width = 200; - private IBindable user; + private IBindable user; private Bindable skin; [Resolved] diff --git a/osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs b/osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs index e531ddb0ec..1d5552fa7d 100644 --- a/osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs +++ b/osu.Game/Screens/OnlinePlay/Components/ParticipantsList.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Threading; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Users.Drawables; using osuTK; @@ -92,7 +92,7 @@ namespace osu.Game.Screens.OnlinePlay.Components private class UserTile : CompositeDrawable { - public User User + public APIUser User { get => avatar.User; set => avatar.User = value; diff --git a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs index 0681ac23ad..85cee46a29 100644 --- a/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs +++ b/osu.Game/Screens/OnlinePlay/DrawableRoomPlaylistItem.cs @@ -27,7 +27,6 @@ using osu.Game.Overlays.BeatmapSet; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Screens.Play.HUD; -using osu.Game.Users; using osuTK; using osuTK.Graphics; @@ -119,10 +118,10 @@ namespace osu.Game.Screens.OnlinePlay authorText.Clear(); - if (!string.IsNullOrEmpty(Item.Beatmap.Value?.Metadata.Author)) + if (!string.IsNullOrEmpty(Item.Beatmap.Value?.Metadata.Author.Username)) { authorText.AddText("mapped by "); - authorText.AddUserLink(new User { Username = Item.Beatmap.Value.Metadata.Author }); + authorText.AddUserLink(Item.Beatmap.Value.Metadata.Author); } bool hasExplicitContent = (Item.Beatmap.Value.BeatmapSet as IBeatmapSetOnlineInfo)?.HasExplicitContent == true; diff --git a/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoomParticipantsList.cs b/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoomParticipantsList.cs index 31eb5db9bc..10bd534b89 100644 --- a/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoomParticipantsList.cs +++ b/osu.Game/Screens/OnlinePlay/Lounge/Components/DrawableRoomParticipantsList.cs @@ -12,8 +12,8 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays; -using osu.Game.Users; using osu.Game.Users.Drawables; using osuTK; @@ -195,12 +195,12 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components switch (e.Action) { case NotifyCollectionChangedAction.Add: - foreach (var added in e.NewItems.OfType()) + foreach (var added in e.NewItems.OfType()) addUser(added); break; case NotifyCollectionChangedAction.Remove: - foreach (var removed in e.OldItems.OfType()) + foreach (var removed in e.OldItems.OfType()) removeUser(removed); break; @@ -222,13 +222,13 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components private int displayedCircles => avatarFlow.Count + (hiddenUsers.Count > 0 ? 1 : 0); - private void addUser(User user) + private void addUser(APIUser user) { if (displayedCircles < NumberOfCircles) avatarFlow.Add(new CircularAvatar { User = user }); } - private void removeUser(User user) + private void removeUser(APIUser user) { avatarFlow.RemoveAll(a => a.User == user); } @@ -256,7 +256,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components } } - private void onHostChanged(ValueChangedEvent host) + private void onHostChanged(ValueChangedEvent host) { hostAvatar.User = host.NewValue; hostText.Clear(); @@ -270,7 +270,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components private class CircularAvatar : CompositeDrawable { - public User User + public APIUser User { get => avatar.User; set => avatar.User = value; diff --git a/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs b/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs index e83403850f..a7b907c7d2 100644 --- a/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs +++ b/osu.Game/Screens/OnlinePlay/Match/DrawableMatchRoom.cs @@ -8,10 +8,10 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; 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.Screens.OnlinePlay.Lounge.Components; using osu.Game.Screens.OnlinePlay.Match.Components; -using osu.Game.Users; using osuTK; namespace osu.Game.Screens.OnlinePlay.Match @@ -24,7 +24,7 @@ namespace osu.Game.Screens.OnlinePlay.Match [Resolved] private IAPIProvider api { get; set; } - private readonly IBindable host = new Bindable(); + private readonly IBindable host = new Bindable(); private readonly bool allowEdit; [CanBeNull] diff --git a/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs b/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs index aa971864ef..cf274a3a21 100644 --- a/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs +++ b/osu.Game/Screens/OnlinePlay/OnlinePlayComposite.cs @@ -6,9 +6,9 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Match; -using osu.Game.Users; namespace osu.Game.Screens.OnlinePlay { @@ -24,7 +24,7 @@ namespace osu.Game.Screens.OnlinePlay protected Bindable RoomName { get; private set; } [Resolved(typeof(Room))] - protected Bindable Host { get; private set; } + protected Bindable Host { get; private set; } [Resolved(typeof(Room))] protected Bindable Status { get; private set; } @@ -39,7 +39,7 @@ namespace osu.Game.Screens.OnlinePlay protected Bindable Category { get; private set; } [Resolved(typeof(Room))] - protected BindableList RecentParticipants { get; private set; } + protected BindableList RecentParticipants { get; private set; } [Resolved(typeof(Room))] protected Bindable ParticipantCount { get; private set; } diff --git a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs index d77673580a..909f0a2b65 100644 --- a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs +++ b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play new Drawable[] { new MetadataLineLabel("Mapper"), - new MetadataLineInfo(metadata.AuthorString) + new MetadataLineInfo(metadata.Author.Username) } } }, diff --git a/osu.Game/Screens/Play/Break/BlurredIcon.cs b/osu.Game/Screens/Play/Break/BlurredIcon.cs index a88112a0db..1e974ec916 100644 --- a/osu.Game/Screens/Play/Break/BlurredIcon.cs +++ b/osu.Game/Screens/Play/Break/BlurredIcon.cs @@ -32,9 +32,9 @@ namespace osu.Game.Screens.Play.Break } public BlurredIcon() + : base(cachedFrameBuffer: true) { RelativePositionAxes = Axes.X; - CacheDrawnFrameBuffer = true; Child = icon = new SpriteIcon { Origin = Anchor.Centre, diff --git a/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs index 871555e5a3..638b2c395f 100644 --- a/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/GameplayLeaderboard.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Containers; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; using osuTK; using osuTK.Graphics; @@ -75,7 +75,7 @@ namespace osu.Game.Screens.Play.HUD /// Whether the player should be tracked on the leaderboard. /// Set to true for the local player or a player whose replay is currently being played. /// - public ILeaderboardScore Add([CanBeNull] User user, bool isTracked) + public ILeaderboardScore Add([CanBeNull] APIUser user, bool isTracked) { var drawable = CreateLeaderboardScoreDrawable(user, isTracked); @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Play.HUD scroll.ScrollToStart(false); } - protected virtual GameplayLeaderboardScore CreateLeaderboardScoreDrawable(User user, bool isTracked) => + protected virtual GameplayLeaderboardScore CreateLeaderboardScoreDrawable(APIUser user, bool isTracked) => new GameplayLeaderboardScore(user, isTracked); protected override void Update() diff --git a/osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs b/osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs index 85cf9d1966..773ee4a036 100644 --- a/osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs +++ b/osu.Game/Screens/Play/HUD/GameplayLeaderboardScore.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Users.Drawables; using osu.Game.Utils; using osuTK; @@ -79,7 +79,7 @@ namespace osu.Game.Screens.Play.HUD } [CanBeNull] - public User User { get; } + public APIUser User { get; } /// /// Whether this score is the local user or a replay player (and should be focused / always visible). @@ -101,7 +101,7 @@ namespace osu.Game.Screens.Play.HUD /// /// The score's player. /// Whether the player is the local user or a replay player. - public GameplayLeaderboardScore([CanBeNull] User user, bool tracked) + public GameplayLeaderboardScore([CanBeNull] APIUser user, bool tracked) { User = user; Tracked = tracked; diff --git a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs index 7caf90f610..e019ee9a3d 100644 --- a/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/MultiplayerGameplayLeaderboard.cs @@ -12,11 +12,11 @@ using osu.Game.Configuration; using osu.Game.Database; using osu.Game.Graphics; 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.Spectator; using osu.Game.Rulesets.Scoring; -using osu.Game.Users; using osuTK.Graphics; namespace osu.Game.Screens.Play.HUD @@ -118,7 +118,7 @@ namespace osu.Game.Screens.Play.HUD protected virtual TrackedUserData CreateUserData(MultiplayerRoomUser user, ScoreProcessor scoreProcessor) => new TrackedUserData(user, scoreProcessor); - protected override GameplayLeaderboardScore CreateLeaderboardScoreDrawable(User user, bool isTracked) + protected override GameplayLeaderboardScore CreateLeaderboardScoreDrawable(APIUser user, bool isTracked) { var leaderboardScore = base.CreateLeaderboardScoreDrawable(user, isTracked); diff --git a/osu.Game/Screens/Play/SoloSpectator.cs b/osu.Game/Screens/Play/SoloSpectator.cs index 250738df39..1dcc191c0f 100644 --- a/osu.Game/Screens/Play/SoloSpectator.cs +++ b/osu.Game/Screens/Play/SoloSpectator.cs @@ -27,6 +27,7 @@ using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.Spectate; using osu.Game.Users; using osuTK; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Screens.Play { @@ -34,7 +35,7 @@ namespace osu.Game.Screens.Play public class SoloSpectator : SpectatorScreen, IPreviewTrackOwner { [NotNull] - private readonly User targetUser; + private readonly APIUser targetUser; [Resolved] private IAPIProvider api { get; set; } @@ -62,7 +63,7 @@ namespace osu.Game.Screens.Play private APIBeatmapSet beatmapSet; - public SoloSpectator([NotNull] User targetUser) + public SoloSpectator([NotNull] APIUser targetUser) : base(targetUser.Id) { this.targetUser = targetUser; diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 67abcb66e6..a7d4454701 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -98,9 +98,8 @@ namespace osu.Game.Screens.Play /// protected virtual void RecreateGraph() { - var newColumns = new BufferedContainer + var newColumns = new BufferedContainer(cachedFrameBuffer: true) { - CacheDrawnFrameBuffer = true, RedrawOnScale = false, RelativeSizeAxes = Axes.Both, }; diff --git a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs index cc732382f4..5aea0184ee 100644 --- a/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs +++ b/osu.Game/Screens/Ranking/Expanded/Accuracy/RankText.cs @@ -51,13 +51,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy Font = OsuFont.Numeric.With(size: 76), UseFullGlyphHeight = false }, - superFlash = new BufferedContainer + superFlash = new BufferedContainer(cachedFrameBuffer: true) { Anchor = Anchor.Centre, Origin = Anchor.Centre, BlurSigma = new Vector2(85), Size = new Vector2(600), - CacheDrawnFrameBuffer = true, Blending = BlendingParameters.Additive, Alpha = 0, Children = new[] @@ -71,14 +70,13 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy }, }, }, - flash = new BufferedContainer + flash = new BufferedContainer(cachedFrameBuffer: true) { Anchor = Anchor.Centre, Origin = Anchor.Centre, BlurSigma = new Vector2(35), BypassAutoSizeAxes = Axes.Both, Size = new Vector2(200), - CacheDrawnFrameBuffer = true, Blending = BlendingParameters.Additive, Alpha = 0, Scale = new Vector2(1.8f), diff --git a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs index c27d5227b5..29b9d6164e 100644 --- a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs +++ b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelMiddleContent.cs @@ -62,7 +62,7 @@ namespace osu.Game.Screens.Ranking.Expanded { var beatmap = score.BeatmapInfo; var metadata = beatmap.BeatmapSet?.Metadata ?? beatmap.Metadata; - string creator = metadata.Author?.Username; + string creator = metadata.Author.Username; var topStatistics = new List { diff --git a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelTopContent.cs b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelTopContent.cs index 5dfc43cc29..bf06bc2227 100644 --- a/osu.Game/Screens/Ranking/Expanded/ExpandedPanelTopContent.cs +++ b/osu.Game/Screens/Ranking/Expanded/ExpandedPanelTopContent.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Users.Drawables; using osuTK; @@ -17,13 +17,13 @@ namespace osu.Game.Screens.Ranking.Expanded /// public class ExpandedPanelTopContent : CompositeDrawable { - private readonly User user; + private readonly APIUser user; /// /// Creates a new . /// - /// The to display. - public ExpandedPanelTopContent(User user) + /// The to display. + public ExpandedPanelTopContent(APIUser user) { this.user = user; Anchor = Anchor.TopCentre; diff --git a/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs b/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs index bc62bcf2b2..26dc3165f8 100644 --- a/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs +++ b/osu.Game/Screens/Ranking/Statistics/StatisticsPanel.cs @@ -69,6 +69,8 @@ namespace osu.Game.Screens.Ranking.Statistics foreach (var child in content) child.FadeOut(150).Expire(); + spinner.Hide(); + var newScore = score.NewValue; if (newScore == null) diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 89eed14e6d..e344da4027 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -428,7 +428,7 @@ namespace osu.Game.Screens.Select private Drawable getMapper(BeatmapMetadata metadata) { - if (metadata.Author == null) + if (string.IsNullOrEmpty(metadata.Author.Username)) return Empty(); return new LinkFlowContainer(s => diff --git a/osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs b/osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs index f50fb4dc8a..25056790cc 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedgeBackground.cs @@ -27,9 +27,8 @@ namespace osu.Game.Screens.Select { RelativeSizeAxes = Axes.Both; - InternalChild = new BufferedContainer + InternalChild = new BufferedContainer(cachedFrameBuffer: true) { - CacheDrawnFrameBuffer = true, RelativeSizeAxes = Axes.Both, Children = new Drawable[] { diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs index 9e057808a7..fa96e6dde7 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmap.cs @@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select.Carousel match &= !criteria.BeatDivisor.HasFilter || criteria.BeatDivisor.IsInRange(BeatmapInfo.BeatDivisor); match &= !criteria.OnlineStatus.HasFilter || criteria.OnlineStatus.IsInRange(BeatmapInfo.Status); - match &= !criteria.Creator.HasFilter || criteria.Creator.Matches(BeatmapInfo.Metadata.AuthorString); + match &= !criteria.Creator.HasFilter || criteria.Creator.Matches(BeatmapInfo.Metadata.Author.Username); match &= !criteria.Artist.HasFilter || criteria.Artist.Matches(BeatmapInfo.Metadata.Artist) || criteria.Artist.Matches(BeatmapInfo.Metadata.ArtistUnicode); diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs index d41cb73a29..e465f423bc 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs @@ -69,7 +69,7 @@ namespace osu.Game.Screens.Select.Carousel return string.Compare(BeatmapSet.Metadata.Title, otherSet.BeatmapSet.Metadata.Title, StringComparison.OrdinalIgnoreCase); case SortMode.Author: - return string.Compare(BeatmapSet.Metadata.Author?.Username, otherSet.BeatmapSet.Metadata.Author?.Username, StringComparison.OrdinalIgnoreCase); + return string.Compare(BeatmapSet.Metadata.Author.Username, otherSet.BeatmapSet.Metadata.Author.Username, StringComparison.OrdinalIgnoreCase); case SortMode.Source: return string.Compare(BeatmapSet.Metadata.Source, otherSet.BeatmapSet.Metadata.Source, StringComparison.OrdinalIgnoreCase); diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 8a5dde961f..5940911d4a 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -142,7 +142,7 @@ namespace osu.Game.Screens.Select.Carousel }, new OsuSpriteText { - Text = $"{(beatmapInfo.Metadata ?? beatmapInfo.BeatmapSet.Metadata).Author?.Username ?? string.Empty}", + Text = $"{(beatmapInfo.Metadata ?? beatmapInfo.BeatmapSet.Metadata).Author.Username}", Font = OsuFont.GetFont(italics: true), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft diff --git a/osu.Game/Screens/Select/Carousel/SetPanelBackground.cs b/osu.Game/Screens/Select/Carousel/SetPanelBackground.cs index 25139b27db..b4279cce51 100644 --- a/osu.Game/Screens/Select/Carousel/SetPanelBackground.cs +++ b/osu.Game/Screens/Select/Carousel/SetPanelBackground.cs @@ -15,8 +15,8 @@ namespace osu.Game.Screens.Select.Carousel public class SetPanelBackground : BufferedContainer { public SetPanelBackground(WorkingBeatmap working) + : base(cachedFrameBuffer: true) { - CacheDrawnFrameBuffer = true; RedrawOnScale = false; Children = new Drawable[] diff --git a/osu.Game/Screens/Spectate/SpectatorScreen.cs b/osu.Game/Screens/Spectate/SpectatorScreen.cs index c8df01dae6..1c0483fa42 100644 --- a/osu.Game/Screens/Spectate/SpectatorScreen.cs +++ b/osu.Game/Screens/Spectate/SpectatorScreen.cs @@ -11,11 +11,11 @@ using osu.Framework.Bindables; using osu.Framework.Extensions.ObjectExtensions; using osu.Game.Beatmaps; using osu.Game.Database; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Spectator; using osu.Game.Replays; using osu.Game.Rulesets; using osu.Game.Scoring; -using osu.Game.Users; namespace osu.Game.Screens.Spectate { @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Spectate private readonly IBindableDictionary playingUserStates = new BindableDictionary(); - private readonly Dictionary userMap = new Dictionary(); + private readonly Dictionary userMap = new Dictionary(); private readonly Dictionary gameplayStates = new Dictionary(); private IBindable> managerUpdated; diff --git a/osu.Game/Skinning/LegacyBeatmapSkin.cs b/osu.Game/Skinning/LegacyBeatmapSkin.cs index 8720a55076..8abef6800d 100644 --- a/osu.Game/Skinning/LegacyBeatmapSkin.cs +++ b/osu.Game/Skinning/LegacyBeatmapSkin.cs @@ -77,6 +77,6 @@ namespace osu.Game.Skinning } private static SkinInfo createSkinInfo(BeatmapInfo beatmapInfo) => - new SkinInfo { Name = beatmapInfo.ToString(), Creator = beatmapInfo.Metadata?.AuthorString }; + new SkinInfo { Name = beatmapInfo.ToString(), Creator = beatmapInfo.Metadata?.Author.Username }; } } diff --git a/osu.Game/Stores/BeatmapImporter.cs b/osu.Game/Stores/BeatmapImporter.cs index 787b1ddd60..1ac73cf781 100644 --- a/osu.Game/Stores/BeatmapImporter.cs +++ b/osu.Game/Stores/BeatmapImporter.cs @@ -238,7 +238,11 @@ namespace osu.Game.Stores TitleUnicode = decoded.Metadata.TitleUnicode, Artist = decoded.Metadata.Artist, ArtistUnicode = decoded.Metadata.ArtistUnicode, - Author = decoded.Metadata.AuthorString, + Author = + { + OnlineID = decoded.Metadata.Author.Id, + Username = decoded.Metadata.Author.Username + }, Source = decoded.Metadata.Source, Tags = decoded.Metadata.Tags, PreviewTime = decoded.Metadata.PreviewTime, diff --git a/osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs b/osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs index bb5dd09e16..b87c3d57c2 100644 --- a/osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs +++ b/osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs @@ -15,13 +15,13 @@ using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Formats; using osu.Game.IO; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; using osu.Game.Screens.Ranking; using osu.Game.Skinning; using osu.Game.Storyboards; using osu.Game.Tests.Visual; -using osu.Game.Users; namespace osu.Game.Tests.Beatmaps { @@ -41,7 +41,7 @@ namespace osu.Game.Tests.Beatmaps BeatmapSet = new BeatmapSetInfo(), Metadata = new BeatmapMetadata { - Author = User.SYSTEM_USER + Author = APIUser.SYSTEM_USER } }; diff --git a/osu.Game/Tests/TestScoreInfo.cs b/osu.Game/Tests/TestScoreInfo.cs index 719d31b092..a53cb0ae78 100644 --- a/osu.Game/Tests/TestScoreInfo.cs +++ b/osu.Game/Tests/TestScoreInfo.cs @@ -3,12 +3,12 @@ using System; using System.Linq; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Tests.Beatmaps; -using osu.Game.Users; namespace osu.Game.Tests { @@ -16,7 +16,7 @@ namespace osu.Game.Tests { public TestScoreInfo(RulesetInfo ruleset, bool excessMods = false) { - User = new User + User = new APIUser { Id = 2, Username = "peppy", diff --git a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs index 70d907ba15..0860e45346 100644 --- a/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs +++ b/osu.Game/Tests/Visual/Multiplayer/TestMultiplayerClient.cs @@ -18,7 +18,7 @@ using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus; using osu.Game.Online.Rooms; using osu.Game.Rulesets.Mods; -using osu.Game.Users; +using APIUser = osu.Game.Online.API.Requests.Responses.APIUser; namespace osu.Game.Tests.Visual.Multiplayer { @@ -51,7 +51,7 @@ namespace osu.Game.Tests.Visual.Multiplayer public void Disconnect() => isConnected.Value = false; - public MultiplayerRoomUser AddUser(User user, bool markAsPlaying = false) + public MultiplayerRoomUser AddUser(APIUser user, bool markAsPlaying = false) { var roomUser = new MultiplayerRoomUser(user.Id) { User = user }; @@ -73,7 +73,7 @@ namespace osu.Game.Tests.Visual.Multiplayer Scheduler.Update(); } - public void RemoveUser(User user) + public void RemoveUser(APIUser user) { Debug.Assert(Room != null); ((IMultiplayerClient)this).UserLeft(new MultiplayerRoomUser(user.Id)); diff --git a/osu.Game/Tests/Visual/OnlinePlay/TestRoomManager.cs b/osu.Game/Tests/Visual/OnlinePlay/TestRoomManager.cs index 5fe3dc8406..4cbc6174c9 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/TestRoomManager.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/TestRoomManager.cs @@ -3,10 +3,10 @@ using System; using osu.Game.Beatmaps; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Rulesets; using osu.Game.Screens.OnlinePlay.Components; -using osu.Game.Users; namespace osu.Game.Tests.Visual.OnlinePlay { @@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay { RoomID = { Value = -currentRoomId }, Name = { Value = $@"Room {currentRoomId}" }, - Host = { Value = new User { Username = @"Host" } }, + Host = { Value = new APIUser { Username = @"Host" } }, EndDate = { Value = DateTimeOffset.Now + TimeSpan.FromSeconds(10) }, Category = { Value = i % 2 == 0 ? RoomCategory.Spotlight : RoomCategory.Normal }, }; diff --git a/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs b/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs index 7f975c9985..dc12e48297 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/TestRoomRequestsHandler.cs @@ -7,11 +7,11 @@ using System.Linq; using osu.Framework.Allocation; using osu.Game.Online.API; using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.Rooms; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Screens.OnlinePlay.Components; -using osu.Game.Users; namespace osu.Game.Tests.Visual.OnlinePlay { @@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay /// The local user to store in responses where required. /// The game base for cases where actual online requests need to be sent. /// Whether the request was successfully handled. - public bool HandleRequest(APIRequest request, User localUser, OsuGameBase game) + public bool HandleRequest(APIRequest request, APIUser localUser, OsuGameBase game) { switch (request) { diff --git a/osu.Game/Tests/Visual/OsuTestScene.cs b/osu.Game/Tests/Visual/OsuTestScene.cs index 153e2c487c..83e1423504 100644 --- a/osu.Game/Tests/Visual/OsuTestScene.cs +++ b/osu.Game/Tests/Visual/OsuTestScene.cs @@ -216,8 +216,6 @@ namespace osu.Game.Tests.Visual Artist = beatmap.BeatmapSet.Metadata.Artist, ArtistUnicode = beatmap.BeatmapSet.Metadata.ArtistUnicode, Author = beatmap.BeatmapSet.Metadata.Author, - AuthorID = beatmap.BeatmapSet.Metadata.AuthorID, - AuthorString = beatmap.BeatmapSet.Metadata.AuthorString, Source = beatmap.BeatmapSet.Metadata.Source, Tags = beatmap.BeatmapSet.Metadata.Tags, Beatmaps = new[] @@ -228,7 +226,7 @@ namespace osu.Game.Tests.Visual OnlineBeatmapSetID = beatmap.BeatmapSet.OnlineID, Status = beatmap.Status, Checksum = beatmap.MD5Hash, - AuthorID = beatmap.Metadata.AuthorID, + AuthorID = beatmap.Metadata.Author.OnlineID, RulesetID = beatmap.RulesetID, StarRating = beatmap.StarDifficulty, DifficultyName = beatmap.Version, diff --git a/osu.Game/Tests/Visual/TestUserLookupCache.cs b/osu.Game/Tests/Visual/TestUserLookupCache.cs index fcb9c070ff..ce1bbd5f15 100644 --- a/osu.Game/Tests/Visual/TestUserLookupCache.cs +++ b/osu.Game/Tests/Visual/TestUserLookupCache.cs @@ -4,24 +4,24 @@ using System.Threading; using System.Threading.Tasks; using osu.Game.Database; -using osu.Game.Users; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Tests.Visual { public class TestUserLookupCache : UserLookupCache { /// - /// A special user ID which would return a for. + /// A special user ID which would return a for. /// As a simulation to what a regular would return in the case of failing to fetch the user. /// public const int UNRESOLVED_USER_ID = -1; - protected override Task ComputeValueAsync(int lookup, CancellationToken token = default) + protected override Task ComputeValueAsync(int lookup, CancellationToken token = default) { if (lookup == UNRESOLVED_USER_ID) - return Task.FromResult((User)null); + return Task.FromResult((APIUser)null); - return Task.FromResult(new User + return Task.FromResult(new APIUser { Id = lookup, Username = $"User {lookup}" diff --git a/osu.Game/Users/Drawables/ClickableAvatar.cs b/osu.Game/Users/Drawables/ClickableAvatar.cs index c8af8d80e4..2825c41ef6 100644 --- a/osu.Game/Users/Drawables/ClickableAvatar.cs +++ b/osu.Game/Users/Drawables/ClickableAvatar.cs @@ -9,6 +9,7 @@ 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 { @@ -33,7 +34,7 @@ namespace osu.Game.Users.Drawables set => clickableArea.TooltipText = value ? (user?.Username ?? string.Empty) : default_tooltip_text; } - private readonly User user; + private readonly APIUser user; [Resolved(CanBeNull = true)] private OsuGame game { get; set; } @@ -45,7 +46,7 @@ namespace osu.Game.Users.Drawables /// If is true, clicking will open the user's profile. /// /// The user. A null value will get a placeholder avatar. - public ClickableAvatar(User user = null) + public ClickableAvatar(APIUser user = null) { this.user = user; @@ -65,7 +66,7 @@ namespace osu.Game.Users.Drawables private void openProfile() { if (user?.Id > 1) - game?.ShowUser(user.Id); + game?.ShowUser(user); } private class ClickableArea : OsuClickableContainer diff --git a/osu.Game/Users/Drawables/DrawableAvatar.cs b/osu.Game/Users/Drawables/DrawableAvatar.cs index 87860bd149..e6d7bb692d 100644 --- a/osu.Game/Users/Drawables/DrawableAvatar.cs +++ b/osu.Game/Users/Drawables/DrawableAvatar.cs @@ -5,19 +5,20 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Users.Drawables { [LongRunningLoad] public class DrawableAvatar : Sprite { - private readonly User user; + private readonly APIUser user; /// /// A simple, non-interactable avatar sprite for the specified user. /// /// The user. A null value will get a placeholder avatar. - public DrawableAvatar(User user = null) + public DrawableAvatar(APIUser user = null) { this.user = user; diff --git a/osu.Game/Users/Drawables/UpdateableAvatar.cs b/osu.Game/Users/Drawables/UpdateableAvatar.cs index 6d48104131..8ce6ce3460 100644 --- a/osu.Game/Users/Drawables/UpdateableAvatar.cs +++ b/osu.Game/Users/Drawables/UpdateableAvatar.cs @@ -4,15 +4,16 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Users.Drawables { /// /// An avatar which can update to a new user when needed. /// - public class UpdateableAvatar : ModelBackedDrawable + public class UpdateableAvatar : ModelBackedDrawable { - public User User + public APIUser User { get => Model; set => Model = value; @@ -55,7 +56,7 @@ namespace osu.Game.Users.Drawables /// If set to true, hover/click sounds will play and clicking the avatar will open the user's profile. /// Whether to show the username rather than "view profile" on the tooltip. (note: this only applies if is also true) /// Whether to show a default guest representation on null user (as opposed to nothing). - public UpdateableAvatar(User user = null, bool isInteractive = true, bool showUsernameTooltip = false, bool showGuestOnNull = true) + public UpdateableAvatar(APIUser user = null, bool isInteractive = true, bool showUsernameTooltip = false, bool showGuestOnNull = true) { this.isInteractive = isInteractive; this.showUsernameTooltip = showUsernameTooltip; @@ -64,7 +65,7 @@ namespace osu.Game.Users.Drawables User = user; } - protected override Drawable CreateDrawable(User user) + protected override Drawable CreateDrawable(APIUser user) { if (user == null && !showGuestOnNull) return null; diff --git a/osu.Game/Users/ExtendedUserPanel.cs b/osu.Game/Users/ExtendedUserPanel.cs index 24317e6069..fc5e1eca5f 100644 --- a/osu.Game/Users/ExtendedUserPanel.cs +++ b/osu.Game/Users/ExtendedUserPanel.cs @@ -11,6 +11,7 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Sprites; using osu.Game.Users.Drawables; using osu.Framework.Input.Events; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Users { @@ -25,7 +26,7 @@ namespace osu.Game.Users private SpriteIcon statusIcon; private OsuSpriteText statusMessage; - protected ExtendedUserPanel(User user) + protected ExtendedUserPanel(APIUser user) : base(user) { } diff --git a/osu.Game/Users/IUser.cs b/osu.Game/Users/IUser.cs new file mode 100644 index 0000000000..3995531fd9 --- /dev/null +++ b/osu.Game/Users/IUser.cs @@ -0,0 +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.Database; + +namespace osu.Game.Users +{ + public interface IUser : IHasOnlineID + { + string Username { get; } + + bool IsBot { get; } + } +} diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs deleted file mode 100644 index 20c23153f0..0000000000 --- a/osu.Game/Users/User.cs +++ /dev/null @@ -1,294 +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.ComponentModel; -using System.Linq; -using JetBrains.Annotations; -using Newtonsoft.Json; -using osu.Framework.Bindables; -using osu.Game.Online.API.Requests; - -namespace osu.Game.Users -{ - public class User : IEquatable - { - [JsonProperty(@"id")] - public int Id = 1; - - [JsonProperty(@"join_date")] - public DateTimeOffset JoinDate; - - [JsonProperty(@"username")] - public string Username; - - [JsonProperty(@"previous_usernames")] - public string[] PreviousUsernames; - - [JsonProperty(@"country")] - public Country Country; - - public readonly Bindable Status = new Bindable(); - - public readonly Bindable Activity = new Bindable(); - - //public Team Team; - - [JsonProperty(@"profile_colour")] - public string Colour; - - [JsonProperty(@"avatar_url")] - public string AvatarUrl; - - [JsonProperty(@"cover_url")] - public string CoverUrl - { - get => Cover?.Url; - set => Cover = new UserCover { Url = value }; - } - - [JsonProperty(@"cover")] - public UserCover Cover; - - public class UserCover - { - [JsonProperty(@"custom_url")] - public string CustomUrl; - - [JsonProperty(@"url")] - public string Url; - - [JsonProperty(@"id")] - public int? Id; - } - - [JsonProperty(@"is_admin")] - public bool IsAdmin; - - [JsonProperty(@"is_supporter")] - public bool IsSupporter; - - [JsonProperty(@"support_level")] - public int SupportLevel; - - [JsonProperty(@"is_gmt")] - public bool IsGMT; - - [JsonProperty(@"is_qat")] - public bool IsQAT; - - [JsonProperty(@"is_bng")] - public bool IsBNG; - - [JsonProperty(@"is_bot")] - public bool IsBot; - - [JsonProperty(@"is_active")] - public bool Active; - - [JsonProperty(@"is_online")] - public bool IsOnline; - - [JsonProperty(@"pm_friends_only")] - public bool PMFriendsOnly; - - [JsonProperty(@"interests")] - public string Interests; - - [JsonProperty(@"occupation")] - public string Occupation; - - [JsonProperty(@"title")] - public string Title; - - [JsonProperty(@"location")] - public string Location; - - [JsonProperty(@"last_visit")] - public DateTimeOffset? LastVisit; - - [JsonProperty(@"twitter")] - public string Twitter; - - [JsonProperty(@"discord")] - public string Discord; - - [JsonProperty(@"website")] - public string Website; - - [JsonProperty(@"post_count")] - public int PostCount; - - [JsonProperty(@"comments_count")] - public int CommentsCount; - - [JsonProperty(@"follower_count")] - public int FollowerCount; - - [JsonProperty(@"mapping_follower_count")] - public int MappingFollowerCount; - - [JsonProperty(@"favourite_beatmapset_count")] - public int FavouriteBeatmapsetCount; - - [JsonProperty(@"graveyard_beatmapset_count")] - public int GraveyardBeatmapsetCount; - - [JsonProperty(@"loved_beatmapset_count")] - public int LovedBeatmapsetCount; - - [JsonProperty(@"ranked_beatmapset_count")] - public int RankedBeatmapsetCount; - - [JsonProperty(@"pending_beatmapset_count")] - public int PendingBeatmapsetCount; - - [JsonProperty(@"scores_best_count")] - public int ScoresBestCount; - - [JsonProperty(@"scores_first_count")] - public int ScoresFirstCount; - - [JsonProperty(@"scores_recent_count")] - public int ScoresRecentCount; - - [JsonProperty(@"beatmap_playcounts_count")] - public int BeatmapPlaycountsCount; - - [JsonProperty] - private string[] playstyle - { - set => PlayStyles = value?.Select(str => Enum.Parse(typeof(PlayStyle), str, true)).Cast().ToArray(); - } - - public PlayStyle[] PlayStyles; - - [JsonProperty(@"playmode")] - public string PlayMode; - - [JsonProperty(@"profile_order")] - public string[] ProfileOrder; - - [JsonProperty(@"kudosu")] - public KudosuCount Kudosu; - - public class KudosuCount - { - [JsonProperty(@"total")] - public int Total; - - [JsonProperty(@"available")] - public int Available; - } - - private UserStatistics statistics; - - /// - /// User statistics for the requested ruleset (in the case of a or response). - /// Otherwise empty. - /// - [JsonProperty(@"statistics")] - public UserStatistics Statistics - { - get => statistics ??= new UserStatistics(); - set - { - if (statistics != null) - // we may already have rank history populated - value.RankHistory = statistics.RankHistory; - - statistics = value; - } - } - - [JsonProperty(@"rank_history")] - private RankHistoryData rankHistory - { - set => statistics.RankHistory = value; - } - - public class RankHistoryData - { - [JsonProperty(@"mode")] - public string Mode; - - [JsonProperty(@"data")] - public int[] Data; - } - - [JsonProperty("badges")] - public Badge[] Badges; - - [JsonProperty("user_achievements")] - public UserAchievement[] Achievements; - - public class UserAchievement - { - [JsonProperty("achieved_at")] - public DateTimeOffset AchievedAt; - - [JsonProperty("achievement_id")] - public int ID; - } - - [JsonProperty("monthly_playcounts")] - public UserHistoryCount[] MonthlyPlaycounts; - - [JsonProperty("replays_watched_counts")] - public UserHistoryCount[] ReplaysWatchedCounts; - - /// - /// All user statistics per ruleset's short name (in the case of a response). - /// Otherwise empty. Can be altered for testing purposes. - /// - // todo: this should likely be moved to a separate UserCompact class at some point. - [JsonProperty("statistics_rulesets")] - [CanBeNull] - public Dictionary RulesetsStatistics { get; set; } - - public override string ToString() => Username; - - /// - /// A user instance for displaying locally created system messages. - /// - public static readonly User SYSTEM_USER = new User - { - Username = "system", - Colour = @"9c0101", - Id = 0 - }; - - public bool Equals(User other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - - return Id == other.Id; - } - - public enum PlayStyle - { - [Description("Keyboard")] - Keyboard, - - [Description("Mouse")] - Mouse, - - [Description("Tablet")] - Tablet, - - [Description("Touch Screen")] - Touch, - } - - public class UserHistoryCount - { - [JsonProperty("start_date")] - public DateTime Date; - - [JsonProperty("count")] - public long Count; - } - } -} diff --git a/osu.Game/Users/UserBrickPanel.cs b/osu.Game/Users/UserBrickPanel.cs index 9ca7768187..3debdb6e72 100644 --- a/osu.Game/Users/UserBrickPanel.cs +++ b/osu.Game/Users/UserBrickPanel.cs @@ -7,13 +7,14 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; +using osu.Game.Online.API.Requests.Responses; using osuTK; namespace osu.Game.Users { public class UserBrickPanel : UserPanel { - public UserBrickPanel(User user) + public UserBrickPanel(APIUser user) : base(user) { AutoSizeAxes = Axes.Both; diff --git a/osu.Game/Users/UserCoverBackground.cs b/osu.Game/Users/UserCoverBackground.cs index 34bbf6892e..3f1f838b27 100644 --- a/osu.Game/Users/UserCoverBackground.cs +++ b/osu.Game/Users/UserCoverBackground.cs @@ -10,19 +10,20 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Game.Online.API.Requests.Responses; using osuTK.Graphics; namespace osu.Game.Users { - public class UserCoverBackground : ModelBackedDrawable + public class UserCoverBackground : ModelBackedDrawable { - public User User + public APIUser User { get => Model; set => Model = value; } - protected override Drawable CreateDrawable(User user) => new Cover(user); + protected override Drawable CreateDrawable(APIUser user) => new Cover(user); protected override double LoadDelay => 300; @@ -37,9 +38,9 @@ namespace osu.Game.Users [LongRunningLoad] private class Cover : CompositeDrawable { - private readonly User user; + private readonly APIUser user; - public Cover(User user) + public Cover(APIUser user) { this.user = user; diff --git a/osu.Game/Users/UserGridPanel.cs b/osu.Game/Users/UserGridPanel.cs index 44dcbc305d..c37eeb1cbf 100644 --- a/osu.Game/Users/UserGridPanel.cs +++ b/osu.Game/Users/UserGridPanel.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Profile.Header.Components; using osuTK; @@ -13,7 +14,7 @@ namespace osu.Game.Users { private const int margin = 10; - public UserGridPanel(User user) + public UserGridPanel(APIUser user) : base(user) { Height = 120; diff --git a/osu.Game/Users/UserListPanel.cs b/osu.Game/Users/UserListPanel.cs index cc4fca9b94..f06e412315 100644 --- a/osu.Game/Users/UserListPanel.cs +++ b/osu.Game/Users/UserListPanel.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Extensions.Color4Extensions; using osuTK.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Online.API.Requests.Responses; using osuTK; using osu.Game.Overlays.Profile.Header.Components; @@ -14,7 +15,7 @@ namespace osu.Game.Users { public class UserListPanel : ExtendedUserPanel { - public UserListPanel(User user) + public UserListPanel(APIUser user) : base(user) { RelativeSizeAxes = Axes.X; diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index ff0d03a036..248debf1d3 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -13,12 +13,13 @@ using osu.Game.Graphics.UserInterface; using osu.Framework.Graphics.Cursor; using osu.Game.Graphics.Containers; using JetBrains.Annotations; +using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Users { public abstract class UserPanel : OsuClickableContainer, IHasContextMenu { - public readonly User User; + public readonly APIUser User; /// /// Perform an action in addition to showing the user's profile. @@ -30,7 +31,7 @@ namespace osu.Game.Users protected Drawable Background { get; private set; } - protected UserPanel(User user) + protected UserPanel(APIUser user) : base(HoverSampleSet.Submit) { if (user == null) diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs index 449b0aa212..c690447256 100644 --- a/osu.Game/Users/UserStatistics.cs +++ b/osu.Game/Users/UserStatistics.cs @@ -4,16 +4,16 @@ using System; using Newtonsoft.Json; using osu.Framework.Localisation; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Scoring; using osu.Game.Utils; -using static osu.Game.Users.User; namespace osu.Game.Users { public class UserStatistics { [JsonProperty] - public User User; + public APIUser User; [JsonProperty(@"level")] public LevelInfo Level; @@ -34,7 +34,7 @@ namespace osu.Game.Users public int? CountryRank; // populated via User model, as that's where the data currently lives. - public RankHistoryData RankHistory; + public APIRankHistory RankHistory; [JsonProperty(@"pp")] public decimal? PP; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6dda1f77c6..7811de5764 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 df24a57e90..9d95b7c765 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -70,7 +70,7 @@ - + @@ -93,7 +93,7 @@ - +