From fc70fbb40fd7902f195e1207a4dbefbee05e6911 Mon Sep 17 00:00:00 2001 From: Kinsi Date: Sat, 25 Dec 2021 21:47:01 +0100 Subject: [PATCH] =?UTF-8?q?Result=20screen=20=F0=9F=98=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppLogic/MapPool.cs | 11 ++- AppLogic/RequestManager.cs | 2 +- AppLogic/ShaffuruSongList.cs | 49 +++++++++++ AppLogic/SongQueueManager.cs | 70 +++++++--------- GameLogic/QueueProcessor.cs | 34 +++----- Installers/AppInstaller.cs | 2 + Installers/MenuInstaller.cs | 5 +- MenuLogic/Anlasser.cs | 11 ++- MenuLogic/UI/FlowCoordinator.cs | 74 +++++++++++++++-- MenuLogic/UI/ResultUI.cs | 124 ++++++++++++++++++++++++++++ MenuLogic/UI/SetupUI.cs | 10 ++- MenuLogic/UI/Views/result.bsml | 30 +++++++ MenuLogic/UI/{ => Views}/setup.bsml | 7 +- Shaffuru.csproj | 7 +- 14 files changed, 349 insertions(+), 87 deletions(-) create mode 100644 AppLogic/ShaffuruSongList.cs create mode 100644 MenuLogic/UI/ResultUI.cs create mode 100644 MenuLogic/UI/Views/result.bsml rename MenuLogic/UI/{ => Views}/setup.bsml (96%) diff --git a/AppLogic/MapPool.cs b/AppLogic/MapPool.cs index 3dca17c..8cde271 100644 --- a/AppLogic/MapPool.cs +++ b/AppLogic/MapPool.cs @@ -47,6 +47,7 @@ public void SetDiffValid(BeatmapDifficulty diff) { } } + public IPreviewBeatmapLevel[] allLevels { get; private set; } public ValidSong[] filteredLevels { get; private set; } public IReadOnlyDictionary requestableLevels { get; private set; } @@ -60,6 +61,7 @@ public string GetHashFromBeatsaverId(string mapKey) { public void Clear() { filteredLevels = null; requestableLevels = null; + allLevels = null; } public void Dispose() => Clear(); @@ -70,8 +72,11 @@ public async Task ProcessBeatmapPool() { var maps = beatmapLevelsModel .allLoadedBeatmapLevelPackCollection.beatmapLevelPacks .Where(x => !(x is PreviewBeatmapLevelPackSO)) - .SelectMany(x => x.beatmapLevelCollection.beatmapLevels) - .Where(x => x.songDuration - x.songTimeOffset >= minLength); + .SelectMany(x => x.beatmapLevelCollection.beatmapLevels); + + allLevels = maps.ToArray(); + + maps = maps.Where(x => x.songDuration - x.songTimeOffset >= minLength); ConditionalWeakTable playlistSongs = null; @@ -248,6 +253,8 @@ public static string GetHashOfLevelid(string levelid) { return levelid.Substring(13, 40); } + + // Removes WIP etc from the end of the levelID that SongCore happens to add for duplicate songs with the same hash public static string GetLevelIdWithoutUniquenessAddition(string levelid) { if(levelid.Length <= 53) return levelid; diff --git a/AppLogic/RequestManager.cs b/AppLogic/RequestManager.cs index 14041c2..973c65c 100644 --- a/AppLogic/RequestManager.cs +++ b/AppLogic/RequestManager.cs @@ -126,7 +126,7 @@ private void Twitch_OnTextMessageReceived(IChatService _, IChatMessage message) if(diff == -1) diff = (int)theMappe.GetRandomValidDiff(); - var queued = songQueueManager.EnqueueSong(new QueuedSong( + var queued = songQueueManager.EnqueueSong(new ShaffuruSong( $"custom_level_{hash}", diff, startTime, diff --git a/AppLogic/ShaffuruSongList.cs b/AppLogic/ShaffuruSongList.cs new file mode 100644 index 0000000..e23b64a --- /dev/null +++ b/AppLogic/ShaffuruSongList.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Shaffuru.AppLogic { + public class ShaffuruSong { + public string levelId { get; protected set; } + public int diffIndex { get; protected set; } = -1; + public float startTime { get; protected set; } + public float length { get; protected set; } + public string source { get; protected set; } + + public IPreviewBeatmapLevel level { get; protected set; } + + public ShaffuruSong(string levelId, int diffIndex, float startTime = -1, float length = -1, string source = null) { + this.levelId = levelId; + this.diffIndex = diffIndex; + this.startTime = startTime; + this.length = length; + this.source = source; + } + + public ShaffuruSong(string levelId, BeatmapDifficulty diff, float startTime = -1, float length = -1, string source = null) { + this.levelId = levelId; + this.diffIndex = (int)diff; + this.startTime = startTime; + this.length = length; + this.source = source; + } + } + + class ShaffuruSongList { + protected readonly List _list; + + public IReadOnlyList list => _list; + + public ShaffuruSongList(ShaffuruSong[] songs = null) { + _list = songs?.ToList() ?? new List(69); + } + } + + class PlayedSongList : ShaffuruSongList { + public void Clear() => _list.Clear(); + + public void Add(ShaffuruSong song) => _list.Add(song); + } +} diff --git a/AppLogic/SongQueueManager.cs b/AppLogic/SongQueueManager.cs index c3adc66..58c9646 100644 --- a/AppLogic/SongQueueManager.cs +++ b/AppLogic/SongQueueManager.cs @@ -5,52 +5,28 @@ namespace Shaffuru.AppLogic { class SongQueueManager { - public class QueuedSong { - public string levelId { get; private set; } - public int diffIndex { get; private set; } = -1; - public float startTime { get; private set; } - public float length { get; private set; } - public string source { get; private set; } - - public QueuedSong(string levelId, int diffIndex, float startTime = -1, float length = -1, string source = null) { - this.levelId = levelId; - this.diffIndex = diffIndex; - this.startTime = startTime; - this.length = length; - this.source = source; - } - - public QueuedSong(string levelId, BeatmapDifficulty diff, float startTime = -1, float length = -1, string source = null) { - this.levelId = levelId; - this.diffIndex = (int)diff; - this.startTime = startTime; - this.length = length; - this.source = source; - } - } - - static Queue queue; - public static RollingList history { get; private set; } + static Queue queue; + public static RollingList requeueBlockList { get; private set; } readonly MapPool mapPool; public SongQueueManager(MapPool mapPool) { this.mapPool = mapPool; - queue ??= new Queue(); + queue ??= new Queue(); - if(history == null) { - history = new RollingList(Config.Instance.queue_requeueLimit); + if(requeueBlockList == null) { + requeueBlockList = new RollingList(Config.Instance.queue_requeueLimit); } else { - history.SetSize(Config.Instance.queue_requeueLimit); + requeueBlockList.SetSize(Config.Instance.queue_requeueLimit); } } public bool EnqueueSong(string levelId, BeatmapDifficulty difficulty, float startTime = -1, float length = -1, string source = null) { - return EnqueueSong(new QueuedSong(levelId, difficulty, startTime, length, source)); + return EnqueueSong(new ShaffuruSong(levelId, difficulty, startTime, length, source)); } - public bool EnqueueSong(QueuedSong queuedSong) { + public bool EnqueueSong(ShaffuruSong queuedSong) { if(IsFull()) return false; @@ -63,20 +39,34 @@ public bool EnqueueSong(QueuedSong queuedSong) { public void Clear() => queue?.Clear(); - public QueuedSong DequeueSong() { - if(queue.Count == 0) - return null; + public ShaffuruSong GetNextSong() { + ShaffuruSong x; + + if(queue.Count == 0) { + var levels = mapPool.filteredLevels.Where(x => !SongQueueManager.requeueBlockList.Contains(x.level.levelID)); - var x = queue.Dequeue(); + // Shouldnt ever be the case, failsafe + if(levels.Count() == 0) + return null; + + // Basegame always Initializes the RNG with seed 0 on scene change.. That would be kinda not very RNG probably maybe. Cant hurt. + UnityEngine.Random.InitState((int)DateTime.Now.Ticks); + + var l = levels.ElementAt(UnityEngine.Random.Range(0, levels.Count())); + + x = new ShaffuruSong(l.level.levelID, l.GetRandomValidDiff(), -1, -1, null); + } else { + x = queue.Dequeue(); + } - history.Add(MapPool.GetLevelIdWithoutUniquenessAddition(x.levelId)); + requeueBlockList.Add(MapPool.GetLevelIdWithoutUniquenessAddition(x.levelId)); return x; } - public int Count(Func action) => queue.Count(action); - public bool Contains(Func action) => queue.Any(action); - public bool IsInHistory(string levelId) => history?.Contains(MapPool.GetLevelIdWithoutUniquenessAddition(levelId)) == true; + public int Count(Func action) => queue.Count(action); + public bool Contains(Func action) => queue.Any(action); + public bool IsInHistory(string levelId) => requeueBlockList.Contains(MapPool.GetLevelIdWithoutUniquenessAddition(levelId)) == true; public bool IsEmpty() => queue.Count == 0; public bool IsFull() => queue.Count >= Config.Instance.queue_sizeLimit; diff --git a/GameLogic/QueueProcessor.cs b/GameLogic/QueueProcessor.cs index fd09f9b..fb82f3e 100644 --- a/GameLogic/QueueProcessor.cs +++ b/GameLogic/QueueProcessor.cs @@ -22,13 +22,17 @@ class QueueProcessor : IInitializable, ITickable { static readonly FieldInfo FIELD_PauseMenuManager_InitData_beatmapDifficulty = AccessTools.Field(typeof(PauseMenuManager.InitData), "beatmapDifficulty"); readonly PauseMenuManager.InitData pauseMenuManager_InitData; + + readonly PlayedSongList playedSongList; + public QueueProcessor( BeatmapLoader beatmapLoader, BeatmapSwitcher beatmapSwitcher, SongQueueManager songQueueManager, MapPool mapPool, AudioTimeSyncController audioTimeSyncController, - PauseMenuManager.InitData pauseMenuManager_InitData + PauseMenuManager.InitData pauseMenuManager_InitData, + PlayedSongList playedSongList ) { this.beatmapLoader = beatmapLoader; this.beatmapSwitcher = beatmapSwitcher; @@ -36,6 +40,7 @@ PauseMenuManager.InitData pauseMenuManager_InitData this.mapPool = mapPool; this.audioTimeSyncController = audioTimeSyncController; this.pauseMenuManager_InitData = pauseMenuManager_InitData; + this.playedSongList = playedSongList; } public void Initialize() { @@ -49,7 +54,7 @@ public void Initialize() { bool isQueueingNewSong = false; public async void Tick() { - if(audioTimeSyncController.songTime < switchToNextBeatmapAt || isQueueingNewSong) + if(isQueueingNewSong || audioTimeSyncController.songTime < switchToNextBeatmapAt) return; // Dont queue a new song in the last 5 seconds... Kinda pointless @@ -58,27 +63,10 @@ public async void Tick() { isQueueingNewSong = true; - var queuedSong = songQueueManager.DequeueSong(); - - if(queuedSong == null) { - if(!Config.Instance.queue_pickRandomSongIfEmpty) - return; - - var levels = mapPool.filteredLevels.Where(x => !SongQueueManager.history.Contains(x.level.levelID)); - - // Shouldnt ever be the case, failsafe - if(levels.Count() == 0) - return; + var queuedSong = songQueueManager.GetNextSong(); - // Basegame always Initializes the RNG with seed 0 on scene change.. That would be kinda not very RNG probably maybe. Cant hurt. - UnityEngine.Random.InitState((int)DateTime.Now.Ticks); - - var x = levels.ElementAt(UnityEngine.Random.Range(0, levels.Count())); - - queuedSong = new QueuedSong(x.level.levelID, x.GetRandomValidDiff(), -1, -1, null); - - SongQueueManager.history.Add(x.level.levelID); - } + if(queuedSong == null) + return; IDifficultyBeatmap outDiff = null; IReadonlyBeatmapData outBeatmap = null; @@ -157,6 +145,8 @@ await Task.Run(async () => { beatmapSwitcher.SwitchToDifferentBeatmap(outDiff, outBeatmap, startTime, length); + playedSongList.Add(new ShaffuruSong(queuedSong.levelId, outDiff.difficulty, startTime, length, queuedSong.source)); + FIELD_PauseMenuManager_InitData_previewBeatmapLevel.SetValue(pauseMenuManager_InitData, loadedBeatmap.beatmapLevel); FIELD_PauseMenuManager_InitData_beatmapDifficulty.SetValue(pauseMenuManager_InitData, outDiff.difficulty); diff --git a/Installers/AppInstaller.cs b/Installers/AppInstaller.cs index b1a1119..ab6fab2 100644 --- a/Installers/AppInstaller.cs +++ b/Installers/AppInstaller.cs @@ -4,6 +4,8 @@ namespace Shaffuru.Installers { class AppInstaller : MonoInstaller { public override void InstallBindings() { + Container.Bind().FromInstance(new PlayedSongList()).AsSingle(); + Container.BindInterfacesAndSelfTo().AsSingle().NonLazy(); Container.BindInterfacesAndSelfTo().AsSingle().NonLazy(); diff --git a/Installers/MenuInstaller.cs b/Installers/MenuInstaller.cs index 2560915..cf2f454 100644 --- a/Installers/MenuInstaller.cs +++ b/Installers/MenuInstaller.cs @@ -1,5 +1,5 @@ using Shaffuru.MenuLogic; -using Shaffuru.UI; +using Shaffuru.MenuLogic.UI; using SiraUtil; using Zenject; @@ -8,7 +8,8 @@ class MenuInstaller : MonoInstaller { public override void InstallBindings() { Container.Bind().AsSingle().NonLazy(); Container.Bind().FromNewComponentAsViewController().AsSingle(); - Container.Bind().To().FromNewComponentOnNewGameObject().AsSingle(); + Container.Bind().FromNewComponentAsViewController().AsSingle(); + Container.Bind().To().FromNewComponentOnNewGameObject().AsSingle(); //Container.Bind().AsSingle().NonLazy(); } } diff --git a/MenuLogic/Anlasser.cs b/MenuLogic/Anlasser.cs index 91c3b9a..afbedbd 100644 --- a/MenuLogic/Anlasser.cs +++ b/MenuLogic/Anlasser.cs @@ -34,6 +34,8 @@ BeatmapCharacteristicCollectionSO beatmapCharacteristicCollectionSO standardCharacteristic = beatmapCharacteristicCollectionSO.GetBeatmapCharacteristicBySerializedName("Standard"); } + public event Action finishedOrFailedCallback; + public void Start(int lengthSeconds) { beatmapLevel.beatmapLevelData.audioClip?.UnloadAudioData(); @@ -84,8 +86,15 @@ public void Start(int lengthSeconds) { null, (a, b) => { // TODO: Handle other cases in some way maybe? Some end stats screen? - if(b.levelEndAction == LevelCompletionResults.LevelEndAction.Restart) + if(b.levelEndAction == LevelCompletionResults.LevelEndAction.Restart) { Start(lengthSeconds); + } else if(b.levelEndStateType == LevelCompletionResults.LevelEndStateType.Cleared || + b.levelEndStateType == LevelCompletionResults.LevelEndStateType.Failed || + // If user is dum dum and plays with nofail and then backs out to menu we show this too because we are nice :) + b.energy == 0f + ) { + finishedOrFailedCallback?.Invoke(b); + } } ); } diff --git a/MenuLogic/UI/FlowCoordinator.cs b/MenuLogic/UI/FlowCoordinator.cs index cde0f6d..12b928c 100644 --- a/MenuLogic/UI/FlowCoordinator.cs +++ b/MenuLogic/UI/FlowCoordinator.cs @@ -3,11 +3,19 @@ using HMUI; using Zenject; using System; +using Shaffuru.MenuLogic.UI; +using Shaffuru.AppLogic; +using System.Collections; +using UnityEngine; +using static SelectLevelCategoryViewController; -namespace Shaffuru.UI { - class SetupFlowCoordinator : FlowCoordinator, IInitializable { - [Inject] SetupUI ui = null; - [Inject] GameplaySetupViewController gameplaySetupViewController = null; +namespace Shaffuru.MenuLogic.UI { + class ShaffuruFlowCoordinator : FlowCoordinator, IInitializable { + [Inject] readonly SetupUI ui = null; + [Inject] readonly ResultUI resultui = null; + [Inject] readonly GameplaySetupViewController gameplaySetupViewController = null; + [Inject] readonly PlayedSongList playedSongList = null; + [Inject] readonly Anlasser anlasser = null; protected override void DidActivate(bool firstActivation, bool addedToHierarchy, bool screenSystemEnabling) { if(firstActivation) { @@ -15,29 +23,77 @@ protected override void DidActivate(bool firstActivation, bool addedToHierarchy, showBackButton = true; gameplaySetupViewController.Setup(true, true, true, false, PlayerSettingsPanelController.PlayerSettingsPanelLayout.Singleplayer); - } - if(addedToHierarchy) { + anlasser.finishedOrFailedCallback += ShowResultView; + ProvideInitialViewControllers(ui, gameplaySetupViewController); + + resultui.closed += Resultui_closed; + resultui.playSong += Resultui_playSong; } } + private void Resultui_playSong(IPreviewBeatmapLevel obj) { + BeatSaberUI.MainFlowCoordinator.DismissFlowCoordinator(this, immediately: true); + SharedCoroutineStarter.instance.StartCoroutine(PlaySonge(obj)); + } + + [InjectOptional] readonly MainFlowCoordinator mainFlowCoordinator = null; + [InjectOptional] readonly LevelSearchViewController levelSearchViewController = null; + [Inject] readonly LevelFilteringNavigationController levelFilteringNavigationController = null; + [InjectOptional] readonly LevelCollectionNavigationController levelCollectionNavigationController = null; + + IEnumerator PlaySonge(IPreviewBeatmapLevel songe) { + mainFlowCoordinator.HandleMainMenuViewControllerDidFinish(null, MainMenuViewController.MenuButton.SoloFreePlay); + yield return null; + + levelSearchViewController?.ResetCurrentFilterParams(); + levelFilteringNavigationController.UpdateCustomSongs(); + + if(levelFilteringNavigationController.selectedLevelCategory.ToString() != nameof(LevelCategory.All)) + levelFilteringNavigationController.UpdateSecondChildControllerContent((LevelCategory)Enum.Parse(typeof(LevelCategory), nameof(LevelCategory.All))); + + yield return new WaitForEndOfFrame(); + // Reset again here. This is kind of a duct-tape fix for an edge-case of better song list + levelSearchViewController?.ResetCurrentFilterParams(); + levelCollectionNavigationController?.SelectLevel(songe); + } + + private void Resultui_closed() { + SetTitle("Shaffuru Setup"); + ProvideInitialViewControllers(ui, gameplaySetupViewController); + ReopenHack(); + } + protected override void BackButtonWasPressed(ViewController topViewController) { - BeatSaberUI.MainFlowCoordinator.DismissFlowCoordinator(this, null, ViewController.AnimationDirection.Horizontal); + BeatSaberUI.MainFlowCoordinator.DismissFlowCoordinator(this); } - public void ShowFlow() { + public void ShowSetupView() { var _parentFlow = BeatSaberUI.MainFlowCoordinator.YoungestChildFlowCoordinatorOrSelf(); BeatSaberUI.PresentFlowCoordinator(_parentFlow, this); } + // HAHABALLS + void ReopenHack() { + BeatSaberUI.MainFlowCoordinator.DismissFlowCoordinator(this, immediately: true); + ShowSetupView(); + } + + public void ShowResultView(LevelCompletionResults levelCompletionResults) { + SetTitle("Shaffuru Result"); + resultui.Setup(levelCompletionResults, playedSongList); + ProvideInitialViewControllers(resultui); + ReopenHack(); + } + static Action show; public void Initialize() { if(show == null) MenuButtons.instance.RegisterButton(new MenuButton("Shaffuru", " iufrkjedsfios", () => show(), true)); - show = ShowFlow; + show = ShowSetupView; } } } diff --git a/MenuLogic/UI/ResultUI.cs b/MenuLogic/UI/ResultUI.cs new file mode 100644 index 0000000..5bcf297 --- /dev/null +++ b/MenuLogic/UI/ResultUI.cs @@ -0,0 +1,124 @@ +using BeatSaberMarkupLanguage.Attributes; +using BeatSaberMarkupLanguage.Components; +using BeatSaberMarkupLanguage.ViewControllers; +using HMUI; +using Shaffuru.AppLogic; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using TMPro; +using UnityEngine; +using Zenject; + +namespace Shaffuru.MenuLogic.UI { + [HotReload(RelativePathToLayout = @"Views/result.bsml")] + [ViewDefinition("Shaffuru.MenuLogic.UI.Views.result.bsml")] + public class ResultUI : BSMLAutomaticViewController { + public event Action closed; + public event Action playSong; + + [UIAction("closexd")] void closexd() => closed.Invoke(); + + + [UIComponent("sessionResult")] TextMeshProUGUI sessionResult = null; + [UIComponent("sessionLength")] TextMeshProUGUI sessionLength = null; + [UIComponent("songCount")] TextMeshProUGUI songCount = null; + [UIComponent("sessionAcc")] TextMeshProUGUI sessionAcc = null; + + [UIComponent("songList")] public CustomCellListTableData songList = null; + + SongListSong lastSelectedSong; + void SongSelected(TableView tableView, SongListSong row) { + lastSelectedSong = row; + } + + void PlaySelected() { + playSong.Invoke(lastSelectedSong.preview); + } + + class SongListSong { + [UIComponent("cover")] ImageView cover = null; + + ShaffuruSong song = null; + internal IPreviewBeatmapLevel preview { get; private set; } + + string songName = ""; + string playTime = ""; + string diffAndSource = ""; + + + public SongListSong(ShaffuruSong song) { + this.song = song; + + preview = SongCore.Loader.BeatmapLevelsModelSO.GetLevelPreviewForLevelId(song.levelId); + + songName = preview?.songName ?? "Unknown song"; + playTime = string.Format(@" {0:mm\:ss} - {1:mm\:ss}", TimeSpan.FromSeconds(song.startTime), TimeSpan.FromSeconds(song.startTime + song.length)); + + if(song.source == null) { + diffAndSource = $"{(BeatmapDifficulty)song.diffIndex} (Randomly picked)"; + } else { + diffAndSource = $"{(BeatmapDifficulty)song.diffIndex} (Added by {song.source})"; + } + } + + [UIComponent("bgContainer")] ImageView bg = null; + + [UIAction("#post-parse")] + void Parsed() { + bg.color = new Color(0, 0, 0, 0.55f); + + cover.sprite = SongCore.Loader.defaultCoverImage; + preview.GetCoverImageAsync(CancellationToken.None).ContinueWith(x => { + cover.sprite = x.Result; + }, CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.FromCurrentSynchronizationContext()); + } + + [UIAction("refresh-visuals")] + void RefreshBgState(bool selected, bool highlighted) { + bg.color = new Color(0, 0, 0, selected ? 0.9f : highlighted ? 0.8f : 0.55f); + } + } + + public static LevelCompletionResults levelCompletionResult; + PlayedSongList playedSongList; + + [UIAction("#post-parse")] + void Parsed() { + if(songList == null) + return; + + var passed = levelCompletionResult.levelEndStateType == LevelCompletionResults.LevelEndStateType.Cleared && + levelCompletionResult.energy > 0; + + sessionResult.color = passed ? Color.green : Color.red; + sessionResult.text = passed ? "Passed PogU" : "Failed FeelsBadMan"; + + sessionLength.text = $"Session Length: {TimeSpan.FromSeconds(levelCompletionResult.endSongTime).ToString(@"mm\:ss")}"; + + var totalnotes = levelCompletionResult.goodCutsCount + levelCompletionResult.badCutsCount + levelCompletionResult.missedCount; + songCount.text = $"Songs Played: {playedSongList.list.Count} ({totalnotes} Notes)"; + + var maxScore = ScoreModel.MaxRawScoreForNumberOfNotes(totalnotes); + var score = levelCompletionResult.rawScore == 0 ? 0f : levelCompletionResult.rawScore / maxScore; + + sessionAcc.text = string.Format("Overall Accuracy: {0:0.00%}", score); + + songList.data = playedSongList.list.Select(x => new SongListSong(x)).ToList(); + songList.tableView.ReloadData(); + + songList.tableView.SelectCellWithIdx(0, true); + } + + + + internal void Setup(LevelCompletionResults levelCompletionResults, PlayedSongList playedSongList) { + ResultUI.levelCompletionResult = levelCompletionResults; + this.playedSongList = playedSongList; + Parsed(); + } + } +} diff --git a/MenuLogic/UI/SetupUI.cs b/MenuLogic/UI/SetupUI.cs index 7894bbb..9c177a5 100644 --- a/MenuLogic/UI/SetupUI.cs +++ b/MenuLogic/UI/SetupUI.cs @@ -15,14 +15,15 @@ using BeatSaberMarkupLanguage.Parser; using BeatSaberMarkupLanguage.Components.Settings; -namespace Shaffuru.UI { - [HotReload(RelativePathToLayout = @"setup.bsml")] - [ViewDefinition("Shaffuru.MenuLogic.UI.setup.bsml")] +namespace Shaffuru.MenuLogic.UI { + [HotReload(RelativePathToLayout = @"Views/setup.bsml")] + [ViewDefinition("Shaffuru.MenuLogic.UI.Views.setup.bsml")] class SetupUI : BSMLAutomaticViewController { Config config; [Inject] readonly MapPool mapPool = null; [Inject] readonly SongQueueManager songQueueManager = null; [Inject] readonly Anlasser anlasser = null; + [Inject] readonly PlayedSongList playedSongList = null; [UIParams] readonly BSMLParserParams parserParams = null; @@ -94,7 +95,7 @@ async void OpenStartModal() { if(playable > 0) { // We cannot require 2 songs to be played if the is only one.. - SongQueueManager.history.SetSize(Math.Min(playable - 1, Config.Instance.queue_requeueLimit)); + SongQueueManager.requeueBlockList.SetSize(Math.Min(playable - 1, Config.Instance.queue_requeueLimit)); } } @@ -103,6 +104,7 @@ async void OpenStartModal() { [UIAction("StartGame")] void StartGame() { + playedSongList.Clear(); anlasser.Start(60 * playDuration); } diff --git a/MenuLogic/UI/Views/result.bsml b/MenuLogic/UI/Views/result.bsml new file mode 100644 index 0000000..5160086 --- /dev/null +++ b/MenuLogic/UI/Views/result.bsml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +