Skip to content

Commit

Permalink
Added practice attempts upload
Browse files Browse the repository at this point in the history
  • Loading branch information
NSGolova committed Dec 26, 2023
1 parent 021985a commit 970ae12
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Source/2_Core/Models/LevelEndType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ public enum LevelEndType {
Clear = 1,
Fail = 2,
Restart = 3,
Quit = 4
Quit = 4,
Practice = 5
}
}
2 changes: 1 addition & 1 deletion Source/7_Utils/ReplayManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions Source/7_Utils/ScoreUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
};
Expand Down

0 comments on commit 970ae12

Please sign in to comment.