public override void SetUpSteps() { base.SetUpSteps(); AddStep("import beatmap", () => { beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); importedSet = beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.All).First(); }); AddStep("create multiplayer screen", () => multiplayerScreen = new TestMultiplayer()); AddStep("load dependencies", () => { client = new TestMultiplayerClient(multiplayerScreen.RoomManager); // The screen gets suspended so it stops receiving updates. Child = client; LoadScreen(dependenciesScreen = new DependenciesScreen(client)); }); AddUntilStep("wait for dependencies screen", () => Stack.CurrentScreen is DependenciesScreen); AddUntilStep("wait for dependencies to start load", () => dependenciesScreen.LoadState > LoadState.NotLoaded); AddUntilStep("wait for dependencies to load", () => dependenciesScreen.IsLoaded); AddStep("load multiplayer", () => LoadScreen(multiplayerScreen)); AddUntilStep("wait for multiplayer to load", () => multiplayerScreen.IsLoaded); AddUntilStep("wait for lounge to load", () => this.ChildrenOfType <MultiplayerLoungeSubScreen>().FirstOrDefault()?.IsLoaded == true); }
public override void SetUpSteps() { base.SetUpSteps(); AddStep("import beatmap", () => { beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); importedSet = beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.All).First(); }); AddStep("create multiplayer screen", () => multiplayerScreen = new TestMultiplayer()); AddStep("load dependencies", () => { client = new TestMultiplayerClient(multiplayerScreen.RoomManager); // The screen gets suspended so it stops receiving updates. Child = client; LoadScreen(dependenciesScreen = new DependenciesScreen(client)); }); AddUntilStep("wait for dependencies to load", () => dependenciesScreen.IsLoaded); AddStep("load multiplayer", () => LoadScreen(multiplayerScreen)); AddUntilStep("wait for multiplayer to load", () => multiplayerScreen.IsLoaded); }
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); 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(scoreManager = new ScoreManager(rulesetStore, () => beatmapManager, LocalStorage, null, ContextFactory)); beatmap = beatmapManager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).Result.Beatmaps[0]; for (int i = 0; i < 50; i++) { var score = new ScoreInfo { OnlineScoreID = i, Beatmap = beatmap, BeatmapInfoID = beatmap.ID, Accuracy = RNG.NextDouble(), TotalScore = RNG.Next(1, 1000000), MaxCombo = RNG.Next(1, 1000), Rank = ScoreRank.XH, User = new User { Username = "******" }, }; scores.Add(scoreManager.Import(score).Result); } scores.Sort(Comparer <ScoreInfo> .Create((s1, s2) => s2.TotalScore.CompareTo(s1.TotalScore))); return(dependencies); }
public void TestLocalScoresDisplay() { BeatmapInfo beatmapInfo = null; AddStep(@"Set scope", () => leaderboard.Scope = BeatmapLeaderboardScope.Local); AddStep(@"Set beatmap", () => { beatmapManager.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); beatmapInfo = beatmapManager.GetAllUsableBeatmapSets().First().Beatmaps.First(); leaderboard.BeatmapInfo = beatmapInfo; }); clearScores(); checkCount(0); loadMoreScores(() => beatmapInfo); checkCount(10); loadMoreScores(() => beatmapInfo); checkCount(20); clearScores(); checkCount(0); }
private void load() => Schedule(() => { var imported = beatmapManager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).GetResultSafely(); imported?.PerformRead(s => { beatmapInfo = s.Beatmaps[0]; for (int i = 0; i < 50; i++) { var score = new ScoreInfo { OnlineID = i, BeatmapInfo = beatmapInfo, Accuracy = RNG.NextDouble(), TotalScore = RNG.Next(1, 1000000), MaxCombo = RNG.Next(1, 1000), Rank = ScoreRank.XH, User = new APIUser { Username = "******" }, Ruleset = new OsuRuleset().RulesetInfo, }; importedScores.Add(scoreManager.Import(score).Value); } }); });
public void TestImportMods() { using (HeadlessGameHost host = new CleanRunHeadlessGameHost()) { try { var osu = LoadOsuIntoHost(host, true); var beatmap = BeatmapImportHelper.LoadOszIntoOsu(osu, TestResources.GetQuickTestBeatmapForImport()).GetResultSafely(); var toImport = new ScoreInfo { User = new APIUser { Username = "******" }, BeatmapInfo = beatmap.Beatmaps.First(), Ruleset = new OsuRuleset().RulesetInfo, Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() }, }; var imported = LoadScoreIntoOsu(osu, toImport); Assert.IsTrue(imported.Mods.Any(m => m is OsuModHardRock)); Assert.IsTrue(imported.Mods.Any(m => m is OsuModDoubleTime)); } finally { host.Exit(); } } }
public void SetUp() => Schedule(() => { beatmaps.AllowImport = new TaskCompletionSource <bool>(); testBeatmapFile = TestResources.GetQuickTestBeatmapForImport(); testBeatmapInfo = getTestBeatmapInfo(testBeatmapFile); testBeatmapSet = testBeatmapInfo.BeatmapSet; var existing = beatmaps.QueryBeatmapSet(s => s.OnlineBeatmapSetID == testBeatmapSet.OnlineBeatmapSetID); if (existing != null) { beatmaps.Delete(existing); } selectedItem.Value = new PlaylistItem { Beatmap = { Value = testBeatmapInfo }, Ruleset = { Value = testBeatmapInfo.Ruleset }, }; Child = availablilityTracker = new OnlinePlayBeatmapAvailablilityTracker { SelectedItem = { BindTarget = selectedItem, } }; });
public void TestImportStatistics() { using (HeadlessGameHost host = new CleanRunHeadlessGameHost()) { try { var osu = LoadOsuIntoHost(host, true); var beatmap = BeatmapImportHelper.LoadOszIntoOsu(osu, TestResources.GetQuickTestBeatmapForImport()).GetResultSafely(); var toImport = new ScoreInfo { User = new APIUser { Username = "******" }, BeatmapInfo = beatmap.Beatmaps.First(), Ruleset = new OsuRuleset().RulesetInfo, Statistics = new Dictionary <HitResult, int> { { HitResult.Perfect, 100 }, { HitResult.Miss, 50 } } }; var imported = LoadScoreIntoOsu(osu, toImport); Assert.AreEqual(toImport.Statistics[HitResult.Perfect], imported.Statistics[HitResult.Perfect]); Assert.AreEqual(toImport.Statistics[HitResult.Miss], imported.Statistics[HitResult.Miss]); } finally { host.Exit(); } } }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default)); beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); importedSet = beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.All).First(); }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RealmRulesetStore(Realm)); Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); Dependencies.Cache(Realm); beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely(); }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default)); Dependencies.Cache(new OsuConfigManager(LocalStorage)); manager.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); Beatmap.SetDefault(); }
public void TestDownloadState() { AddUntilStep("ensure manager loaded", () => beatmaps != null); ensureSoleilyRemoved(); createButtonWithBeatmap(createSoleily()); AddAssert("button state not downloaded", () => downloadButton.DownloadState == DownloadState.NotDownloaded); AddStep("import soleily", () => beatmaps.Import(TestResources.GetQuickTestBeatmapForImport())); AddUntilStep("wait for beatmap import", () => beatmaps.GetAllUsableBeatmapSets().Any(b => b.OnlineBeatmapSetID == 241526)); createButtonWithBeatmap(createSoleily()); AddAssert("button state downloaded", () => downloadButton.DownloadState == DownloadState.LocallyAvailable); ensureSoleilyRemoved(); AddAssert("button state not downloaded", () => downloadButton.DownloadState == DownloadState.NotDownloaded); }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default)); beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); Add(beatmapTracker = new OnlinePlayBeatmapAvailabilityTracker { SelectedItem = { BindTarget = selectedItem } }); Dependencies.Cache(beatmapTracker); }
public new void SetUpSteps() { AddStep("import beatmap", () => { beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); importedSet = beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.All).First(); importedBeatmap = importedSet.Beatmaps.First(b => b.RulesetID == 0); }); AddStep("change to all players mode", () => Client.ChangeSettings(new MultiplayerRoomSettings { QueueMode = QueueMode.AllPlayers })); }
public static async Task <RealmBeatmapSet?> LoadQuickOszIntoOsu(BeatmapImporter importer, Realm realm) { string?temp = TestResources.GetQuickTestBeatmapForImport(); var importedSet = await importer.Import(new ImportTask(temp)); Assert.NotNull(importedSet); ensureLoaded(realm); waitForOrAssert(() => !File.Exists(temp), "Temporary file still exists after standard import", 5000); return(realm.All <RealmBeatmapSet>().FirstOrDefault(beatmapSet => beatmapSet.ID == importedSet !.ID)); }
public static async Task <BeatmapSetInfo> LoadQuickOszIntoOsu(OsuGameBase osu) { var temp = TestResources.GetQuickTestBeatmapForImport(); var manager = osu.Dependencies.Get <BeatmapManager>(); var importedSet = await manager.Import(new ImportTask(temp)); ensureLoaded(osu); waitForOrAssert(() => !File.Exists(temp), "Temporary file still exists after standard import", 5000); return(manager.GetAllUsableBeatmapSets().Find(beatmapSet => beatmapSet.ID == importedSet.ID)); }
public override void SetUpSteps() { base.SetUpSteps(); AddStep("import beatmap", () => { beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); importedSet = beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.All).First(); }); AddStep("load multiplayer", () => LoadScreen(multiplayerScreenStack = new TestMultiplayerScreenStack())); AddUntilStep("wait for multiplayer to load", () => multiplayerScreenStack.IsLoaded); AddUntilStep("wait for lounge to load", () => this.ChildrenOfType <MultiplayerLoungeSubScreen>().FirstOrDefault()?.IsLoaded == true); }
private void load(GameHost host) { Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, Audio, host, Beatmap.Default)); beatmapManager.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); base.Content.AddRange(new Drawable[] { collectionManager = new CollectionManager(LocalStorage), Content }); Dependencies.Cache(collectionManager); }
private void load(GameHost host) { Dependencies.Cache(rulesets = new RealmRulesetStore(Realm)); Dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, Realm, rulesets, null, Audio, Resources, host, Beatmap.Default)); Dependencies.Cache(Realm); beatmapManager.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely(); base.Content.AddRange(new Drawable[] { manager = new CollectionManager(LocalStorage), Content, dialogOverlay = new DialogOverlay(), }); Dependencies.Cache(manager); Dependencies.CacheAs <IDialogOverlay>(dialogOverlay); }
public void TestLocalPlayStartsWhileSpectatingWhenBeatmapBecomesAvailable() { createRoom(() => new Room { Name = { Value = "Test Room" }, Playlist = { new PlaylistItem { Beatmap ={ Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.RulesetID == 0)).BeatmapInfo }, Ruleset ={ Value = new OsuRuleset().RulesetInfo }, } } }); AddStep("delete beatmap", () => beatmaps.Delete(importedSet)); AddStep("join other user (ready, host)", () => { client.AddUser(new APIUser { Id = MultiplayerTestScene.PLAYER_1_ID, Username = "******" }); client.TransferHost(MultiplayerTestScene.PLAYER_1_ID); client.ChangeUserState(MultiplayerTestScene.PLAYER_1_ID, MultiplayerUserState.Ready); }); AddStep("click spectate button", () => { InputManager.MoveMouseTo(this.ChildrenOfType <MultiplayerSpectateButton>().Single()); InputManager.Click(MouseButton.Left); }); AddUntilStep("wait for spectating user state", () => client.LocalUser?.State == MultiplayerUserState.Spectating); AddStep("start match externally", () => client.StartMatch()); AddStep("restore beatmap", () => { beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); importedSet = beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.All).First(); }); AddUntilStep("play started", () => multiplayerScreenStack.CurrentScreen is SpectatorScreen); }
public void TestBasicImport() { using (HeadlessGameHost host = new CleanRunHeadlessGameHost()) { try { var osu = LoadOsuIntoHost(host, true); var beatmap = BeatmapImportHelper.LoadOszIntoOsu(osu, TestResources.GetQuickTestBeatmapForImport()).GetResultSafely(); var toImport = new ScoreInfo { Rank = ScoreRank.B, TotalScore = 987654, Accuracy = 0.8, MaxCombo = 500, Combo = 250, User = new APIUser { Username = "******" }, Date = DateTimeOffset.Now, OnlineID = 12345, Ruleset = new OsuRuleset().RulesetInfo, BeatmapInfo = beatmap.Beatmaps.First() }; var imported = LoadScoreIntoOsu(osu, toImport); Assert.AreEqual(toImport.Rank, imported.Rank); Assert.AreEqual(toImport.TotalScore, imported.TotalScore); Assert.AreEqual(toImport.Accuracy, imported.Accuracy); Assert.AreEqual(toImport.MaxCombo, imported.MaxCombo); Assert.AreEqual(toImport.User.Username, imported.User.Username); Assert.AreEqual(toImport.Date, imported.Date); Assert.AreEqual(toImport.OnlineID, imported.OnlineID); } finally { host.Exit(); } } }
public override void SetUpSteps() { base.SetUpSteps(); AddStep("import beatmap", () => { beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); importedSet = beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.All).First(); InitialBeatmap = importedSet.Beatmaps.First(b => b.RulesetID == 0); OtherBeatmap = importedSet.Beatmaps.Last(b => b.RulesetID == 0); }); AddStep("load multiplayer", () => LoadScreen(multiplayerScreenStack = new TestMultiplayerScreenStack())); AddUntilStep("wait for multiplayer to load", () => multiplayerScreenStack.IsLoaded); AddUntilStep("wait for lounge to load", () => this.ChildrenOfType <MultiplayerLoungeSubScreen>().FirstOrDefault()?.IsLoaded == true); AddUntilStep("wait for lounge", () => multiplayerScreenStack.ChildrenOfType <LoungeSubScreen>().SingleOrDefault()?.IsLoaded == true); AddStep("open room", () => multiplayerScreenStack.ChildrenOfType <LoungeSubScreen>().Single().Open(new Room { Name = { Value = "Test Room" }, QueueMode = { Value = Mode }, Playlist = { new PlaylistItem { Beatmap ={ Value = InitialBeatmap }, Ruleset ={ Value = new OsuRuleset().RulesetInfo }, } } })); AddUntilStep("wait for room open", () => this.ChildrenOfType <MultiplayerMatchSubScreen>().FirstOrDefault()?.IsLoaded == true); AddWaitStep("wait for transition", 2); AddStep("create room", () => { InputManager.MoveMouseTo(this.ChildrenOfType <MultiplayerMatchSettingsOverlay.CreateOrUpdateButton>().Single()); InputManager.Click(MouseButton.Left); }); AddUntilStep("wait for join", () => RoomManager.RoomJoined); }
public new void Setup() => Schedule(() => { AvailabilityTracker.SelectedItem.BindTo(selectedItem); beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely(); importedSet = beatmaps.GetAllUsableBeatmapSets().First(); Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First()); selectedItem.Value = new PlaylistItem(Beatmap.Value.BeatmapInfo) { RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID }; if (button != null) { Remove(button); } Add(button = new MultiplayerReadyButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(200, 50), OnReadyClick = () => { readyClickOperation = OngoingOperationTracker.BeginOperation(); Task.Run(async() => { if (MultiplayerClient.IsHost && MultiplayerClient.LocalUser?.State == MultiplayerUserState.Ready) { await MultiplayerClient.StartMatch(); return; } await MultiplayerClient.ToggleReady(); readyClickOperation.Dispose(); }); } }); });
public void TestTrackerRespectsChecksum() { AddStep("allow importing", () => beatmaps.AllowImport.SetResult(true)); AddStep("import beatmap", () => beatmaps.Import(testBeatmapFile).WaitSafely()); addAvailabilityCheckStep("initially locally available", BeatmapAvailability.LocallyAvailable); AddStep("import altered beatmap", () => { beatmaps.Import(TestResources.GetTestBeatmapForImport(true)).WaitSafely(); }); addAvailabilityCheckStep("state not downloaded", BeatmapAvailability.NotDownloaded); AddStep("recreate tracker", () => Child = availabilityTracker = new OnlinePlayBeatmapAvailabilityTracker { SelectedItem = { BindTarget = selectedItem } }); addAvailabilityCheckStep("state not downloaded as well", BeatmapAvailability.NotDownloaded); AddStep("reimport original beatmap", () => beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely()); addAvailabilityCheckStep("locally available after re-import", BeatmapAvailability.LocallyAvailable); }
public void TestLocalPlayStartsWhileSpectatingWhenBeatmapBecomesAvailable() { createRoom(() => new Room { Name = { Value = "Test Room" }, Playlist = { new PlaylistItem { Beatmap = { Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0)).BeatmapInfo }, RulesetID = new OsuRuleset().RulesetInfo.OnlineID } } }); AddStep("delete beatmap", () => beatmaps.Delete(importedSet)); AddStep("join other user (ready, host)", () => { multiplayerClient.AddUser(new APIUser { Id = MultiplayerTestScene.PLAYER_1_ID, Username = "******" }); multiplayerClient.TransferHost(MultiplayerTestScene.PLAYER_1_ID); multiplayerClient.ChangeUserState(MultiplayerTestScene.PLAYER_1_ID, MultiplayerUserState.Ready); }); ClickButtonWhenEnabled <MultiplayerSpectateButton>(); AddUntilStep("wait for spectating user state", () => multiplayerClient.LocalUser?.State == MultiplayerUserState.Spectating); AddStep("start match externally", () => multiplayerClient.StartMatch()); AddStep("restore beatmap", () => { beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely(); importedSet = beatmaps.GetAllUsableBeatmapSets().First(); }); AddUntilStep("play started", () => multiplayerComponents.CurrentScreen is SpectatorScreen); }
public override void SetUpSteps() { base.SetUpSteps(); AddStep("import beatmap", () => { beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely(); importedSet = beatmaps.GetAllUsableBeatmapSets().First(); InitialBeatmap = importedSet.Beatmaps.First(b => b.Ruleset.OnlineID == 0); OtherBeatmap = importedSet.Beatmaps.Last(b => b.Ruleset.OnlineID == 0); }); AddStep("load multiplayer", () => LoadScreen(multiplayerComponents = new TestMultiplayerComponents())); AddUntilStep("wait for multiplayer to load", () => multiplayerComponents.IsLoaded); AddUntilStep("wait for lounge to load", () => this.ChildrenOfType <MultiplayerLoungeSubScreen>().FirstOrDefault()?.IsLoaded == true); AddUntilStep("wait for lounge", () => multiplayerComponents.ChildrenOfType <LoungeSubScreen>().SingleOrDefault()?.IsLoaded == true); AddStep("open room", () => multiplayerComponents.ChildrenOfType <LoungeSubScreen>().Single().Open(new Room { Name = { Value = "Test Room" }, QueueMode = { Value = Mode }, Playlist = { new PlaylistItem { Beatmap = { Value = InitialBeatmap }, RulesetID = new OsuRuleset().RulesetInfo.OnlineID } } })); AddUntilStep("wait for room open", () => this.ChildrenOfType <MultiplayerMatchSubScreen>().FirstOrDefault()?.IsLoaded == true); AddWaitStep("wait for transition", 2); ClickButtonWhenEnabled <MultiplayerMatchSettingsOverlay.CreateOrUpdateButton>(); AddUntilStep("wait for join", () => MultiplayerClient.RoomJoined); }
public void TestOnlineScoreIsAvailableLocally() { using (HeadlessGameHost host = new CleanRunHeadlessGameHost()) { try { var osu = LoadOsuIntoHost(host, true); var beatmap = BeatmapImportHelper.LoadOszIntoOsu(osu, TestResources.GetQuickTestBeatmapForImport()).GetResultSafely(); LoadScoreIntoOsu(osu, new ScoreInfo { User = new APIUser { Username = "******" }, BeatmapInfo = beatmap.Beatmaps.First(), Ruleset = new OsuRuleset().RulesetInfo, OnlineID = 2 }, new TestArchiveReader()); 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 Assert.That(scoreManager.IsAvailableLocally(new ScoreInfo { User = new APIUser { Username = "******" }, BeatmapInfo = beatmap.Beatmaps.First(), OnlineID = 2 })); } finally { host.Exit(); } } }
public void SetUp() => Schedule(() => { beatmaps.AllowImport = new TaskCompletionSource <bool>(); testBeatmapFile = TestResources.GetQuickTestBeatmapForImport(); testBeatmapInfo = getTestBeatmapInfo(testBeatmapFile); testBeatmapSet = testBeatmapInfo.BeatmapSet; Realm.Write(r => r.RemoveAll <BeatmapSetInfo>()); Realm.Write(r => r.RemoveAll <BeatmapInfo>()); selectedItem.Value = new PlaylistItem { Beatmap = { Value = testBeatmapInfo }, RulesetID = testBeatmapInfo.Ruleset.OnlineID, }; Child = availabilityTracker = new OnlinePlayBeatmapAvailabilityTracker { SelectedItem = { BindTarget = selectedItem, } }; });
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.Cache(rulesetStore = new RulesetStore(Realm)); dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, Realm, rulesetStore, null, dependencies.Get <AudioManager>(), Resources, dependencies.Get <GameHost>(), Beatmap.Default)); dependencies.Cache(scoreManager = new ScoreManager(dependencies.Get <RulesetStore>(), () => beatmapManager, LocalStorage, Realm, Scheduler)); Dependencies.Cache(Realm); var imported = beatmapManager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).GetResultSafely(); imported?.PerformRead(s => { beatmapInfo = s.Beatmaps[0]; for (int i = 0; i < 50; i++) { var score = new ScoreInfo { OnlineID = i, BeatmapInfo = beatmapInfo, Accuracy = RNG.NextDouble(), TotalScore = RNG.Next(1, 1000000), MaxCombo = RNG.Next(1, 1000), Rank = ScoreRank.XH, User = new APIUser { Username = "******" }, Ruleset = new OsuRuleset().RulesetInfo, }; importedScores.Add(scoreManager.Import(score).Value); } }); return(dependencies); }
public new void Setup() => Schedule(() => { AvailabilityTracker.SelectedItem.BindTo(selectedItem); beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely(); importedSet = beatmaps.GetAllUsableBeatmapSets().First(); Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First()); selectedItem.Value = new PlaylistItem(Beatmap.Value.BeatmapInfo) { RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID }; Child = new PopoverContainer { RelativeSizeAxes = Axes.Both, Child = control = new MatchStartControl { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(250, 50), } }; });