mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
more fixes (almost compiles, except ruleset and manager)
This commit is contained in:
@ -12,7 +12,9 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
|
using osu.Game.Tests.Scores.IO;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Beatmaps.IO
|
namespace osu.Game.Tests.Beatmaps.IO
|
||||||
{
|
{
|
||||||
@ -61,6 +63,15 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
Assert.IsTrue(manager.QueryBeatmapSets(_ => true).First().DeletePending);
|
Assert.IsTrue(manager.QueryBeatmapSets(_ => true).First().DeletePending);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Task createScoreForBeatmap(OsuGameBase osu, BeatmapInfo beatmapInfo)
|
||||||
|
{
|
||||||
|
return ImportScoreTest.LoadScoreIntoOsu(osu, new ScoreInfo
|
||||||
|
{
|
||||||
|
OnlineID = 2,
|
||||||
|
BeatmapInfo = beatmapInfo,
|
||||||
|
}, new ImportScoreTest.TestArchiveReader());
|
||||||
|
}
|
||||||
|
|
||||||
private static void checkBeatmapSetCount(OsuGameBase osu, int expected, bool includeDeletePending = false)
|
private static void checkBeatmapSetCount(OsuGameBase osu, int expected, bool includeDeletePending = false)
|
||||||
{
|
{
|
||||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||||
|
@ -164,7 +164,6 @@ namespace osu.Game.Tests.Resources
|
|||||||
},
|
},
|
||||||
BeatmapInfo = beatmap,
|
BeatmapInfo = beatmap,
|
||||||
Ruleset = beatmap.Ruleset,
|
Ruleset = beatmap.Ruleset,
|
||||||
RulesetID = beatmap.Ruleset.ID ?? 0,
|
|
||||||
Mods = new Mod[] { new TestModHardRock(), new TestModDoubleTime() },
|
Mods = new Mod[] { new TestModHardRock(), new TestModDoubleTime() },
|
||||||
TotalScore = 2845370,
|
TotalScore = 2845370,
|
||||||
Accuracy = 0.95,
|
Accuracy = 0.95,
|
||||||
|
@ -7,6 +7,7 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Models;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
@ -157,10 +158,10 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
public void TestSelectMultipleScores()
|
public void TestSelectMultipleScores()
|
||||||
{
|
{
|
||||||
var firstScore = TestResources.CreateTestScoreInfo();
|
var firstScore = TestResources.CreateTestScoreInfo();
|
||||||
var secondScore = TestResources.CreateTestScoreInfo();
|
firstScore.RealmUser = new RealmUser { Username = "A" };
|
||||||
|
|
||||||
firstScore.UserString = "A";
|
var secondScore = TestResources.CreateTestScoreInfo();
|
||||||
secondScore.UserString = "B";
|
secondScore.RealmUser = new RealmUser { Username = "B" };
|
||||||
|
|
||||||
createListStep(() => new ScorePanelList());
|
createListStep(() => new ScorePanelList());
|
||||||
|
|
||||||
@ -178,7 +179,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
|
|
||||||
AddStep("select second score", () =>
|
AddStep("select second score", () =>
|
||||||
{
|
{
|
||||||
InputManager.MoveMouseTo(list.ChildrenOfType<ScorePanel>().Single(p => p.Score == secondScore));
|
InputManager.MoveMouseTo(list.ChildrenOfType<ScorePanel>().Single(p => p.Score.Equals(secondScore)));
|
||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -303,6 +304,6 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
=> AddUntilStep("first panel centred", () => Precision.AlmostEquals(list.ChildrenOfType<ScorePanel>().First().ScreenSpaceDrawQuad.Centre.X, list.ScreenSpaceDrawQuad.Centre.X, 1));
|
=> AddUntilStep("first panel centred", () => Precision.AlmostEquals(list.ChildrenOfType<ScorePanel>().First().ScreenSpaceDrawQuad.Centre.X, list.ScreenSpaceDrawQuad.Centre.X, 1));
|
||||||
|
|
||||||
private void assertScoreState(ScoreInfo score, bool expanded)
|
private void assertScoreState(ScoreInfo score, bool expanded)
|
||||||
=> AddUntilStep($"score expanded = {expanded}", () => (list.ChildrenOfType<ScorePanel>().Single(p => p.Score == score).State == PanelState.Expanded) == expanded);
|
=> AddUntilStep($"score expanded = {expanded}", () => (list.ChildrenOfType<ScorePanel>().Single(p => p.Score.Equals(score)).State == PanelState.Expanded) == expanded);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Online.Leaderboards;
|
using osu.Game.Online.Leaderboards;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -19,6 +20,7 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Select.Leaderboards;
|
using osu.Game.Screens.Select.Leaderboards;
|
||||||
|
using osu.Game.Stores;
|
||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -43,7 +45,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
dependencies.Cache(rulesetStore = new RulesetStore(ContextFactory));
|
dependencies.Cache(rulesetStore = new RulesetStore(ContextFactory));
|
||||||
dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, dependencies.Get<AudioManager>(), Resources, dependencies.Get<GameHost>(), Beatmap.Default));
|
dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, dependencies.Get<AudioManager>(), Resources, dependencies.Get<GameHost>(), Beatmap.Default));
|
||||||
dependencies.Cache(scoreManager = new ScoreManager(rulesetStore, () => beatmapManager, LocalStorage, ContextFactory, Scheduler));
|
dependencies.Cache(scoreManager = new ScoreManager(dependencies.Get<RealmRulesetStore>(), () => beatmapManager, LocalStorage, dependencies.Get<RealmContextFactory>(), Scheduler));
|
||||||
|
|
||||||
return dependencies;
|
return dependencies;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ using osu.Game.Overlays;
|
|||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Select.Leaderboards;
|
using osu.Game.Screens.Select.Leaderboards;
|
||||||
|
using osu.Game.Stores;
|
||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
@ -85,7 +86,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
dependencies.Cache(rulesetStore = new RulesetStore(ContextFactory));
|
dependencies.Cache(rulesetStore = new RulesetStore(ContextFactory));
|
||||||
dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, dependencies.Get<AudioManager>(), Resources, dependencies.Get<GameHost>(), Beatmap.Default));
|
dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, dependencies.Get<AudioManager>(), Resources, dependencies.Get<GameHost>(), Beatmap.Default));
|
||||||
dependencies.Cache(scoreManager = new ScoreManager(rulesetStore, () => beatmapManager, LocalStorage, ContextFactory, Scheduler));
|
dependencies.Cache(scoreManager = new ScoreManager(dependencies.Get<RealmRulesetStore>(), () => beatmapManager, LocalStorage, dependencies.Get<RealmContextFactory>(), Scheduler));
|
||||||
|
|
||||||
beatmapInfo = beatmapManager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).GetResultSafely().Value.Beatmaps[0];
|
beatmapInfo = beatmapManager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).GetResultSafely().Value.Beatmaps[0];
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
if (Score.Files.Count > 0)
|
if (Score.Files.Count > 0)
|
||||||
items.Add(new OsuMenuItem("Export", MenuItemType.Standard, () => new LegacyScoreExporter(storage).Export(Score)));
|
items.Add(new OsuMenuItem("Export", MenuItemType.Standard, () => new LegacyScoreExporter(storage).Export(Score)));
|
||||||
|
|
||||||
if (Score.ID != 0)
|
if (Score.IsManaged)
|
||||||
items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(Score))));
|
items.Add(new OsuMenuItem("Delete", MenuItemType.Destructive, () => dialogOverlay?.Push(new LocalScoreDeleteDialog(Score))));
|
||||||
|
|
||||||
return items.ToArray();
|
return items.ToArray();
|
||||||
|
@ -224,7 +224,7 @@ namespace osu.Game
|
|||||||
dependencies.Cache(RulesetStore = new RulesetStore(realmFactory, Storage));
|
dependencies.Cache(RulesetStore = new RulesetStore(realmFactory, Storage));
|
||||||
|
|
||||||
// ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup()
|
// ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup()
|
||||||
dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, API, realmFactory, Scheduler, Host, () => difficultyCache, LocalConfig));
|
dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, realmFactory, Scheduler, Host, () => difficultyCache, LocalConfig));
|
||||||
dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, realmFactory, RulesetStore, API, Audio, Resources, Host, defaultBeatmap, performOnlineLookups: true));
|
dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, realmFactory, RulesetStore, API, Audio, Resources, Host, defaultBeatmap, performOnlineLookups: true));
|
||||||
|
|
||||||
dependencies.Cache(BeatmapDownloader = new BeatmapModelDownloader(BeatmapManager, API));
|
dependencies.Cache(BeatmapDownloader = new BeatmapModelDownloader(BeatmapManager, API));
|
||||||
|
@ -107,7 +107,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (score == value)
|
if (score.Equals(value))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
score = value;
|
score = value;
|
||||||
@ -115,7 +115,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
accuracyColumn.Text = value.DisplayAccuracy;
|
accuracyColumn.Text = value.DisplayAccuracy;
|
||||||
maxComboColumn.Text = value.MaxCombo.ToLocalisableString(@"0\x");
|
maxComboColumn.Text = value.MaxCombo.ToLocalisableString(@"0\x");
|
||||||
|
|
||||||
ppColumn.Alpha = value.BeatmapInfo?.Status.GrantsPerformancePoints() == true ? 1 : 0;
|
ppColumn.Alpha = value.BeatmapInfo.Status.GrantsPerformancePoints() ? 1 : 0;
|
||||||
ppColumn.Text = value.PP?.ToLocalisableString(@"N0");
|
ppColumn.Text = value.PP?.ToLocalisableString(@"N0");
|
||||||
|
|
||||||
statisticsColumns.ChildrenEnumerable = value.GetStatisticsForDisplay().Select(createStatisticsColumn);
|
statisticsColumns.ChildrenEnumerable = value.GetStatisticsForDisplay().Select(createStatisticsColumn);
|
||||||
|
@ -45,8 +45,8 @@ namespace osu.Game.Scoring.Legacy
|
|||||||
sw.Write((byte)(score.ScoreInfo.Ruleset.OnlineID));
|
sw.Write((byte)(score.ScoreInfo.Ruleset.OnlineID));
|
||||||
sw.Write(LATEST_VERSION);
|
sw.Write(LATEST_VERSION);
|
||||||
sw.Write(score.ScoreInfo.BeatmapInfo.MD5Hash);
|
sw.Write(score.ScoreInfo.BeatmapInfo.MD5Hash);
|
||||||
sw.Write(score.ScoreInfo.UserString);
|
sw.Write(score.ScoreInfo.User.Username);
|
||||||
sw.Write(FormattableString.Invariant($"lazer-{score.ScoreInfo.UserString}-{score.ScoreInfo.Date}").ComputeMD5Hash());
|
sw.Write(FormattableString.Invariant($"lazer-{score.ScoreInfo.User.Username}-{score.ScoreInfo.Date}").ComputeMD5Hash());
|
||||||
sw.Write((ushort)(score.ScoreInfo.GetCount300() ?? 0));
|
sw.Write((ushort)(score.ScoreInfo.GetCount300() ?? 0));
|
||||||
sw.Write((ushort)(score.ScoreInfo.GetCount100() ?? 0));
|
sw.Write((ushort)(score.ScoreInfo.GetCount100() ?? 0));
|
||||||
sw.Write((ushort)(score.ScoreInfo.GetCount50() ?? 0));
|
sw.Write((ushort)(score.ScoreInfo.GetCount50() ?? 0));
|
||||||
|
@ -6,14 +6,14 @@ using System.Linq;
|
|||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Rulesets;
|
|
||||||
using osu.Game.Scoring.Legacy;
|
using osu.Game.Scoring.Legacy;
|
||||||
|
using osu.Game.Stores;
|
||||||
|
|
||||||
namespace osu.Game.Scoring
|
namespace osu.Game.Scoring
|
||||||
{
|
{
|
||||||
public class LegacyDatabasedScore : Score
|
public class LegacyDatabasedScore : Score
|
||||||
{
|
{
|
||||||
public LegacyDatabasedScore(ScoreInfo score, RulesetStore rulesets, BeatmapManager beatmaps, IResourceStore<byte[]> store)
|
public LegacyDatabasedScore(ScoreInfo score, RealmRulesetStore rulesets, BeatmapManager beatmaps, IResourceStore<byte[]> store)
|
||||||
{
|
{
|
||||||
ScoreInfo = score;
|
ScoreInfo = score;
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Models;
|
using osu.Game.Models;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -44,14 +45,27 @@ namespace osu.Game.Scoring
|
|||||||
[MapTo("User")]
|
[MapTo("User")]
|
||||||
public RealmUser RealmUser { get; set; } = null!;
|
public RealmUser RealmUser { get; set; } = null!;
|
||||||
|
|
||||||
public IUser User
|
// TODO: this is a bit temporary to account for the fact that this class is used to ferry API user data to certain UI components.
|
||||||
|
// Eventually we should either persist enough information to realm to not require the API lookups, or perform the API lookups locally.
|
||||||
|
private APIUser? user;
|
||||||
|
|
||||||
|
public APIUser User
|
||||||
{
|
{
|
||||||
get => RealmUser;
|
get => user ??= new APIUser
|
||||||
set => RealmUser = new RealmUser
|
|
||||||
{
|
{
|
||||||
OnlineID = value.OnlineID,
|
Username = RealmUser.Username,
|
||||||
Username = value.Username
|
Id = RealmUser.OnlineID,
|
||||||
};
|
};
|
||||||
|
set
|
||||||
|
{
|
||||||
|
user = value;
|
||||||
|
|
||||||
|
RealmUser = new RealmUser
|
||||||
|
{
|
||||||
|
OnlineID = user.OnlineID,
|
||||||
|
Username = user.Username
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long TotalScore { get; set; }
|
public long TotalScore { get; set; }
|
||||||
@ -72,6 +86,7 @@ namespace osu.Game.Scoring
|
|||||||
{
|
{
|
||||||
get => new BeatmapInfo();
|
get => new BeatmapInfo();
|
||||||
// .. todo
|
// .. todo
|
||||||
|
// ReSharper disable once ValueParameterNotUsed
|
||||||
set => Beatmap = new RealmBeatmap(new RealmRuleset("osu", "osu!", "wangs", 0), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata());
|
set => Beatmap = new RealmBeatmap(new RealmRuleset("osu", "osu!", "wangs", 0), new RealmBeatmapDifficulty(), new RealmBeatmapMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,6 +104,8 @@ namespace osu.Game.Scoring
|
|||||||
|
|
||||||
return JsonConvert.DeserializeObject<Dictionary<HitResult, int>>(StatisticsJson) ?? new Dictionary<HitResult, int>();
|
return JsonConvert.DeserializeObject<Dictionary<HitResult, int>>(StatisticsJson) ?? new Dictionary<HitResult, int>();
|
||||||
}
|
}
|
||||||
|
// .. todo
|
||||||
|
// ReSharper disable once ValueParameterNotUsed
|
||||||
set => JsonConvert.SerializeObject(StatisticsJson);
|
set => JsonConvert.SerializeObject(StatisticsJson);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ using osu.Game.Overlays.Notifications;
|
|||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Stores;
|
||||||
|
|
||||||
namespace osu.Game.Scoring
|
namespace osu.Game.Scoring
|
||||||
{
|
{
|
||||||
@ -37,7 +38,7 @@ namespace osu.Game.Scoring
|
|||||||
this.difficulties = difficulties;
|
this.difficulties = difficulties;
|
||||||
this.configManager = configManager;
|
this.configManager = configManager;
|
||||||
|
|
||||||
scoreModelManager = new ScoreModelManager(rulesets, beatmaps, storage, contextFactory, importHost);
|
scoreModelManager = new ScoreModelManager(rulesets, beatmaps, storage, contextFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Score GetScore(ScoreInfo score) => scoreModelManager.GetScore(score);
|
public Score GetScore(ScoreInfo score) => scoreModelManager.GetScore(score);
|
||||||
@ -125,8 +126,9 @@ namespace osu.Game.Scoring
|
|||||||
/// <returns>The total score.</returns>
|
/// <returns>The total score.</returns>
|
||||||
public async Task<long> GetTotalScoreAsync([NotNull] ScoreInfo score, ScoringMode mode = ScoringMode.Standardised, CancellationToken cancellationToken = default)
|
public async Task<long> GetTotalScoreAsync([NotNull] ScoreInfo score, ScoringMode mode = ScoringMode.Standardised, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
if (score.Beatmap == null)
|
// TODO: ??
|
||||||
return score.TotalScore;
|
// if (score.Beatmap == null)
|
||||||
|
// return score.TotalScore;
|
||||||
|
|
||||||
int beatmapMaxCombo;
|
int beatmapMaxCombo;
|
||||||
double accuracy = score.Accuracy;
|
double accuracy = score.Accuracy;
|
||||||
@ -150,7 +152,7 @@ namespace osu.Game.Scoring
|
|||||||
beatmapMaxCombo = score.Beatmap.MaxCombo.Value;
|
beatmapMaxCombo = score.Beatmap.MaxCombo.Value;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (score.Beatmap.ID == 0 || difficulties == null)
|
if (!score.Beatmap.IsManaged || difficulties == null)
|
||||||
{
|
{
|
||||||
// We don't have enough information (max combo) to compute the score, so use the provided score.
|
// We don't have enough information (max combo) to compute the score, so use the provided score.
|
||||||
return score.TotalScore;
|
return score.TotalScore;
|
||||||
|
@ -11,7 +11,6 @@ using osu.Framework.Platform;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.IO.Archives;
|
using osu.Game.IO.Archives;
|
||||||
using osu.Game.Rulesets;
|
|
||||||
using osu.Game.Scoring.Legacy;
|
using osu.Game.Scoring.Legacy;
|
||||||
using osu.Game.Stores;
|
using osu.Game.Stores;
|
||||||
using Realms;
|
using Realms;
|
||||||
@ -26,10 +25,10 @@ namespace osu.Game.Scoring
|
|||||||
|
|
||||||
protected override string[] HashableFileTypes => new[] { ".osr" };
|
protected override string[] HashableFileTypes => new[] { ".osr" };
|
||||||
|
|
||||||
private readonly RulesetStore rulesets;
|
private readonly RealmRulesetStore rulesets;
|
||||||
private readonly Func<BeatmapManager> beatmaps;
|
private readonly Func<BeatmapManager> beatmaps;
|
||||||
|
|
||||||
public ScoreModelManager(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, RealmContextFactory contextFactory)
|
public ScoreModelManager(RealmRulesetStore rulesets, Func<BeatmapManager> beatmaps, Storage storage, RealmContextFactory contextFactory)
|
||||||
: base(storage, contextFactory)
|
: base(storage, contextFactory)
|
||||||
{
|
{
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
|
@ -226,8 +226,6 @@ namespace osu.Game.Screens.Play
|
|||||||
// ensure the score is in a consistent state with the current player.
|
// ensure the score is in a consistent state with the current player.
|
||||||
Score.ScoreInfo.BeatmapInfo = Beatmap.Value.BeatmapInfo;
|
Score.ScoreInfo.BeatmapInfo = Beatmap.Value.BeatmapInfo;
|
||||||
Score.ScoreInfo.Ruleset = ruleset.RulesetInfo;
|
Score.ScoreInfo.Ruleset = ruleset.RulesetInfo;
|
||||||
if (ruleset.RulesetInfo.OnlineID >= 0)
|
|
||||||
Score.ScoreInfo.RulesetID = ruleset.RulesetInfo.OnlineID;
|
|
||||||
Score.ScoreInfo.Mods = gameplayMods;
|
Score.ScoreInfo.Mods = gameplayMods;
|
||||||
|
|
||||||
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score));
|
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score));
|
||||||
@ -1045,7 +1043,8 @@ 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.OnlineID;
|
long onlineScoreId = score.ScoreInfo.OnlineID;
|
||||||
|
|
||||||
score.ScoreInfo.OnlineID = -1;
|
score.ScoreInfo.OnlineID = -1;
|
||||||
|
|
||||||
await scoreManager.Import(score.ScoreInfo, replayReader).ConfigureAwait(false);
|
await scoreManager.Import(score.ScoreInfo, replayReader).ConfigureAwait(false);
|
||||||
|
@ -107,7 +107,7 @@ namespace osu.Game.Screens.Ranking.Contracted
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Text = score.UserString,
|
Text = score.RealmUser.Username,
|
||||||
Font = OsuFont.GetFont(size: 16, weight: FontWeight.SemiBold)
|
Font = OsuFont.GetFont(size: 16, weight: FontWeight.SemiBold)
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
|
@ -158,7 +158,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
trackingContainer.Show();
|
trackingContainer.Show();
|
||||||
|
|
||||||
if (SelectedScore.Value == score)
|
if (SelectedScore.Value.Equals(score))
|
||||||
{
|
{
|
||||||
SelectedScore.TriggerChange();
|
SelectedScore.TriggerChange();
|
||||||
}
|
}
|
||||||
@ -185,10 +185,10 @@ namespace osu.Game.Screens.Ranking
|
|||||||
private void selectedScoreChanged(ValueChangedEvent<ScoreInfo> score)
|
private void selectedScoreChanged(ValueChangedEvent<ScoreInfo> score)
|
||||||
{
|
{
|
||||||
// avoid contracting panels unnecessarily when TriggerChange is fired manually.
|
// avoid contracting panels unnecessarily when TriggerChange is fired manually.
|
||||||
if (score.OldValue != score.NewValue)
|
if (!score.OldValue.Equals(score.NewValue))
|
||||||
{
|
{
|
||||||
// Contract the old panel.
|
// Contract the old panel.
|
||||||
foreach (var t in flow.Where(t => t.Panel.Score == score.OldValue))
|
foreach (var t in flow.Where(t => t.Panel.Score.Equals(score.OldValue)))
|
||||||
{
|
{
|
||||||
t.Panel.State = PanelState.Contracted;
|
t.Panel.State = PanelState.Contracted;
|
||||||
t.Margin = new MarginPadding();
|
t.Margin = new MarginPadding();
|
||||||
@ -269,7 +269,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="score">The <see cref="ScoreInfo"/> to find the corresponding <see cref="ScorePanel"/> for.</param>
|
/// <param name="score">The <see cref="ScoreInfo"/> to find the corresponding <see cref="ScorePanel"/> for.</param>
|
||||||
/// <returns>The <see cref="ScorePanel"/>.</returns>
|
/// <returns>The <see cref="ScorePanel"/>.</returns>
|
||||||
public ScorePanel GetPanelForScore(ScoreInfo score) => flow.Single(t => t.Panel.Score == score).Panel;
|
public ScorePanel GetPanelForScore(ScoreInfo score) => flow.Single(t => t.Panel.Score.Equals(score)).Panel;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Detaches a <see cref="ScorePanel"/> from its <see cref="ScorePanelTrackingContainer"/>, allowing the panel to be moved elsewhere in the hierarchy.
|
/// Detaches a <see cref="ScorePanel"/> from its <see cref="ScorePanelTrackingContainer"/>, allowing the panel to be moved elsewhere in the hierarchy.
|
||||||
@ -332,13 +332,13 @@ namespace osu.Game.Screens.Ranking
|
|||||||
{
|
{
|
||||||
public override IEnumerable<Drawable> FlowingChildren => applySorting(AliveInternalChildren);
|
public override IEnumerable<Drawable> FlowingChildren => applySorting(AliveInternalChildren);
|
||||||
|
|
||||||
public int GetPanelIndex(ScoreInfo score) => applySorting(Children).TakeWhile(s => s.Panel.Score != score).Count();
|
public int GetPanelIndex(ScoreInfo score) => applySorting(Children).TakeWhile(s => !s.Panel.Score.Equals(score)).Count();
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
public ScoreInfo GetPreviousScore(ScoreInfo score) => applySorting(Children).TakeWhile(s => s.Panel.Score != score).LastOrDefault()?.Panel.Score;
|
public ScoreInfo GetPreviousScore(ScoreInfo score) => applySorting(Children).TakeWhile(s => !s.Panel.Score.Equals(score)).LastOrDefault()?.Panel.Score;
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
public ScoreInfo GetNextScore(ScoreInfo score) => applySorting(Children).SkipWhile(s => s.Panel.Score != score).ElementAtOrDefault(1)?.Panel.Score;
|
public ScoreInfo GetNextScore(ScoreInfo score) => applySorting(Children).SkipWhile(s => !s.Panel.Score.Equals(score)).ElementAtOrDefault(1)?.Panel.Score;
|
||||||
|
|
||||||
private IEnumerable<ScorePanelTrackingContainer> applySorting(IEnumerable<Drawable> drawables) => drawables.OfType<ScorePanelTrackingContainer>()
|
private IEnumerable<ScorePanelTrackingContainer> applySorting(IEnumerable<Drawable> drawables) => drawables.OfType<ScorePanelTrackingContainer>()
|
||||||
.OrderByDescending(GetLayoutPosition)
|
.OrderByDescending(GetLayoutPosition)
|
||||||
|
@ -142,7 +142,7 @@ namespace osu.Game.Screens.Ranking.Statistics
|
|||||||
|
|
||||||
LoadComponentAsync(rows, d =>
|
LoadComponentAsync(rows, d =>
|
||||||
{
|
{
|
||||||
if (Score.Value != newScore)
|
if (!Score.Value.Equals(newScore))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spinner.Hide();
|
spinner.Hide();
|
||||||
|
Reference in New Issue
Block a user