mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 14:13:18 +08:00
Merge branch 'master' into master
This commit is contained in:
commit
74c37e248d
@ -14,8 +14,8 @@
|
||||
"jb"
|
||||
]
|
||||
},
|
||||
"smoogipoo.nvika": {
|
||||
"version": "1.0.3",
|
||||
"nvika": {
|
||||
"version": "2.2.0",
|
||||
"commands": [
|
||||
"nvika"
|
||||
]
|
||||
|
2
.github/dependabot.yml
vendored
2
.github/dependabot.yml
vendored
@ -5,7 +5,7 @@ updates:
|
||||
schedule:
|
||||
interval: monthly
|
||||
time: "17:00"
|
||||
open-pull-requests-limit: 99
|
||||
open-pull-requests-limit: 0 # disabled until https://github.com/dependabot/dependabot-core/issues/369 is resolved.
|
||||
ignore:
|
||||
- dependency-name: Microsoft.EntityFrameworkCore.Design
|
||||
versions:
|
||||
|
@ -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(),
|
||||
};
|
||||
|
@ -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(),
|
||||
};
|
||||
|
@ -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(),
|
||||
};
|
||||
|
@ -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(),
|
||||
};
|
||||
|
@ -52,7 +52,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.1026.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.1103.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.1108.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Transitive Dependencies">
|
||||
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
||||
|
@ -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<RulesetInfo> ruleset { get; set; }
|
||||
|
||||
private IBindable<User> user;
|
||||
private IBindable<APIUser> user;
|
||||
|
||||
private readonly IBindable<UserStatus> status = new Bindable<UserStatus>();
|
||||
private readonly IBindable<UserActivity> activity = new Bindable<UserActivity>();
|
||||
|
@ -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<Mod> 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(),
|
||||
};
|
||||
}
|
||||
|
@ -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<Mod> 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(),
|
||||
};
|
||||
}
|
||||
|
@ -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<Mod> 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(),
|
||||
};
|
||||
}
|
||||
|
@ -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<Mod> 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(),
|
||||
};
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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<Mod> 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()
|
||||
};
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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<double>(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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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<Mod> 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()
|
||||
};
|
||||
}
|
||||
|
@ -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<Mod> 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()
|
||||
};
|
||||
}
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -0,0 +1,91 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Taiko.Beatmaps;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Setup;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Select;
|
||||
using osu.Game.Tests.Visual;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests.Editor
|
||||
{
|
||||
public class TestSceneEditorSaving : OsuGameTestScene
|
||||
{
|
||||
private Screens.Edit.Editor editor => Game.ChildrenOfType<Screens.Edit.Editor>().FirstOrDefault();
|
||||
|
||||
private EditorBeatmap editorBeatmap => (EditorBeatmap)editor.Dependencies.Get(typeof(EditorBeatmap));
|
||||
|
||||
/// <summary>
|
||||
/// Tests the general expected flow of creating a new beatmap, saving it, then loading it back from song select.
|
||||
/// Emphasis is placed on <see cref="BeatmapDifficulty.SliderMultiplier"/>, since taiko has special handling for it to keep compatibility with stable.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestNewBeatmapSaveThenLoad()
|
||||
{
|
||||
AddStep("set default beatmap", () => Game.Beatmap.SetDefault());
|
||||
AddStep("set taiko ruleset", () => Ruleset.Value = new TaikoRuleset().RulesetInfo);
|
||||
|
||||
PushAndConfirm(() => new EditorLoader());
|
||||
|
||||
AddUntilStep("wait for editor load", () => editor?.IsLoaded == true);
|
||||
|
||||
AddUntilStep("wait for metadata screen load", () => editor.ChildrenOfType<MetadataSection>().FirstOrDefault()?.IsLoaded == true);
|
||||
|
||||
// We intentionally switch away from the metadata screen, else there is a feedback loop with the textbox handling which causes metadata changes below to get overwritten.
|
||||
|
||||
AddStep("Enter compose mode", () => InputManager.Key(Key.F1));
|
||||
AddUntilStep("Wait for compose mode load", () => editor.ChildrenOfType<HitObjectComposer>().FirstOrDefault()?.IsLoaded == true);
|
||||
|
||||
AddStep("Set slider multiplier", () => editorBeatmap.Difficulty.SliderMultiplier = 2);
|
||||
AddStep("Set artist and title", () =>
|
||||
{
|
||||
editorBeatmap.BeatmapInfo.Metadata.Artist = "artist";
|
||||
editorBeatmap.BeatmapInfo.Metadata.Title = "title";
|
||||
});
|
||||
AddStep("Set difficulty name", () => editorBeatmap.BeatmapInfo.Version = "difficulty");
|
||||
|
||||
checkMutations();
|
||||
|
||||
AddStep("Save", () => InputManager.Keys(PlatformAction.Save));
|
||||
|
||||
checkMutations();
|
||||
|
||||
AddStep("Exit", () => InputManager.Key(Key.Escape));
|
||||
|
||||
AddUntilStep("Wait for main menu", () => Game.ScreenStack.CurrentScreen is MainMenu);
|
||||
|
||||
PushAndConfirm(() => new PlaySongSelect());
|
||||
|
||||
AddUntilStep("Wait for beatmap selected", () => !Game.Beatmap.IsDefault);
|
||||
AddStep("Open options", () => InputManager.Key(Key.F3));
|
||||
AddStep("Enter editor", () => InputManager.Key(Key.Number5));
|
||||
|
||||
AddUntilStep("Wait for editor load", () => editor != null);
|
||||
|
||||
checkMutations();
|
||||
}
|
||||
|
||||
private void checkMutations()
|
||||
{
|
||||
AddAssert("Beatmap has correct slider multiplier", () =>
|
||||
{
|
||||
// we can only assert value correctness on TaikoMultiplierAppliedDifficulty, because that is the final difficulty converted taiko beatmaps use.
|
||||
// therefore, ensure that we have that difficulty type by calling .CopyFrom(), which is a no-op if the type is already correct.
|
||||
var taikoDifficulty = new TaikoBeatmapConverter.TaikoMultiplierAppliedDifficulty();
|
||||
taikoDifficulty.CopyFrom(editorBeatmap.Difficulty);
|
||||
return Precision.AlmostEquals(taikoDifficulty.SliderMultiplier, 2);
|
||||
});
|
||||
AddAssert("Beatmap has correct metadata", () => editorBeatmap.BeatmapInfo.Metadata.Artist == "artist" && editorBeatmap.BeatmapInfo.Metadata.Title == "title");
|
||||
AddAssert("Beatmap has correct difficulty name", () => editorBeatmap.BeatmapInfo.Version == "difficulty");
|
||||
}
|
||||
}
|
||||
}
|
@ -191,7 +191,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
||||
|
||||
protected override Beatmap<TaikoHitObject> CreateBeatmap() => new TaikoBeatmap();
|
||||
|
||||
private class TaikoMultiplierAppliedDifficulty : BeatmapDifficulty
|
||||
internal class TaikoMultiplierAppliedDifficulty : BeatmapDifficulty
|
||||
{
|
||||
public TaikoMultiplierAppliedDifficulty(IBeatmapDifficultyInfo difficulty)
|
||||
{
|
||||
@ -209,7 +209,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
||||
{
|
||||
base.CopyTo(other);
|
||||
if (!(other is TaikoMultiplierAppliedDifficulty))
|
||||
SliderMultiplier /= LegacyBeatmapEncoder.LEGACY_TAIKO_VELOCITY_MULTIPLIER;
|
||||
other.SliderMultiplier /= LegacyBeatmapEncoder.LEGACY_TAIKO_VELOCITY_MULTIPLIER;
|
||||
}
|
||||
|
||||
public override void CopyFrom(IBeatmapDifficultyInfo other)
|
||||
|
@ -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<Mod> mods) => new Score
|
||||
{
|
||||
ScoreInfo = new ScoreInfo { User = new User { Username = "mekkadosu!" } },
|
||||
ScoreInfo = new ScoreInfo { User = new APIUser { Username = "mekkadosu!" } },
|
||||
Replay = new TaikoAutoGenerator(beatmap).Generate(),
|
||||
};
|
||||
}
|
||||
|
@ -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<Mod> mods) => new Score
|
||||
{
|
||||
ScoreInfo = new ScoreInfo { User = new User { Username = "mekkadosu!" } },
|
||||
ScoreInfo = new ScoreInfo { User = new APIUser { Username = "mekkadosu!" } },
|
||||
Replay = new TaikoAutoGenerator(beatmap).Generate(),
|
||||
};
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -673,6 +673,8 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.That(first.ControlPoints[1].Position, Is.EqualTo(new Vector2(161, -244)));
|
||||
Assert.That(first.ControlPoints[1].Type, Is.EqualTo(null));
|
||||
|
||||
// ReSharper disable once HeuristicUnreachableCode
|
||||
// weird one, see https://youtrack.jetbrains.com/issue/RIDER-70159.
|
||||
Assert.That(first.ControlPoints[2].Position, Is.EqualTo(new Vector2(376, -3)));
|
||||
Assert.That(first.ControlPoints[2].Type, Is.EqualTo(PathType.Bezier));
|
||||
Assert.That(first.ControlPoints[3].Position, Is.EqualTo(new Vector2(68, 15)));
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
@ -408,8 +408,8 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
// ReSharper disable once AccessToModifiedClosure
|
||||
manager.ItemUpdated.BindValueChanged(_ => Interlocked.Increment(ref itemAddRemoveFireCount));
|
||||
manager.ItemRemoved.BindValueChanged(_ => Interlocked.Increment(ref itemAddRemoveFireCount));
|
||||
manager.ItemUpdated += _ => Interlocked.Increment(ref itemAddRemoveFireCount);
|
||||
manager.ItemRemoved += _ => Interlocked.Increment(ref itemAddRemoveFireCount);
|
||||
|
||||
var imported = await LoadOszIntoOsu(osu);
|
||||
|
||||
@ -846,6 +846,42 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: needs to be pulled across to realm implementation when this file is nuked.
|
||||
[Test]
|
||||
public void TestSaveRemovesInvalidCharactersFromPath()
|
||||
{
|
||||
// unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(ImportBeatmapTest)))
|
||||
{
|
||||
try
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
var working = manager.CreateNew(new OsuRuleset().RulesetInfo, APIUser.SYSTEM_USER);
|
||||
|
||||
var beatmap = working.Beatmap;
|
||||
|
||||
beatmap.BeatmapInfo.Version = "difficulty";
|
||||
beatmap.BeatmapInfo.Metadata = new BeatmapMetadata
|
||||
{
|
||||
Artist = "Artist/With\\Slashes",
|
||||
Title = "Title",
|
||||
AuthorString = "mapper",
|
||||
};
|
||||
|
||||
manager.Save(beatmap.BeatmapInfo, working.Beatmap);
|
||||
|
||||
Assert.AreEqual("Artist_With_Slashes - Title (mapper) [difficulty].osu", beatmap.BeatmapInfo.Path);
|
||||
}
|
||||
finally
|
||||
{
|
||||
host.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCreateNewEmptyBeatmap()
|
||||
{
|
||||
@ -856,7 +892,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
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);
|
||||
|
||||
@ -883,7 +919,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
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 });
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
};
|
||||
|
@ -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}",
|
||||
|
@ -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<RealmRuleset>().First();
|
||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Database;
|
||||
@ -33,7 +34,7 @@ namespace osu.Game.Tests.Database
|
||||
storage = new NativeStorage(directory.FullName);
|
||||
|
||||
realmContextFactory = new RealmContextFactory(storage, "test");
|
||||
keyBindingStore = new RealmKeyBindingStore(realmContextFactory);
|
||||
keyBindingStore = new RealmKeyBindingStore(realmContextFactory, new ReadableKeyCombinationProvider());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Tests.Editing.Checks
|
||||
public void TestMissing()
|
||||
{
|
||||
// While this is a problem, it is out of scope for this check and is caught by a different one.
|
||||
beatmap.Metadata.AudioFile = null;
|
||||
beatmap.Metadata.AudioFile = string.Empty;
|
||||
|
||||
var mock = new Mock<IWorkingBeatmap>();
|
||||
mock.SetupGet(w => w.Beatmap).Returns(beatmap);
|
||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Tests.Editing.Checks
|
||||
public void TestMissing()
|
||||
{
|
||||
// While this is a problem, it is out of scope for this check and is caught by a different one.
|
||||
beatmap.Metadata.BackgroundFile = null;
|
||||
beatmap.Metadata.BackgroundFile = string.Empty;
|
||||
var context = getContext(null, System.Array.Empty<byte>());
|
||||
|
||||
Assert.That(check.Run(context), Is.Empty);
|
||||
|
@ -65,7 +65,7 @@ namespace osu.Game.Tests.Editing.Checks
|
||||
[Test]
|
||||
public void TestBackgroundNotSet()
|
||||
{
|
||||
beatmap.Metadata.BackgroundFile = null;
|
||||
beatmap.Metadata.BackgroundFile = string.Empty;
|
||||
|
||||
var context = new BeatmapVerifierContext(beatmap, new TestWorkingBeatmap(beatmap));
|
||||
var issues = check.Run(context).ToList();
|
||||
|
@ -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
|
||||
|
@ -39,8 +39,8 @@ namespace osu.Game.Tests.NonVisual
|
||||
[Test]
|
||||
public void TestCheckNullID()
|
||||
{
|
||||
var ourInfo = new BeatmapSetInfo { Status = BeatmapSetOnlineStatus.Loved };
|
||||
var otherInfo = new BeatmapSetInfo { Status = BeatmapSetOnlineStatus.Approved };
|
||||
var ourInfo = new BeatmapSetInfo { Hash = "1" };
|
||||
var otherInfo = new BeatmapSetInfo { Hash = "2" };
|
||||
|
||||
Assert.AreNotEqual(ourInfo, otherInfo);
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
|
||||
public void TestCriteriaMatchingArtistWithNullUnicodeName(string artistName, bool filtered)
|
||||
{
|
||||
var exampleBeatmapInfo = getExampleBeatmap();
|
||||
exampleBeatmapInfo.Metadata.ArtistUnicode = null;
|
||||
exampleBeatmapInfo.Metadata.ArtistUnicode = string.Empty;
|
||||
|
||||
var criteria = new FilterCriteria
|
||||
{
|
||||
|
@ -79,8 +79,17 @@ namespace osu.Game.Tests.NonVisual
|
||||
public List<HitObject> HitObjects;
|
||||
public override IEnumerable<HitObject> Objects => HitObjects;
|
||||
|
||||
public override event Action<JudgementResult> NewResult;
|
||||
public override event Action<JudgementResult> RevertResult;
|
||||
public override event Action<JudgementResult> NewResult
|
||||
{
|
||||
add => throw new InvalidOperationException();
|
||||
remove => throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
public override event Action<JudgementResult> 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();
|
||||
|
@ -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
|
||||
});
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
@ -67,9 +68,11 @@ namespace osu.Game.Tests.Online
|
||||
var deserialised = JsonConvert.DeserializeObject<APIMod>(JsonConvert.SerializeObject(apiMod));
|
||||
var converted = (TestModTimeRamp)deserialised?.ToMod(new TestRuleset());
|
||||
|
||||
Assert.That(converted?.AdjustPitch.Value, Is.EqualTo(false));
|
||||
Assert.That(converted?.InitialRate.Value, Is.EqualTo(1.25));
|
||||
Assert.That(converted?.FinalRate.Value, Is.EqualTo(0.25));
|
||||
Assert.That(converted, Is.Not.Null);
|
||||
|
||||
Assert.That(converted.AdjustPitch.Value, Is.EqualTo(false));
|
||||
Assert.That(converted.InitialRate.Value, Is.EqualTo(1.25));
|
||||
Assert.That(converted.FinalRate.Value, Is.EqualTo(0.25));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -121,11 +124,11 @@ namespace osu.Game.Tests.Online
|
||||
new TestModDifficultyAdjust()
|
||||
};
|
||||
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new System.NotImplementedException();
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new NotImplementedException();
|
||||
|
||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new System.NotImplementedException();
|
||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new NotImplementedException();
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => throw new System.NotImplementedException();
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => throw new NotImplementedException();
|
||||
|
||||
public override string Description { get; } = string.Empty;
|
||||
public override string ShortName { get; } = string.Empty;
|
||||
|
@ -168,19 +168,19 @@ namespace osu.Game.Tests.Online
|
||||
return new TestBeatmapModelManager(this, storage, contextFactory, rulesets, api, host);
|
||||
}
|
||||
|
||||
protected override BeatmapModelDownloader CreateBeatmapModelDownloader(IBeatmapModelManager manager, IAPIProvider api, GameHost host)
|
||||
protected override BeatmapModelDownloader CreateBeatmapModelDownloader(IModelImporter<BeatmapSetInfo> manager, IAPIProvider api, GameHost host)
|
||||
{
|
||||
return new TestBeatmapModelDownloader(manager, api, host);
|
||||
}
|
||||
|
||||
internal class TestBeatmapModelDownloader : BeatmapModelDownloader
|
||||
{
|
||||
public TestBeatmapModelDownloader(IBeatmapModelManager modelManager, IAPIProvider apiProvider, GameHost gameHost)
|
||||
: base(modelManager, apiProvider, gameHost)
|
||||
public TestBeatmapModelDownloader(IModelImporter<BeatmapSetInfo> importer, IAPIProvider apiProvider, GameHost gameHost)
|
||||
: base(importer, apiProvider, gameHost)
|
||||
{
|
||||
}
|
||||
|
||||
protected override ArchiveDownloadRequest<BeatmapSetInfo> CreateDownloadRequest(BeatmapSetInfo set, bool minimiseDownloadSize)
|
||||
protected override ArchiveDownloadRequest<IBeatmapSetInfo> CreateDownloadRequest(IBeatmapSetInfo set, bool minimiseDownloadSize)
|
||||
=> new TestDownloadRequest(set);
|
||||
}
|
||||
|
||||
@ -202,12 +202,12 @@ namespace osu.Game.Tests.Online
|
||||
}
|
||||
}
|
||||
|
||||
private class TestDownloadRequest : ArchiveDownloadRequest<BeatmapSetInfo>
|
||||
private class TestDownloadRequest : ArchiveDownloadRequest<IBeatmapSetInfo>
|
||||
{
|
||||
public new void SetProgress(float progress) => base.SetProgress(progress);
|
||||
public new void TriggerSuccess(string filename) => base.TriggerSuccess(filename);
|
||||
|
||||
public TestDownloadRequest(BeatmapSetInfo model)
|
||||
public TestDownloadRequest(IBeatmapSetInfo model)
|
||||
: base(model)
|
||||
{
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
};
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
})));
|
||||
|
@ -9,17 +9,22 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables.Cards;
|
||||
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.Users;
|
||||
using osuTK;
|
||||
using APIUser = osu.Game.Online.API.Requests.Responses.APIUser;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Beatmaps
|
||||
{
|
||||
public class TestSceneBeatmapCard : OsuTestScene
|
||||
{
|
||||
private DummyAPIAccess dummyAPI => (DummyAPIAccess)API;
|
||||
|
||||
private APIBeatmapSet[] testCases;
|
||||
|
||||
#region Test case generation
|
||||
@ -31,22 +36,51 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
normal.HasVideo = true;
|
||||
normal.HasStoryboard = true;
|
||||
|
||||
var withStatistics = CreateAPIBeatmapSet(Ruleset.Value);
|
||||
withStatistics.Title = withStatistics.TitleUnicode = "play favourite stats";
|
||||
withStatistics.Status = BeatmapSetOnlineStatus.Approved;
|
||||
withStatistics.FavouriteCount = 284_239;
|
||||
withStatistics.PlayCount = 999_001;
|
||||
withStatistics.Ranked = DateTimeOffset.Now.AddDays(-45);
|
||||
withStatistics.HypeStatus = new BeatmapSetHypeStatus
|
||||
{
|
||||
Current = 34,
|
||||
Required = 5
|
||||
};
|
||||
withStatistics.NominationStatus = new BeatmapSetNominationStatus
|
||||
{
|
||||
Current = 1,
|
||||
Required = 2
|
||||
};
|
||||
|
||||
var undownloadable = getUndownloadableBeatmapSet();
|
||||
undownloadable.LastUpdated = DateTimeOffset.Now.AddYears(-1);
|
||||
|
||||
var someDifficulties = getManyDifficultiesBeatmapSet(11);
|
||||
someDifficulties.Title = someDifficulties.TitleUnicode = "favourited";
|
||||
someDifficulties.Title = someDifficulties.TitleUnicode = "some difficulties";
|
||||
someDifficulties.Status = BeatmapSetOnlineStatus.Qualified;
|
||||
someDifficulties.HasFavourited = true;
|
||||
someDifficulties.FavouriteCount = 1;
|
||||
someDifficulties.NominationStatus = new BeatmapSetNominationStatus
|
||||
{
|
||||
Current = 2,
|
||||
Required = 2
|
||||
};
|
||||
|
||||
var manyDifficulties = getManyDifficultiesBeatmapSet(100);
|
||||
manyDifficulties.Status = BeatmapSetOnlineStatus.Pending;
|
||||
|
||||
var explicitMap = CreateAPIBeatmapSet(Ruleset.Value);
|
||||
explicitMap.Title = someDifficulties.TitleUnicode = "explicit beatmap";
|
||||
explicitMap.HasExplicitContent = true;
|
||||
|
||||
var featuredMap = CreateAPIBeatmapSet(Ruleset.Value);
|
||||
featuredMap.Title = someDifficulties.TitleUnicode = "featured artist beatmap";
|
||||
featuredMap.TrackId = 1;
|
||||
|
||||
var explicitFeaturedMap = CreateAPIBeatmapSet(Ruleset.Value);
|
||||
explicitFeaturedMap.Title = someDifficulties.TitleUnicode = "explicit featured artist";
|
||||
explicitFeaturedMap.HasExplicitContent = true;
|
||||
explicitFeaturedMap.TrackId = 2;
|
||||
|
||||
@ -59,6 +93,7 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
testCases = new[]
|
||||
{
|
||||
normal,
|
||||
withStatistics,
|
||||
undownloadable,
|
||||
someDifficulties,
|
||||
manyDifficulties,
|
||||
@ -75,7 +110,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,
|
||||
@ -91,7 +126,7 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
HasVideo = true,
|
||||
HasStoryboard = true,
|
||||
Covers = new BeatmapSetOnlineCovers(),
|
||||
Beatmaps = new List<APIBeatmap>
|
||||
Beatmaps = new[]
|
||||
{
|
||||
new APIBeatmap
|
||||
{
|
||||
@ -120,7 +155,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,
|
||||
@ -128,12 +163,25 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
HasVideo = true,
|
||||
HasStoryboard = true,
|
||||
Covers = new BeatmapSetOnlineCovers(),
|
||||
Beatmaps = beatmaps,
|
||||
Beatmaps = beatmaps.ToArray(),
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
AddStep("register request handling", () => dummyAPI.HandleRequest = request =>
|
||||
{
|
||||
if (!(request is PostBeatmapFavouriteRequest))
|
||||
return false;
|
||||
|
||||
request.TriggerSuccess();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
private Drawable createContent(OverlayColourScheme colourScheme, Func<APIBeatmapSet, Drawable> creationFunc)
|
||||
{
|
||||
var colourProvider = new OverlayColourProvider(colourScheme);
|
||||
|
@ -0,0 +1,86 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps.Drawables.Cards.Buttons;
|
||||
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.Resources.Localisation.Web;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Beatmaps
|
||||
{
|
||||
public class TestSceneBeatmapCardFavouriteButton : OsuManualInputManagerTestScene
|
||||
{
|
||||
private DummyAPIAccess dummyAPI => (DummyAPIAccess)API;
|
||||
|
||||
[Cached]
|
||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||
|
||||
[Test]
|
||||
public void TestInitialState([Values] bool favourited)
|
||||
{
|
||||
APIBeatmapSet beatmapSetInfo = null;
|
||||
FavouriteButton button = null;
|
||||
|
||||
AddStep("create beatmap set", () =>
|
||||
{
|
||||
beatmapSetInfo = CreateAPIBeatmapSet(Ruleset.Value);
|
||||
beatmapSetInfo.HasFavourited = favourited;
|
||||
});
|
||||
AddStep("create button", () => Child = button = new FavouriteButton(beatmapSetInfo) { Scale = new Vector2(2) });
|
||||
|
||||
assertCorrectIcon(favourited);
|
||||
AddAssert("correct tooltip text", () => button.TooltipText == (favourited ? BeatmapsetsStrings.ShowDetailsUnfavourite : BeatmapsetsStrings.ShowDetailsFavourite));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRequestHandling()
|
||||
{
|
||||
APIBeatmapSet beatmapSetInfo = null;
|
||||
FavouriteButton button = null;
|
||||
BeatmapFavouriteAction? lastRequestAction = null;
|
||||
|
||||
AddStep("create beatmap set", () => beatmapSetInfo = CreateAPIBeatmapSet(Ruleset.Value));
|
||||
AddStep("create button", () => Child = button = new FavouriteButton(beatmapSetInfo) { Scale = new Vector2(2) });
|
||||
|
||||
assertCorrectIcon(false);
|
||||
|
||||
AddStep("register request handling", () => dummyAPI.HandleRequest = request =>
|
||||
{
|
||||
if (!(request is PostBeatmapFavouriteRequest favouriteRequest))
|
||||
return false;
|
||||
|
||||
lastRequestAction = favouriteRequest.Action;
|
||||
request.TriggerSuccess();
|
||||
return true;
|
||||
});
|
||||
|
||||
AddStep("click icon", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(button);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
AddUntilStep("favourite request sent", () => lastRequestAction == BeatmapFavouriteAction.Favourite);
|
||||
assertCorrectIcon(true);
|
||||
|
||||
AddStep("click icon", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(button);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
AddUntilStep("unfavourite request sent", () => lastRequestAction == BeatmapFavouriteAction.UnFavourite);
|
||||
assertCorrectIcon(false);
|
||||
}
|
||||
|
||||
private void assertCorrectIcon(bool favourited) => AddAssert("icon correct",
|
||||
() => this.ChildrenOfType<SpriteIcon>().Single().Icon.Equals(favourited ? FontAwesome.Solid.Heart : FontAwesome.Regular.Heart));
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
{
|
||||
RulesetID = difficulty.rulesetId,
|
||||
StarRating = difficulty.stars
|
||||
}).ToList()
|
||||
}).ToArray()
|
||||
};
|
||||
|
||||
[Test]
|
||||
|
@ -5,7 +5,10 @@ using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
@ -29,6 +32,9 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
private ComposeBlueprintContainer blueprintContainer
|
||||
=> Editor.ChildrenOfType<ComposeBlueprintContainer>().First();
|
||||
|
||||
private ContextMenuContainer contextMenuContainer
|
||||
=> Editor.ChildrenOfType<ContextMenuContainer>().First();
|
||||
|
||||
private void moveMouseToObject(Func<HitObject> targetFunc)
|
||||
{
|
||||
AddStep("move mouse to object", () =>
|
||||
@ -42,6 +48,19 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSelectAndShowContextMenu()
|
||||
{
|
||||
var addedObject = new HitCircle { StartTime = 100, Position = new Vector2(100, 100) };
|
||||
AddStep("add hitobject", () => EditorBeatmap.Add(addedObject));
|
||||
|
||||
moveMouseToObject(() => addedObject);
|
||||
AddStep("right click", () => InputManager.Click(MouseButton.Right));
|
||||
|
||||
AddUntilStep("hitobject selected", () => EditorBeatmap.SelectedHitObjects.Single() == addedObject);
|
||||
AddUntilStep("context menu is visible", () => contextMenuContainer.ChildrenOfType<OsuContextMenu>().Single().State == MenuState.Open);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNudgeSelection()
|
||||
{
|
||||
|
@ -23,10 +23,10 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddStep("set metadata", () =>
|
||||
{
|
||||
editorBeatmap.Metadata.Artist = "Example Artist";
|
||||
editorBeatmap.Metadata.ArtistUnicode = null;
|
||||
editorBeatmap.Metadata.ArtistUnicode = string.Empty;
|
||||
|
||||
editorBeatmap.Metadata.Title = "Example Title";
|
||||
editorBeatmap.Metadata.TitleUnicode = null;
|
||||
editorBeatmap.Metadata.TitleUnicode = string.Empty;
|
||||
});
|
||||
|
||||
createSection();
|
||||
@ -44,10 +44,10 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddStep("set metadata", () =>
|
||||
{
|
||||
editorBeatmap.Metadata.ArtistUnicode = "*なみりん";
|
||||
editorBeatmap.Metadata.Artist = null;
|
||||
editorBeatmap.Metadata.Artist = string.Empty;
|
||||
|
||||
editorBeatmap.Metadata.TitleUnicode = "コイシテイク・プラネット";
|
||||
editorBeatmap.Metadata.Title = null;
|
||||
editorBeatmap.Metadata.Title = string.Empty;
|
||||
});
|
||||
|
||||
createSection();
|
||||
@ -86,10 +86,10 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddStep("set metadata", () =>
|
||||
{
|
||||
editorBeatmap.Metadata.ArtistUnicode = "*なみりん";
|
||||
editorBeatmap.Metadata.Artist = null;
|
||||
editorBeatmap.Metadata.Artist = string.Empty;
|
||||
|
||||
editorBeatmap.Metadata.TitleUnicode = "コイシテイク・プラネット";
|
||||
editorBeatmap.Metadata.Title = null;
|
||||
editorBeatmap.Metadata.Title = string.Empty;
|
||||
});
|
||||
|
||||
createSection();
|
||||
|
@ -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);
|
||||
|
@ -235,8 +235,17 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
public override IEnumerable<HitObject> Objects => new[] { new HitCircle { HitWindows = HitWindows } };
|
||||
|
||||
public override event Action<JudgementResult> NewResult;
|
||||
public override event Action<JudgementResult> RevertResult;
|
||||
public override event Action<JudgementResult> NewResult
|
||||
{
|
||||
add => throw new InvalidOperationException();
|
||||
remove => throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
public override event Action<JudgementResult> 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();
|
||||
|
@ -7,15 +7,16 @@ 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;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
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
|
||||
{
|
||||
@ -113,6 +114,36 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
private ScoreManager scoreManager { get; set; }
|
||||
|
||||
[Test]
|
||||
public void TestScoreImportThenDelete()
|
||||
{
|
||||
ILive<ScoreInfo> imported = null;
|
||||
|
||||
AddStep("create button without replay", () =>
|
||||
{
|
||||
Child = downloadButton = new TestReplayDownloadButton(getScoreInfo(false))
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
});
|
||||
|
||||
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
|
||||
|
||||
AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);
|
||||
|
||||
AddStep("import score", () => imported = scoreManager.Import(getScoreInfo(true)).Result);
|
||||
|
||||
AddUntilStep("state is available", () => downloadButton.State.Value == DownloadState.LocallyAvailable);
|
||||
|
||||
AddStep("delete score", () => scoreManager.Delete(imported.Value));
|
||||
|
||||
AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateButtonWithNoScore()
|
||||
{
|
||||
@ -139,7 +170,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",
|
||||
|
@ -54,7 +54,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
ScoreInfo = { BeatmapInfo = gameplayState.Beatmap.BeatmapInfo }
|
||||
})
|
||||
{
|
||||
ScreenSpaceToGamefield = pos => recordingManager.ToLocalSpace(pos)
|
||||
ScreenSpaceToGamefield = pos => recordingManager?.ToLocalSpace(pos) ?? Vector2.Zero,
|
||||
},
|
||||
Child = new Container
|
||||
{
|
||||
@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
ReplayInputHandler = new TestFramedReplayInputHandler(replay)
|
||||
{
|
||||
GamefieldToScreenSpace = pos => playbackManager.ToScreenSpace(pos),
|
||||
GamefieldToScreenSpace = pos => playbackManager?.ToScreenSpace(pos) ?? Vector2.Zero,
|
||||
},
|
||||
Child = new Container
|
||||
{
|
||||
|
@ -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();
|
||||
|
@ -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"
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
@ -67,6 +67,36 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
}
|
||||
}),
|
||||
createLoungeRoom(new Room
|
||||
{
|
||||
Name = { Value = "Multiplayer room" },
|
||||
Status = { Value = new RoomStatusOpen() },
|
||||
EndDate = { Value = DateTimeOffset.Now.AddDays(1) },
|
||||
Type = { Value = MatchType.HeadToHead },
|
||||
Playlist =
|
||||
{
|
||||
new PlaylistItem
|
||||
{
|
||||
Beatmap =
|
||||
{
|
||||
Value = new TestBeatmap(new OsuRuleset().RulesetInfo)
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
StarDifficulty = 2.5,
|
||||
Metadata =
|
||||
{
|
||||
Artist = "very very very very very very very very very long artist",
|
||||
ArtistUnicode = "very very very very very very very very very long artist",
|
||||
Title = "very very very very very very very very very very very long title",
|
||||
TitleUnicode = "very very very very very very very very very very very long title",
|
||||
}
|
||||
}
|
||||
}.BeatmapInfo,
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
createLoungeRoom(new Room
|
||||
{
|
||||
Name = { Value = "Playlist room with multiple beatmaps" },
|
||||
Status = { Value = new RoomStatusPlaying() },
|
||||
@ -144,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}"
|
||||
|
@ -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}"
|
||||
|
@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
@ -13,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;
|
||||
@ -20,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;
|
||||
|
||||
@ -223,11 +224,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[Test]
|
||||
public void TestDownloadButtonVisibleInitiallyWhenBeatmapDoesNotExist()
|
||||
{
|
||||
var byOnlineId = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo;
|
||||
byOnlineId.BeatmapSet.OnlineBeatmapSetID = 1337; // Some random ID that does not exist locally.
|
||||
var byOnlineId = CreateAPIBeatmap();
|
||||
byOnlineId.OnlineID = 1337; // Some random ID that does not exist locally.
|
||||
|
||||
var byChecksum = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo;
|
||||
byChecksum.MD5Hash = "1337"; // Some random checksum that does not exist locally.
|
||||
var byChecksum = CreateAPIBeatmap();
|
||||
byChecksum.Checksum = "1337"; // Some random checksum that does not exist locally.
|
||||
|
||||
createPlaylist(byOnlineId, byChecksum);
|
||||
|
||||
@ -237,8 +238,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[Test]
|
||||
public void TestExplicitBeatmapItem()
|
||||
{
|
||||
var beatmap = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo;
|
||||
beatmap.BeatmapSet.OnlineInfo.HasExplicitContent = true;
|
||||
var beatmap = CreateAPIBeatmap();
|
||||
|
||||
Debug.Assert(beatmap.BeatmapSet != null);
|
||||
|
||||
beatmap.BeatmapSet.HasExplicitContent = true;
|
||||
|
||||
createPlaylist(beatmap);
|
||||
}
|
||||
@ -290,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()
|
||||
@ -310,7 +314,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddUntilStep("wait for items to load", () => playlist.ItemMap.Values.All(i => i.IsLoaded));
|
||||
}
|
||||
|
||||
private void createPlaylist(params BeatmapInfo[] beatmaps)
|
||||
private void createPlaylist(params IBeatmapInfo[] beatmaps)
|
||||
{
|
||||
AddStep("create playlist", () =>
|
||||
{
|
||||
|
@ -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,
|
||||
|
@ -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 });
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
});
|
||||
|
@ -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[]
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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);
|
||||
});
|
||||
|
||||
|
@ -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<ParticipantPanel>().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",
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
});
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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 }
|
||||
|
@ -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<User> localUser;
|
||||
private IBindable<APIUser> localUser;
|
||||
|
||||
public TestSceneAccountCreationOverlay()
|
||||
{
|
||||
|
@ -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,
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
@ -37,7 +36,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
selector.BeatmapSet = new APIBeatmapSet
|
||||
{
|
||||
Beatmaps = enabledRulesets.Select(r => new APIBeatmap { RulesetID = r.OnlineID }).ToList()
|
||||
Beatmaps = enabledRulesets.Select(r => new APIBeatmap { RulesetID = r.OnlineID }).ToArray()
|
||||
};
|
||||
});
|
||||
|
||||
@ -55,7 +54,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
selector.BeatmapSet = new APIBeatmapSet
|
||||
{
|
||||
Beatmaps = new List<APIBeatmap>
|
||||
Beatmaps = new[]
|
||||
{
|
||||
new APIBeatmap
|
||||
{
|
||||
@ -71,10 +70,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Test]
|
||||
public void TestEmptyBeatmapSet()
|
||||
{
|
||||
AddStep("load empty beatmapset", () => selector.BeatmapSet = new APIBeatmapSet
|
||||
{
|
||||
Beatmaps = new List<APIBeatmap>()
|
||||
});
|
||||
AddStep("load empty beatmapset", () => selector.BeatmapSet = new APIBeatmapSet());
|
||||
|
||||
AddAssert("no ruleset selected", () => selector.SelectedTab == null);
|
||||
AddAssert("all rulesets disabled", () => selector.TabContainer.TabItems.All(t => !t.Enabled.Value));
|
||||
|
@ -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,
|
||||
@ -71,7 +71,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Ratings = Enumerable.Range(0, 11).ToArray(),
|
||||
HasStoryboard = true,
|
||||
Covers = new BeatmapSetOnlineCovers(),
|
||||
Beatmaps = new List<APIBeatmap>
|
||||
Beatmaps = new[]
|
||||
{
|
||||
new APIBeatmap
|
||||
{
|
||||
@ -145,7 +145,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
var set = getBeatmapSet();
|
||||
|
||||
set.Beatmaps = beatmaps;
|
||||
set.Beatmaps = beatmaps.ToArray();
|
||||
|
||||
overlay.ShowBeatmapSet(set);
|
||||
});
|
||||
@ -211,7 +211,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
});
|
||||
}
|
||||
|
||||
set.Beatmaps = beatmaps;
|
||||
set.Beatmaps = beatmaps.ToArray();
|
||||
|
||||
return set;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
@ -46,7 +45,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
static APIBeatmapSet createSet() => new APIBeatmapSet
|
||||
{
|
||||
Beatmaps = new List<APIBeatmap>
|
||||
Beatmaps = new[]
|
||||
{
|
||||
new APIBeatmap
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
|
@ -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<User> ComputeValueAsync(int lookup, CancellationToken token = default)
|
||||
protected override Task<APIUser> ComputeValueAsync(int lookup, CancellationToken token = default)
|
||||
{
|
||||
// tests against failed lookups
|
||||
if (lookup == 13)
|
||||
return Task.FromResult<User>(null);
|
||||
return Task.FromResult<APIUser>(null);
|
||||
|
||||
return Task.FromResult(new User
|
||||
return Task.FromResult(new APIUser
|
||||
{
|
||||
Id = lookup,
|
||||
Username = usernames[lookup % usernames.Length],
|
||||
|
@ -9,7 +9,6 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Online;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays.BeatmapListing.Panels;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Tests.Resources;
|
||||
using osuTK;
|
||||
|
||||
@ -46,10 +45,10 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddStep("import soleily", () => beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()));
|
||||
|
||||
AddUntilStep("wait for beatmap import", () => beatmaps.GetAllUsableBeatmapSets().Any(b => b.OnlineBeatmapSetID == 241526));
|
||||
AddAssert("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable);
|
||||
AddUntilStep("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable);
|
||||
|
||||
createButtonWithBeatmap(createSoleily());
|
||||
AddAssert("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable);
|
||||
AddUntilStep("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable);
|
||||
ensureSoleilyRemoved();
|
||||
AddAssert("button state not downloaded", () => downloadButton.DownloadState == DownloadState.NotDownloaded);
|
||||
}
|
||||
@ -110,7 +109,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
private IBeatmapSetInfo getDownloadableBeatmapSet()
|
||||
{
|
||||
var apiBeatmapSet = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).BeatmapSetInfo.OnlineInfo;
|
||||
var apiBeatmapSet = CreateAPIBeatmapSet();
|
||||
|
||||
apiBeatmapSet.HasVideo = true;
|
||||
apiBeatmapSet.HasStoryboard = true;
|
||||
@ -120,7 +119,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
private IBeatmapSetInfo getUndownloadableBeatmapSet()
|
||||
{
|
||||
var apiBeatmapSet = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).BeatmapSetInfo.OnlineInfo;
|
||||
var apiBeatmapSet = CreateAPIBeatmapSet();
|
||||
|
||||
apiBeatmapSet.Artist = "test";
|
||||
apiBeatmapSet.Title = "undownloadable";
|
||||
|
@ -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,
|
||||
@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
HasVideo = true,
|
||||
HasStoryboard = true,
|
||||
Covers = new BeatmapSetOnlineCovers(),
|
||||
Beatmaps = new List<APIBeatmap>
|
||||
Beatmaps = new[]
|
||||
{
|
||||
new APIBeatmap
|
||||
{
|
||||
@ -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,
|
||||
@ -129,7 +129,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
HasVideo = true,
|
||||
HasStoryboard = true,
|
||||
Covers = new BeatmapSetOnlineCovers(),
|
||||
Beatmaps = beatmaps,
|
||||
Beatmaps = beatmaps.ToArray(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -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<User> getUsers() => new List<User>
|
||||
private List<APIUser> getUsers() => new List<APIUser>
|
||||
{
|
||||
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,
|
||||
|
@ -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 });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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<User>
|
||||
Users = new List<APIUser>
|
||||
{
|
||||
new User
|
||||
new APIUser
|
||||
{
|
||||
Id = 1,
|
||||
Username = "Good_Admin"
|
||||
|
@ -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> user = new Bindable<User>();
|
||||
private readonly Bindable<APIUser> user = new Bindable<APIUser>();
|
||||
private readonly PlayHistorySubsection section;
|
||||
|
||||
public TestScenePlayHistorySubsection()
|
||||
@ -101,80 +100,80 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
private int getChartValuesLength() => this.ChildrenOfType<ProfileLineChart>().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<UserHistoryCount>()
|
||||
MonthlyPlaycounts = Array.Empty<APIUserHistoryCount>()
|
||||
};
|
||||
|
||||
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 }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -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<User>();
|
||||
var user = new Bindable<APIUser>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -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,
|
||||
|
@ -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<UserHistoryCount>());
|
||||
AddStep("Set empty values", () => graph.Values = Array.Empty<APIUserHistoryCount>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user