1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 13:25:35 +08:00

Merge branch 'master' into fix-spectator-seeks

This commit is contained in:
Dan Balasescu 2022-04-14 18:54:52 +09:00
commit 9de4d416e2
25 changed files with 85 additions and 50 deletions

View File

@ -9,7 +9,7 @@
]
},
"jetbrains.resharper.globaltools": {
"version": "2020.3.2",
"version": "2022.1.0-eap10",
"commands": [
"jb"
]
@ -33,4 +33,4 @@
]
}
}
}
}

View File

@ -120,6 +120,12 @@ jobs:
- name: Restore Packages
run: dotnet restore
- name: Restore inspectcode cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/inspectcode
key: inspectcode-${{ hashFiles('.config/dotnet-tools.json') }}-${{ hashFiles('.github/workflows/ci.yml' ) }}
- name: CodeFileSanity
run: |
# TODO: Add ignore filters and GitHub Workflow Command Reporting in CFS. That way we don't have to do this workaround.
@ -138,7 +144,7 @@ jobs:
# run: dotnet format --dry-run --check
- name: InspectCode
run: dotnet jb inspectcode $(pwd)/osu.Desktop.slnf --output=$(pwd)/inspectcodereport.xml --cachesDir=$(pwd)/inspectcode --verbosity=WARN
run: dotnet jb inspectcode $(pwd)/osu.Desktop.slnf --no-build --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN
- name: NVika
run: dotnet nvika parsereport "${{github.workspace}}/inspectcodereport.xml" --treatwarningsaserrors

View File

@ -5,7 +5,7 @@ dotnet tool restore
# - cmd: dotnet format --dry-run --check
dotnet CodeFileSanity
dotnet jb inspectcode "osu.Desktop.slnf" --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN
dotnet jb inspectcode "osu.Desktop.slnf" --no-build --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN
dotnet nvika parsereport "inspectcodereport.xml" --treatwarningsaserrors
exit $LASTEXITCODE

View File

@ -2,5 +2,5 @@
dotnet tool restore
dotnet CodeFileSanity
dotnet jb inspectcode "osu.Desktop.slnf" --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN
dotnet jb inspectcode "osu.Desktop.slnf" --no-build --output="inspectcodereport.xml" --caches-home="inspectcode" --verbosity=WARN
dotnet nvika parsereport "inspectcodereport.xml" --treatwarningsaserrors

View File

@ -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 System.Linq;
using osu.Game.Beatmaps;
@ -25,6 +26,6 @@ namespace osu.Game.Rulesets.EmptyFreeform
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Enumerable.Empty<DifficultyHitObject>();
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => new Skill[0];
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => Array.Empty<Skill>();
}
}

View File

@ -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 System.Linq;
using osu.Game.Beatmaps;
@ -25,6 +26,6 @@ namespace osu.Game.Rulesets.Pippidon
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Enumerable.Empty<DifficultyHitObject>();
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => new Skill[0];
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => Array.Empty<Skill>();
}
}

View File

@ -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 System.Linq;
using osu.Game.Beatmaps;
@ -25,6 +26,6 @@ namespace osu.Game.Rulesets.EmptyScrolling
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Enumerable.Empty<DifficultyHitObject>();
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => new Skill[0];
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => Array.Empty<Skill>();
}
}

View File

@ -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 System.Linq;
using osu.Game.Beatmaps;
@ -25,6 +26,6 @@ namespace osu.Game.Rulesets.Pippidon
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Enumerable.Empty<DifficultyHitObject>();
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => new Skill[0];
protected override Skill[] CreateSkills(IBeatmap beatmap, Mod[] mods, double clockRate) => Array.Empty<Skill>();
}
}

View File

@ -28,9 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
// flying hits all land in one common scrolling container (and stay there for rewind purposes),
// so we need to manually get the latest one.
flyingHit = this.ChildrenOfType<DrawableFlyingHit>()
.OrderByDescending(h => h.HitObject.StartTime)
.FirstOrDefault();
flyingHit = this.ChildrenOfType<DrawableFlyingHit>().MaxBy(h => h.HitObject.StartTime);
});
AddAssert("hit type is correct", () => flyingHit.HitObject.Type == hitType);

View File

@ -33,9 +33,10 @@ namespace osu.Game.Tests.Online
var converted = deserialized?.ToMod(new TestRuleset());
Assert.NotNull(converted);
Assert.That(converted, Is.TypeOf(typeof(UnknownMod)));
Assert.That(converted?.Type, Is.EqualTo(ModType.System));
Assert.That(converted?.Acronym, Is.EqualTo("WNG??"));
Assert.That(converted.Type, Is.EqualTo(ModType.System));
Assert.That(converted.Acronym, Is.EqualTo("WNG??"));
}
[Test]

View File

@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddUntilStep("get variables", () =>
{
sampleDisabler = Player;
slider = Player.ChildrenOfType<DrawableSlider>().OrderBy(s => s.HitObject.StartTime).FirstOrDefault();
slider = Player.ChildrenOfType<DrawableSlider>().MinBy(s => s.HitObject.StartTime);
samples = slider?.ChildrenOfType<PoolableSkinnableSample>().ToArray();
return slider != null;

View File

@ -26,6 +26,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[TestFixture]
public class TestSceneReplayDownloadButton : OsuManualInputManagerTestScene
{
private const long online_score_id = 2553163309;
[Resolved]
private RulesetStore rulesets { get; set; }
@ -43,6 +45,15 @@ namespace osu.Game.Tests.Visual.Gameplay
beatmapManager.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely();
}
[SetUpSteps]
public void SetUpSteps()
{
AddStep("delete previous imports", () =>
{
scoreManager.Delete(s => s.OnlineID == online_score_id);
});
}
[Test]
public void TestDisplayStates()
{
@ -180,7 +191,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
return new APIScore
{
OnlineID = 2553163309,
OnlineID = online_score_id,
RulesetID = 0,
Beatmap = CreateAPIBeatmapSet(new OsuRuleset().RulesetInfo).Beatmaps.First(),
HasReplay = replayAvailable,

View File

@ -27,6 +27,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
public abstract class MultiplayerGameplayLeaderboardTestScene : OsuTestScene
{
private const int total_users = 16;
protected readonly BindableList<MultiplayerRoomUser> MultiplayerUsers = new BindableList<MultiplayerRoomUser>();
protected MultiplayerGameplayLeaderboard Leaderboard { get; private set; }
@ -84,7 +86,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
[SetUpSteps]
public virtual void SetUpSteps()
{
AddStep("reset counts", () => spectatorClient.Invocations.Clear());
AddStep("reset counts", () =>
{
spectatorClient.Invocations.Clear();
lastHeaders.Clear();
});
AddStep("set local user", () => ((DummyAPIAccess)API).LocalUser.Value = new APIUser
{
@ -94,7 +100,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddStep("populate users", () =>
{
MultiplayerUsers.Clear();
for (int i = 0; i < 16; i++)
for (int i = 0; i < total_users; i++)
MultiplayerUsers.Add(CreateUser(i));
});

View File

@ -3,7 +3,6 @@
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Utils;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
using osu.Game.Rulesets.Osu.Scoring;
@ -14,12 +13,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
public class TestSceneMultiplayerGameplayLeaderboardTeams : MultiplayerGameplayLeaderboardTestScene
{
private int team;
protected override MultiplayerRoomUser CreateUser(int userId)
{
var user = base.CreateUser(userId);
user.MatchState = new TeamVersusUserState
{
TeamID = RNG.Next(0, 2)
TeamID = team++ % 2
};
return user;
}

View File

@ -26,10 +26,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
var beatmapInfo = CreateBeatmap(rulesetInfo).BeatmapInfo;
var score = TestResources.CreateTestScoreInfo(beatmapInfo);
SortedDictionary<int, BindableInt> teamScores = new SortedDictionary<int, BindableInt>
SortedDictionary<int, BindableLong> teamScores = new SortedDictionary<int, BindableLong>
{
{ 0, new BindableInt(team1Score) },
{ 1, new BindableInt(team2Score) }
{ 0, new BindableLong(team1Score) },
{ 1, new BindableLong(team2Score) }
};
Stack.Push(screen = new MultiplayerTeamResultsScreen(score, 1, new PlaylistItem(beatmapInfo), teamScores));

View File

@ -36,11 +36,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
bool progressionToRight = q2.TopLeft.X > q1.TopLeft.X;
if (!progressionToRight)
{
var temp = q2;
q2 = q1;
q1 = temp;
}
(q2, q1) = (q1, q2);
var c1 = getCenteredVector(q1.TopRight, q1.BottomRight) + new Vector2(padding, 0);
var c2 = getCenteredVector(q2.TopLeft, q2.BottomLeft) - new Vector2(padding, 0);

View File

@ -70,7 +70,10 @@ namespace osu.Game.Graphics.Containers
confirming = false;
Fired = false;
this.TransformBindableTo(Progress, 0, fadeout_delay, Easing.Out);
this
.TransformBindableTo(Progress, Progress.Value)
.Delay(200)
.TransformBindableTo(Progress, 0, fadeout_delay, Easing.InSine);
}
}
}

View File

@ -47,7 +47,10 @@ namespace osu.Game.Online
Downloader.DownloadBegan += downloadBegan;
Downloader.DownloadFailed += downloadFailed;
realmSubscription = realm.RegisterForNotifications(r => r.All<ScoreInfo>().Where(s => ((s.OnlineID > 0 && s.OnlineID == TrackedItem.OnlineID) || s.Hash == TrackedItem.Hash) && !s.DeletePending), (items, changes, ___) =>
realmSubscription = realm.RegisterForNotifications(r => r.All<ScoreInfo>().Where(s =>
((s.OnlineID > 0 && s.OnlineID == TrackedItem.OnlineID)
|| (!string.IsNullOrEmpty(s.Hash) && s.Hash == TrackedItem.Hash))
&& !s.DeletePending), (items, changes, ___) =>
{
if (items.Any())
Schedule(() => UpdateState(DownloadState.LocallyAvailable));

View File

@ -253,7 +253,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
noScoresPlaceholder.Hide();
if (Beatmap.Value == null || Beatmap.Value.OnlineID <= 0 || (Beatmap.Value?.BeatmapSet as IBeatmapSetOnlineInfo)?.Status <= BeatmapOnlineStatus.Pending)
if (Beatmap.Value == null || Beatmap.Value.OnlineID <= 0 || (Beatmap.Value.BeatmapSet as IBeatmapSetOnlineInfo)?.Status <= BeatmapOnlineStatus.Pending)
{
Scores = null;
Hide();

View File

@ -24,12 +24,12 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
{
public class MultiplayerTeamResultsScreen : MultiplayerResultsScreen
{
private readonly SortedDictionary<int, BindableInt> teamScores;
private readonly SortedDictionary<int, BindableLong> teamScores;
private Container winnerBackground;
private Drawable winnerText;
public MultiplayerTeamResultsScreen(ScoreInfo score, long roomId, PlaylistItem playlistItem, SortedDictionary<int, BindableInt> teamScores)
public MultiplayerTeamResultsScreen(ScoreInfo score, long roomId, PlaylistItem playlistItem, SortedDictionary<int, BindableLong> teamScores)
: base(score, roomId, playlistItem)
{
if (teamScores.Count != 2)

View File

@ -106,7 +106,7 @@ namespace osu.Game.Screens.Play
new Sprite
{
RelativeSizeAxes = Axes.Both,
Texture = beatmap?.Background,
Texture = beatmap.Background,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
FillMode = FillMode.Fill,
@ -126,7 +126,7 @@ namespace osu.Game.Screens.Play
{
new OsuSpriteText
{
Text = beatmap?.BeatmapInfo?.DifficultyName,
Text = beatmap.BeatmapInfo.DifficultyName,
Font = OsuFont.GetFont(size: 26, italics: true),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,

View File

@ -19,8 +19,8 @@ namespace osu.Game.Screens.Play.HUD
private const float bar_height = 18;
private const float font_size = 50;
public BindableInt Team1Score = new BindableInt();
public BindableInt Team2Score = new BindableInt();
public BindableLong Team1Score = new BindableLong();
public BindableLong Team2Score = new BindableLong();
protected MatchScoreCounter Score1Text;
protected MatchScoreCounter Score2Text;
@ -133,7 +133,7 @@ namespace osu.Game.Screens.Play.HUD
var winningBar = Team1Score.Value > Team2Score.Value ? score1Bar : score2Bar;
var losingBar = Team1Score.Value <= Team2Score.Value ? score1Bar : score2Bar;
int diff = Math.Max(Team1Score.Value, Team2Score.Value) - Math.Min(Team1Score.Value, Team2Score.Value);
long diff = Math.Max(Team1Score.Value, Team2Score.Value) - Math.Min(Team1Score.Value, Team2Score.Value);
losingBar.ResizeWidthTo(0, 400, Easing.OutQuint);
winningBar.ResizeWidthTo(Math.Min(0.4f, MathF.Pow(diff / 1500000f, 0.5f) / 2), 400, Easing.OutQuint);

View File

@ -29,7 +29,7 @@ namespace osu.Game.Screens.Play.HUD
{
protected readonly Dictionary<int, TrackedUserData> UserScores = new Dictionary<int, TrackedUserData>();
public readonly SortedDictionary<int, BindableInt> TeamScores = new SortedDictionary<int, BindableInt>();
public readonly SortedDictionary<int, BindableLong> TeamScores = new SortedDictionary<int, BindableLong>();
[Resolved]
private OsuColour colours { get; set; }
@ -75,21 +75,27 @@ namespace osu.Game.Screens.Play.HUD
foreach (var user in playingUsers)
{
var trackedUser = CreateUserData(user, ruleset, scoreProcessor);
trackedUser.ScoringMode.BindTo(scoringMode);
trackedUser.Score.BindValueChanged(_ => Scheduler.AddOnce(updateTotals));
UserScores[user.UserID] = trackedUser;
if (trackedUser.Team is int team && !TeamScores.ContainsKey(team))
TeamScores.Add(team, new BindableInt());
TeamScores.Add(team, new BindableLong());
}
userLookupCache.GetUsersAsync(playingUsers.Select(u => u.UserID).ToArray()).ContinueWith(task => Schedule(() =>
{
var users = task.GetResultSafely();
foreach (var user in users)
for (int i = 0; i < users.Length; i++)
{
if (user == null)
continue;
var user = users[i] ?? new APIUser
{
Id = playingUsers[i].UserID,
Username = "Unknown user",
};
var trackedUser = UserScores[user.Id];
@ -175,8 +181,6 @@ namespace osu.Game.Screens.Play.HUD
trackedData.Frames.Add(new TimedFrame(bundle.Frames.First().Time, bundle.Header));
trackedData.UpdateScore();
updateTotals();
});
private void updateTotals()

View File

@ -351,8 +351,7 @@ namespace osu.Game.Stores
using (var transaction = realm.BeginWrite())
{
if (existing.DeletePending)
UndeleteForReuse(existing);
UndeleteForReuse(existing);
transaction.Commit();
}
@ -388,9 +387,7 @@ namespace osu.Game.Stores
{
LogForModel(item, @$"Found existing {HumanisedModelName} for {item} (ID {existing.ID}) skipping import.");
if (existing.DeletePending)
UndeleteForReuse(existing);
UndeleteForReuse(existing);
transaction.Commit();
return existing.ToLive(Realm);
@ -536,6 +533,10 @@ namespace osu.Game.Stores
/// <param name="existing">The existing model.</param>
protected virtual void UndeleteForReuse(TModel existing)
{
if (!existing.DeletePending)
return;
LogForModel(existing, $@"Existing {HumanisedModelName}'s deletion flag has been removed to allow for reuse.");
existing.DeletePending = false;
}

View File

@ -118,6 +118,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MissingLinebreak/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MissingSpace/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MoreSpecificForeachVariableTypeAvailable/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MoveVariableDeclarationInsideLoopCondition/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MultipleSpaces/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MultipleStatementsOnOneLine/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MultipleTypeMembersOnOneLine/@EntryIndexedValue">WARNING</s:String>