-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
swap movie running status to be IMovieRunner property
- Loading branch information
Showing
4 changed files
with
10 additions
and
35 deletions.
There are no files selected for viewing
37 changes: 6 additions & 31 deletions
37
UniTAS/Patcher/Implementations/GUI/TerminalCommands/MovieStatus.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,25 @@ | ||
using System; | ||
using JetBrains.Annotations; | ||
using MoonSharp.Interpreter; | ||
using UniTAS.Patcher.Interfaces.GUI; | ||
using UniTAS.Patcher.Services.Movie; | ||
|
||
namespace UniTAS.Patcher.Implementations.GUI.TerminalCommands; | ||
|
||
public class MovieStatus(IMovieRunnerEvents movieRunnerEvents) : TerminalCmd | ||
public class MovieStatus(IMovieRunner movieRunner) : TerminalCmd | ||
{ | ||
public override string Name => "movie_status"; | ||
public override string Description => "gets an object that contains movie status"; | ||
public override Delegate Callback => Execute; | ||
|
||
private Status Execute() | ||
{ | ||
return new(movieRunnerEvents); | ||
return new(movieRunner); | ||
} | ||
|
||
private class Status : IDisposable | ||
[method: MoonSharpHidden] | ||
private class Status(IMovieRunner movieRunner) | ||
{ | ||
private readonly IMovieRunnerEvents _movieRunnerEvents; | ||
|
||
[MoonSharpHidden] | ||
public Status(IMovieRunnerEvents movieRunnerEvents) | ||
{ | ||
_movieRunnerEvents = movieRunnerEvents; | ||
movieRunnerEvents.OnMovieSetup += SetupStart; | ||
movieRunnerEvents.OnMovieEnd += MovieEnd; | ||
} | ||
|
||
private void SetupStart() | ||
{ | ||
BasicallyRunning = true; | ||
} | ||
|
||
private void MovieEnd() | ||
{ | ||
BasicallyRunning = false; | ||
} | ||
|
||
// ReSharper disable once UnusedAutoPropertyAccessor.Local | ||
public bool BasicallyRunning { get; private set; } | ||
|
||
public void Dispose() | ||
{ | ||
_movieRunnerEvents.OnMovieSetup -= SetupStart; | ||
_movieRunnerEvents.OnMovieEnd -= MovieEnd; | ||
} | ||
[UsedImplicitly] public bool BasicallyRunning => movieRunner.SetupOrMovieRunning; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters