Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/2_Core/Replayer/ReplayerMenuLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
using BeatLeader.Interop;
using BeatLeader.Models;
using BeatLeader.Models.AbstractReplay;
using BeatLeader.Models.AbstractReplay;

Check warning on line 10 in Source/2_Core/Replayer/ReplayerMenuLoader.cs

View workflow job for this annotation

GitHub Actions / Build

The using directive for 'BeatLeader.Models.AbstractReplay' appeared previously in this namespace
using BeatLeader.Models.Replay;
using BeatLeader.UI.Hub;
using BeatLeader.Utils;
using BeatSaber.BeatAvatarSDK;
using BeatSaber.BeatAvatarSDK;

Check warning on line 15 in Source/2_Core/Replayer/ReplayerMenuLoader.cs

View workflow job for this annotation

GitHub Actions / Build

The using directive for 'BeatSaber.BeatAvatarSDK' appeared previously in this namespace
using JetBrains.Annotations;
using ModestTree;
using SiraUtil.Tools.FPFC;
Expand Down Expand Up @@ -261,7 +261,7 @@
}

public async Task StartLastReplayAsync() {
if (Instance == null || ReplayManager.LastSavedReplay is not { } header) {
if (Instance == null || ReplayManager.LastPlayedReplay is not { } header) {
return;
}

Expand Down
7 changes: 4 additions & 3 deletions Source/7_Utils/Replays/ReplayManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,18 @@ private static async Task LoadReplayHeaderAsync(string path, CancellationToken t

#region ReplayManager SaveReplay

public static IReplayHeader? LastSavedReplay { get; private set; }
public static IReplayHeader? LastPlayedReplay { get; private set; }

/// <summary>
/// Writes a replay performing configuration checks.
/// </summary>
/// <param name="playEndData">Used for name formatting and validation checks, cannot be omitted.</param>
public static async Task<ReplaySavingResult> SaveReplayAsync(Replay replay, PlayEndData playEndData, CancellationToken token) {
LastSavedReplay = null;
LastPlayedReplay = null;

if (!ShouldSaveReplay(replay, playEndData)) {
Plugin.Log.Info("[ReplayManager] Validation failed, replay will not be saved!");
LastPlayedReplay = ReplayManager.CreateTempReplayHeader(replay, null);
return new(ReplaySavingError.ValidationFailed);
}

Expand Down Expand Up @@ -271,7 +272,7 @@ public static async Task<ReplaySavingResult> SaveAnyReplayAsync(Replay replay, P
var absolutePath = FileManager.GetAbsoluteReplayPath(name);
var header = CreateReplayHeader(absolutePath, replay.info);

LastSavedReplay = header;
LastPlayedReplay = header;
headers.Add(header);
hashedHeaders.Add(hash, header);

Expand Down
2 changes: 1 addition & 1 deletion Source/8_UI/Results/ResultsScreenUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected override void OnDestroy() {
}

public void Setup(BeatmapLevel level) {
_replayButton.Interactable = ReplayManager.LastSavedReplay is not null;
_replayButton.Interactable = ReplayManager.LastPlayedReplay is not null;

if (_newsViewController != null) {
var evt = _newsViewController.HappeningEvent.Value;
Expand Down
Loading