mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-24 22:26:50 +00:00
Merge pull request #644 from FunkinCrew/abnormalpoof/cutscene-auto-pause
[PUBLIC PR] Automatically pause video cutscenes when tabbing away from the game
This commit is contained in:
commit
eddfa23955
|
@ -1301,12 +1301,18 @@ class PlayState extends MusicBeatSubState
|
|||
super.closeSubState();
|
||||
}
|
||||
|
||||
#if discord_rpc
|
||||
/**
|
||||
* Function called when the game window gains focus.
|
||||
*/
|
||||
public override function onFocus():Void
|
||||
{
|
||||
if (VideoCutscene.isPlaying() && FlxG.autoPause && isGamePaused) VideoCutscene.pauseVideo();
|
||||
#if html5
|
||||
else
|
||||
VideoCutscene.resumeVideo();
|
||||
#end
|
||||
|
||||
#if discord_rpc
|
||||
if (health > Constants.HEALTH_MIN && !paused && FlxG.autoPause)
|
||||
{
|
||||
if (Conductor.instance.songPosition > 0.0) DiscordClient.changePresence(detailsText, currentSong.song
|
||||
|
@ -1318,6 +1324,7 @@ class PlayState extends MusicBeatSubState
|
|||
else
|
||||
DiscordClient.changePresence(detailsText, currentSong.song + ' (' + storyDifficultyText + ')', iconRPC);
|
||||
}
|
||||
#end
|
||||
|
||||
super.onFocus();
|
||||
}
|
||||
|
@ -1327,12 +1334,17 @@ class PlayState extends MusicBeatSubState
|
|||
*/
|
||||
public override function onFocusLost():Void
|
||||
{
|
||||
#if html5
|
||||
if (FlxG.autoPause) VideoCutscene.pauseVideo();
|
||||
#end
|
||||
|
||||
#if discord_rpc
|
||||
if (health > Constants.HEALTH_MIN && !paused && FlxG.autoPause) DiscordClient.changePresence(detailsPausedText,
|
||||
currentSong.song + ' (' + storyDifficultyText + ')', iconRPC);
|
||||
#end
|
||||
|
||||
super.onFocusLost();
|
||||
}
|
||||
#end
|
||||
|
||||
/**
|
||||
* Removes any references to the current stage, then clears the stage cache,
|
||||
|
|
|
@ -145,7 +145,7 @@ class VideoCutscene
|
|||
{
|
||||
vid.zIndex = 0;
|
||||
vid.bitmap.onEndReached.add(finishVideo.bind(0.5));
|
||||
vid.autoPause = false;
|
||||
vid.autoPause = FlxG.autoPause;
|
||||
|
||||
vid.cameras = [PlayState.instance.camCutscene];
|
||||
|
||||
|
|
Loading…
Reference in a new issue