Skip to content

Commit 604b698

Browse files
committed
Add property helper to check Game Launch API
1 parent 4cf0656 commit 604b698

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Utility/GameManagerExtension.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ public static class GameManagerExtension
2525
/// </summary>
2626
public class RunGameFromGameManagerContext
2727
{
28+
// Fields
29+
private bool? _canUseGameLaunchApi;
30+
2831
/// <summary>
2932
/// The game manager instance which handles the game launch.
3033
/// </summary>
@@ -49,6 +52,16 @@ public class RunGameFromGameManagerContext
4952
/// A delegate which is pointed to a callback to print game log while the game is running.
5053
/// </summary>
5154
public required PrintGameLog PrintGameLogCallback { get; init; }
55+
56+
/// <summary>
57+
/// Indicates whether the Game Launch API is supported on the plugin.
58+
/// </summary>
59+
public bool CanUseGameLaunchApi => _canUseGameLaunchApi ??= this.IsGameRunning(out _, out _);
60+
61+
/// <summary>
62+
/// Indicates whether the game is currently running.
63+
/// </summary>
64+
public bool IsGameRunning => CanUseGameLaunchApi && this.IsGameRunning(out bool running, out _) && running;
5265
}
5366

5467
/// <summary>

0 commit comments

Comments
 (0)