mirror of
https://github.com/ppy/osu
synced 2025-01-03 12:52:10 +00:00
Use OnlineID
for set operations
This commit is contained in:
parent
7ac63485ef
commit
dbb08f7d46
@ -1022,7 +1022,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
{
|
{
|
||||||
return ImportScoreTest.LoadScoreIntoOsu(osu, new ScoreInfo
|
return ImportScoreTest.LoadScoreIntoOsu(osu, new ScoreInfo
|
||||||
{
|
{
|
||||||
OnlineScoreID = 2,
|
OnlineID = 2,
|
||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
BeatmapInfoID = beatmapInfo.ID
|
BeatmapInfoID = beatmapInfo.ID
|
||||||
}, new ImportScoreTest.TestArchiveReader());
|
}, new ImportScoreTest.TestArchiveReader());
|
||||||
|
@ -809,7 +809,7 @@ namespace osu.Game.Tests.Database
|
|||||||
// TODO: reimplement when we have score support in realm.
|
// TODO: reimplement when we have score support in realm.
|
||||||
// return ImportScoreTest.LoadScoreIntoOsu(osu, new ScoreInfo
|
// return ImportScoreTest.LoadScoreIntoOsu(osu, new ScoreInfo
|
||||||
// {
|
// {
|
||||||
// OnlineScoreID = 2,
|
// OnlineID = 2,
|
||||||
// Beatmap = beatmap,
|
// Beatmap = beatmap,
|
||||||
// BeatmapInfoID = beatmap.ID
|
// BeatmapInfoID = beatmap.ID
|
||||||
// }, new ImportScoreTest.TestArchiveReader());
|
// }, new ImportScoreTest.TestArchiveReader());
|
||||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Tests.Scores.IO
|
|||||||
Combo = 250,
|
Combo = 250,
|
||||||
User = new APIUser { Username = "Test user" },
|
User = new APIUser { Username = "Test user" },
|
||||||
Date = DateTimeOffset.Now,
|
Date = DateTimeOffset.Now,
|
||||||
OnlineScoreID = 12345,
|
OnlineID = 12345,
|
||||||
};
|
};
|
||||||
|
|
||||||
var imported = await LoadScoreIntoOsu(osu, toImport);
|
var imported = await LoadScoreIntoOsu(osu, toImport);
|
||||||
@ -163,12 +163,12 @@ namespace osu.Game.Tests.Scores.IO
|
|||||||
{
|
{
|
||||||
var osu = LoadOsuIntoHost(host, true);
|
var osu = LoadOsuIntoHost(host, true);
|
||||||
|
|
||||||
await LoadScoreIntoOsu(osu, new ScoreInfo { OnlineScoreID = 2 }, new TestArchiveReader());
|
await LoadScoreIntoOsu(osu, new ScoreInfo { OnlineID = 2 }, new TestArchiveReader());
|
||||||
|
|
||||||
var scoreManager = osu.Dependencies.Get<ScoreManager>();
|
var scoreManager = osu.Dependencies.Get<ScoreManager>();
|
||||||
|
|
||||||
// Note: A new score reference is used here since the import process mutates the original object to set an ID
|
// Note: A new score reference is used here since the import process mutates the original object to set an ID
|
||||||
Assert.That(scoreManager.IsAvailableLocally(new ScoreInfo { OnlineScoreID = 2 }));
|
Assert.That(scoreManager.IsAvailableLocally(new ScoreInfo { OnlineID = 2 }));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
User = new APIUser { Username = "Test user" },
|
User = new APIUser { Username = "Test user" },
|
||||||
Date = DateTimeOffset.Now,
|
Date = DateTimeOffset.Now,
|
||||||
OnlineScoreID = 12345,
|
OnlineID = 12345,
|
||||||
Ruleset = rulesetInfo,
|
Ruleset = rulesetInfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
User = new APIUser { Username = "Test user" },
|
User = new APIUser { Username = "Test user" },
|
||||||
Date = DateTimeOffset.Now,
|
Date = DateTimeOffset.Now,
|
||||||
OnlineScoreID = 12345,
|
OnlineID = 12345,
|
||||||
Ruleset = rulesetInfo,
|
Ruleset = rulesetInfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
imported = Game.ScoreManager.Import(new ScoreInfo
|
imported = Game.ScoreManager.Import(new ScoreInfo
|
||||||
{
|
{
|
||||||
Hash = Guid.NewGuid().ToString(),
|
Hash = Guid.NewGuid().ToString(),
|
||||||
OnlineScoreID = i,
|
OnlineID = i,
|
||||||
BeatmapInfo = beatmap.Beatmaps.First(),
|
BeatmapInfo = beatmap.Beatmaps.First(),
|
||||||
Ruleset = ruleset ?? new OsuRuleset().RulesetInfo
|
Ruleset = ruleset ?? new OsuRuleset().RulesetInfo
|
||||||
}).Result.Value;
|
}).Result.Value;
|
||||||
|
@ -51,13 +51,13 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
|
|
||||||
AddStep("bind user score info handler", () =>
|
AddStep("bind user score info handler", () =>
|
||||||
{
|
{
|
||||||
userScore = new TestScoreInfo(new OsuRuleset().RulesetInfo) { OnlineScoreID = currentScoreId++ };
|
userScore = new TestScoreInfo(new OsuRuleset().RulesetInfo) { OnlineID = currentScoreId++ };
|
||||||
bindHandler(userScore: userScore);
|
bindHandler(userScore: userScore);
|
||||||
});
|
});
|
||||||
|
|
||||||
createResults(() => userScore);
|
createResults(() => userScore);
|
||||||
|
|
||||||
AddAssert("user score selected", () => this.ChildrenOfType<ScorePanel>().Single(p => p.Score.OnlineID == userScore.OnlineScoreID).State == PanelState.Expanded);
|
AddAssert("user score selected", () => this.ChildrenOfType<ScorePanel>().Single(p => p.Score.OnlineID == userScore.OnlineID).State == PanelState.Expanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -75,14 +75,14 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
|
|
||||||
AddStep("bind user score info handler", () =>
|
AddStep("bind user score info handler", () =>
|
||||||
{
|
{
|
||||||
userScore = new TestScoreInfo(new OsuRuleset().RulesetInfo) { OnlineScoreID = currentScoreId++ };
|
userScore = new TestScoreInfo(new OsuRuleset().RulesetInfo) { OnlineID = currentScoreId++ };
|
||||||
bindHandler(true, userScore);
|
bindHandler(true, userScore);
|
||||||
});
|
});
|
||||||
|
|
||||||
createResults(() => userScore);
|
createResults(() => userScore);
|
||||||
|
|
||||||
AddAssert("more than 1 panel displayed", () => this.ChildrenOfType<ScorePanel>().Count() > 1);
|
AddAssert("more than 1 panel displayed", () => this.ChildrenOfType<ScorePanel>().Count() > 1);
|
||||||
AddAssert("user score selected", () => this.ChildrenOfType<ScorePanel>().Single(p => p.Score.OnlineID == userScore.OnlineScoreID).State == PanelState.Expanded);
|
AddAssert("user score selected", () => this.ChildrenOfType<ScorePanel>().Single(p => p.Score.OnlineID == userScore.OnlineID).State == PanelState.Expanded);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -124,7 +124,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
|||||||
|
|
||||||
AddStep("bind user score info handler", () =>
|
AddStep("bind user score info handler", () =>
|
||||||
{
|
{
|
||||||
userScore = new TestScoreInfo(new OsuRuleset().RulesetInfo) { OnlineScoreID = currentScoreId++ };
|
userScore = new TestScoreInfo(new OsuRuleset().RulesetInfo) { OnlineID = currentScoreId++ };
|
||||||
bindHandler(userScore: userScore);
|
bindHandler(userScore: userScore);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
var score = new ScoreInfo
|
var score = new ScoreInfo
|
||||||
{
|
{
|
||||||
OnlineScoreID = i,
|
OnlineID = i,
|
||||||
BeatmapInfo = beatmapInfo,
|
BeatmapInfo = beatmapInfo,
|
||||||
BeatmapInfoID = beatmapInfo.ID,
|
BeatmapInfoID = beatmapInfo.ID,
|
||||||
Accuracy = RNG.NextDouble(),
|
Accuracy = RNG.NextDouble(),
|
||||||
|
@ -101,7 +101,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
BeatmapInfo = beatmap,
|
BeatmapInfo = beatmap,
|
||||||
User = User,
|
User = User,
|
||||||
Accuracy = Accuracy,
|
Accuracy = Accuracy,
|
||||||
OnlineScoreID = OnlineID,
|
OnlineID = OnlineID,
|
||||||
Date = Date,
|
Date = Date,
|
||||||
PP = PP,
|
PP = PP,
|
||||||
RulesetID = RulesetID,
|
RulesetID = RulesetID,
|
||||||
|
@ -69,7 +69,7 @@ namespace osu.Game.Online.Rooms
|
|||||||
|
|
||||||
var scoreInfo = new ScoreInfo
|
var scoreInfo = new ScoreInfo
|
||||||
{
|
{
|
||||||
OnlineScoreID = ID,
|
OnlineID = ID,
|
||||||
TotalScore = TotalScore,
|
TotalScore = TotalScore,
|
||||||
MaxCombo = MaxCombo,
|
MaxCombo = MaxCombo,
|
||||||
BeatmapInfo = beatmap,
|
BeatmapInfo = beatmap,
|
||||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Online
|
|||||||
var scoreInfo = new ScoreInfo
|
var scoreInfo = new ScoreInfo
|
||||||
{
|
{
|
||||||
ID = TrackedItem.ID,
|
ID = TrackedItem.ID,
|
||||||
OnlineScoreID = TrackedItem.OnlineScoreID
|
OnlineID = TrackedItem.OnlineID
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Manager.IsAvailableLocally(scoreInfo))
|
if (Manager.IsAvailableLocally(scoreInfo))
|
||||||
|
@ -80,12 +80,9 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
byte[] compressedReplay = sr.ReadByteArray();
|
byte[] compressedReplay = sr.ReadByteArray();
|
||||||
|
|
||||||
if (version >= 20140721)
|
if (version >= 20140721)
|
||||||
scoreInfo.OnlineScoreID = sr.ReadInt64();
|
scoreInfo.OnlineID = sr.ReadInt64();
|
||||||
else if (version >= 20121008)
|
else if (version >= 20121008)
|
||||||
scoreInfo.OnlineScoreID = sr.ReadInt32();
|
scoreInfo.OnlineID = sr.ReadInt32();
|
||||||
|
|
||||||
if (scoreInfo.OnlineID <= 0)
|
|
||||||
scoreInfo.OnlineScoreID = null;
|
|
||||||
|
|
||||||
if (compressedReplay?.Length > 0)
|
if (compressedReplay?.Length > 0)
|
||||||
{
|
{
|
||||||
|
@ -1031,13 +1031,13 @@ namespace osu.Game.Screens.Play
|
|||||||
//
|
//
|
||||||
// Until we better define the server-side logic behind this, let's not store the online ID to avoid potential unique constraint
|
// Until we better define the server-side logic behind this, let's not store the online ID to avoid potential unique constraint
|
||||||
// conflicts across various systems (ie. solo and multiplayer).
|
// conflicts across various systems (ie. solo and multiplayer).
|
||||||
long? onlineScoreId = score.ScoreInfo.OnlineScoreID;
|
long onlineScoreId = score.ScoreInfo.OnlineID;
|
||||||
score.ScoreInfo.OnlineScoreID = null;
|
score.ScoreInfo.OnlineID = -1;
|
||||||
|
|
||||||
await scoreManager.Import(score.ScoreInfo, replayReader).ConfigureAwait(false);
|
await scoreManager.Import(score.ScoreInfo, replayReader).ConfigureAwait(false);
|
||||||
|
|
||||||
// ... And restore the online ID for other processes to handle correctly (e.g. de-duplication for the results screen).
|
// ... And restore the online ID for other processes to handle correctly (e.g. de-duplication for the results screen).
|
||||||
score.ScoreInfo.OnlineScoreID = onlineScoreId;
|
score.ScoreInfo.OnlineID = onlineScoreId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -156,7 +156,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
request.Success += s =>
|
request.Success += s =>
|
||||||
{
|
{
|
||||||
score.ScoreInfo.OnlineScoreID = s.ID;
|
score.ScoreInfo.OnlineID = s.ID;
|
||||||
score.ScoreInfo.Position = s.Position;
|
score.ScoreInfo.Position = s.Position;
|
||||||
|
|
||||||
scoreSubmissionSource.SetResult(true);
|
scoreSubmissionSource.SetResult(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user