mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-11-25 21:55:55 +00:00
Fixes to cutscene pausing.
This commit is contained in:
parent
5d030b8a31
commit
8683900922
|
|
@ -40,6 +40,23 @@ class FlxVideo extends FlxBasic
|
||||||
netStream.play(videoPath);
|
netStream.play(videoPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function pauseVideo():Void
|
||||||
|
{
|
||||||
|
if (netStream != null)
|
||||||
|
{
|
||||||
|
netStream.pause();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resumeVideo():Void
|
||||||
|
{
|
||||||
|
// Resume playing the video.
|
||||||
|
if (netStream != null)
|
||||||
|
{
|
||||||
|
netStream.resume();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function restartVideo():Void
|
public function restartVideo():Void
|
||||||
{
|
{
|
||||||
// Seek to the beginning of the video.
|
// Seek to the beginning of the video.
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ class PauseSubState extends MusicBeatSubState
|
||||||
var background:FunkinSprite;
|
var background:FunkinSprite;
|
||||||
var metadata:FlxTypedSpriteGroup<FlxText>;
|
var metadata:FlxTypedSpriteGroup<FlxText>;
|
||||||
var metadataPractice:FlxText;
|
var metadataPractice:FlxText;
|
||||||
|
var metadataDeaths:FlxText;
|
||||||
var menuEntryText:FlxTypedSpriteGroup<AtlasText>;
|
var menuEntryText:FlxTypedSpriteGroup<AtlasText>;
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
|
|
@ -172,9 +173,8 @@ class PauseSubState extends MusicBeatSubState
|
||||||
metadataDifficulty.scrollFactor.set(0, 0);
|
metadataDifficulty.scrollFactor.set(0, 0);
|
||||||
metadata.add(metadataDifficulty);
|
metadata.add(metadataDifficulty);
|
||||||
|
|
||||||
var metadataDeaths:FlxText = new FlxText(20, 15 + 64, FlxG.width - 40, '0 Blue Balls');
|
metadataDeaths = new FlxText(20, 15 + 64, FlxG.width - 40, '${PlayState.instance?.deathCounter} Blue Balls');
|
||||||
metadataDeaths.setFormat(Paths.font('vcr.ttf'), 32, FlxColor.WHITE, FlxTextAlign.RIGHT);
|
metadataDeaths.setFormat(Paths.font('vcr.ttf'), 32, FlxColor.WHITE, FlxTextAlign.RIGHT);
|
||||||
metadataDeaths.text = '${PlayState.instance?.deathCounter} Blue Balls';
|
|
||||||
metadataDeaths.scrollFactor.set(0, 0);
|
metadataDeaths.scrollFactor.set(0, 0);
|
||||||
metadata.add(metadataDeaths);
|
metadata.add(metadataDeaths);
|
||||||
|
|
||||||
|
|
@ -183,6 +183,8 @@ class PauseSubState extends MusicBeatSubState
|
||||||
metadataPractice.visible = PlayState.instance?.isPracticeMode ?? false;
|
metadataPractice.visible = PlayState.instance?.isPracticeMode ?? false;
|
||||||
metadataPractice.scrollFactor.set(0, 0);
|
metadataPractice.scrollFactor.set(0, 0);
|
||||||
metadata.add(metadataPractice);
|
metadata.add(metadataPractice);
|
||||||
|
|
||||||
|
updateMetadataText();
|
||||||
}
|
}
|
||||||
|
|
||||||
function regenerateMenu(?targetMode:PauseMode):Void
|
function regenerateMenu(?targetMode:PauseMode):Void
|
||||||
|
|
@ -250,11 +252,28 @@ class PauseSubState extends MusicBeatSubState
|
||||||
currentMenuEntries.remove(entry);
|
currentMenuEntries.remove(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
metadataPractice.visible = PlayState.instance?.isPracticeMode ?? false;
|
updateMetadataText();
|
||||||
|
|
||||||
changeSelection();
|
changeSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateMetadataText():Void
|
||||||
|
{
|
||||||
|
metadataPractice.visible = PlayState.instance?.isPracticeMode ?? false;
|
||||||
|
|
||||||
|
switch (this.currentMode)
|
||||||
|
{
|
||||||
|
case Standard | Difficulty:
|
||||||
|
metadataDeaths.text = '${PlayState.instance?.deathCounter} Blue Balls';
|
||||||
|
case Charting:
|
||||||
|
metadataDeaths.text = 'Chart Editor Preview';
|
||||||
|
case Conversation:
|
||||||
|
metadataDeaths.text = 'Dialogue Paused';
|
||||||
|
case Cutscene:
|
||||||
|
metadataDeaths.text = 'Video Paused';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function transitionIn():Void
|
function transitionIn():Void
|
||||||
{
|
{
|
||||||
FlxTween.tween(background, {alpha: 0.6}, 0.4, {ease: FlxEase.quartInOut});
|
FlxTween.tween(background, {alpha: 0.6}, 0.4, {ease: FlxEase.quartInOut});
|
||||||
|
|
@ -339,6 +358,9 @@ class PauseSubState extends MusicBeatSubState
|
||||||
// ===============
|
// ===============
|
||||||
static function resume(state:PauseSubState):Void
|
static function resume(state:PauseSubState):Void
|
||||||
{
|
{
|
||||||
|
// Resume a paused video if it exists.
|
||||||
|
VideoCutscene.resumeVideo();
|
||||||
|
|
||||||
state.close();
|
state.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2480,6 +2480,8 @@ class PlayState extends MusicBeatSubState
|
||||||
// This is a video cutscene.
|
// This is a video cutscene.
|
||||||
if (controls.PAUSE && !justUnpaused)
|
if (controls.PAUSE && !justUnpaused)
|
||||||
{
|
{
|
||||||
|
VideoCutscene.pauseVideo();
|
||||||
|
|
||||||
var pauseSubState:FlxSubState = new PauseSubState({mode: Cutscene});
|
var pauseSubState:FlxSubState = new PauseSubState({mode: Cutscene});
|
||||||
|
|
||||||
persistentUpdate = false;
|
persistentUpdate = false;
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ class VideoCutscene
|
||||||
{
|
{
|
||||||
vid.zIndex = 0;
|
vid.zIndex = 0;
|
||||||
vid.bitmap.onEndReached.add(finishVideo.bind(0.5));
|
vid.bitmap.onEndReached.add(finishVideo.bind(0.5));
|
||||||
|
vid.autoPause = false;
|
||||||
|
|
||||||
vid.cameras = [PlayState.instance.camCutscene];
|
vid.cameras = [PlayState.instance.camCutscene];
|
||||||
|
|
||||||
|
|
@ -136,7 +137,7 @@ class VideoCutscene
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
public static function restartVideo():Void
|
public static function restartVideo(resume:Bool = true):Void
|
||||||
{
|
{
|
||||||
#if html5
|
#if html5
|
||||||
if (vid != null)
|
if (vid != null)
|
||||||
|
|
@ -150,6 +151,45 @@ class VideoCutscene
|
||||||
{
|
{
|
||||||
// Seek to the start of the video.
|
// Seek to the start of the video.
|
||||||
vid.bitmap.time = 0;
|
vid.bitmap.time = 0;
|
||||||
|
if (resume)
|
||||||
|
{
|
||||||
|
// Resume the video if it was paused.
|
||||||
|
vid.resume();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function pauseVideo():Void
|
||||||
|
{
|
||||||
|
#if html5
|
||||||
|
if (vid != null)
|
||||||
|
{
|
||||||
|
vid.pauseVideo();
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
#if hxCodec
|
||||||
|
if (vid != null)
|
||||||
|
{
|
||||||
|
vid.pause();
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function resumeVideo():Void
|
||||||
|
{
|
||||||
|
#if html5
|
||||||
|
if (vid != null)
|
||||||
|
{
|
||||||
|
vid.resumeVideo();
|
||||||
|
}
|
||||||
|
#end
|
||||||
|
|
||||||
|
#if hxCodec
|
||||||
|
if (vid != null)
|
||||||
|
{
|
||||||
|
vid.resume();
|
||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue