From 970ae1218983b71e07525d0bcff594456567bd37 Mon Sep 17 00:00:00 2001 From: NSGolova Date: Tue, 26 Dec 2023 13:58:32 +0000 Subject: [PATCH] Added practice attempts upload --- Source/2_Core/Models/LevelEndType.cs | 3 ++- Source/7_Utils/ReplayManager.cs | 2 +- Source/7_Utils/ScoreUtil.cs | 4 +--- .../ReplayLaunchView/BeatmapReplayLaunchPanel/ReplaysList.cs | 1 + 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/2_Core/Models/LevelEndType.cs b/Source/2_Core/Models/LevelEndType.cs index fa995505..f3340ea8 100644 --- a/Source/2_Core/Models/LevelEndType.cs +++ b/Source/2_Core/Models/LevelEndType.cs @@ -4,6 +4,7 @@ public enum LevelEndType { Clear = 1, Fail = 2, Restart = 3, - Quit = 4 + Quit = 4, + Practice = 5 } } \ No newline at end of file diff --git a/Source/7_Utils/ReplayManager.cs b/Source/7_Utils/ReplayManager.cs index 3c26c783..66516063 100644 --- a/Source/7_Utils/ReplayManager.cs +++ b/Source/7_Utils/ReplayManager.cs @@ -148,7 +148,7 @@ internal static bool ValidatePlay(Replay replay, PlayEndData endData, bool isOst var options = ConfigFileData.Instance.ReplaySavingOptions; return ConfigFileData.Instance.SaveLocalReplays && endData.EndType switch { LevelEndType.Fail => options.HasFlag(ReplaySaveOption.Fail), - LevelEndType.Quit or LevelEndType.Restart => options.HasFlag(ReplaySaveOption.Exit), + LevelEndType.Quit or LevelEndType.Restart or LevelEndType.Practice => options.HasFlag(ReplaySaveOption.Exit), LevelEndType.Clear => true, _ => false } && (options.HasFlag(ReplaySaveOption.ZeroScore) || replay.info.score != 0) diff --git a/Source/7_Utils/ScoreUtil.cs b/Source/7_Utils/ScoreUtil.cs index 8bebd7d6..31b56a95 100644 --- a/Source/7_Utils/ScoreUtil.cs +++ b/Source/7_Utils/ScoreUtil.cs @@ -29,9 +29,7 @@ private static bool ShouldSubmit() { public static void ProcessReplay(Replay replay, PlayEndData data) { if (replay.info.speed != 0) { - Plugin.Log.Debug("Practice, replay won't be submitted"); - SaveReplay(replay, data); - return; + data = new PlayEndData(LevelEndType.Practice, data.Time); } if (!ShouldSubmit()) { diff --git a/Source/8_UI/FlowCoordinator/Components/ReplayLaunchView/BeatmapReplayLaunchPanel/ReplaysList.cs b/Source/8_UI/FlowCoordinator/Components/ReplayLaunchView/BeatmapReplayLaunchPanel/ReplaysList.cs index 5a9c6f50..d5bdd960 100644 --- a/Source/8_UI/FlowCoordinator/Components/ReplayLaunchView/BeatmapReplayLaunchPanel/ReplaysList.cs +++ b/Source/8_UI/FlowCoordinator/Components/ReplayLaunchView/BeatmapReplayLaunchPanel/ReplaysList.cs @@ -186,6 +186,7 @@ protected override void OnConstruct() { TopRightText = info.LevelEndType switch { Clear => "Completed", Quit or Restart => "Unfinished", + Practice => "Practice", Fail => $"Failed at {FormatTime(Mathf.FloorToInt(ReplayHeader.ReplayInfo.FailTime))}", _ => "Unknown" };