dialogues stuff & porting WIP 8
This commit is contained in:
@@ -63,6 +63,7 @@ class DialogueCutscene extends Cutscene {
|
||||
|
||||
// Add lines
|
||||
for(node in dialogueData.nodes.line) {
|
||||
var volume:Null<Float> = 0.8;
|
||||
var line:DialogueLine = {
|
||||
text: XMLUtil.fixXMLText(node.innerHTML),
|
||||
char: node.getAtt('char').getDefault('boyfriend'),
|
||||
@@ -70,7 +71,8 @@ class DialogueCutscene extends Cutscene {
|
||||
callback: node.getAtt('callback'),
|
||||
changeDefAnim: node.getAtt('changeDefAnim'),
|
||||
speed: node.has.speed ? Std.parseFloat(node.att.speed).getDefault(0.05) : 0.05,
|
||||
changeMusic: node.has.changeMusic ? FlxG.sound.load(Paths.music(node.getAtt('changeMusic')), 0.8, true) : null,
|
||||
musicVolume: node.has.musicVolume ? (volume = Std.parseFloat(node.att.speed).getDefault(0.8)) : null,
|
||||
changeMusic: node.has.changeMusic ? FlxG.sound.load(Paths.music(node.getAtt('changeMusic')), volume, true) : null,
|
||||
playSound: node.has.playSound ? FlxG.sound.load(Paths.sound(node.getAtt('playSound'))) : null,
|
||||
nextSound: node.has.nextSound ? FlxG.sound.load(Paths.music(node.getAtt('nextSound'))) : null,
|
||||
textSound: null
|
||||
@@ -100,7 +102,11 @@ class DialogueCutscene extends Cutscene {
|
||||
|
||||
public override function update(elapsed:Float) {
|
||||
super.update(elapsed);
|
||||
if(controls.ACCEPT) next();
|
||||
if(controls.ACCEPT) {
|
||||
@:privateAccess
|
||||
if(dialogueBox.dialogueEnded) next();
|
||||
else dialogueBox.text.skip();
|
||||
}
|
||||
}
|
||||
|
||||
public var canProceed:Bool = true;
|
||||
@@ -138,7 +144,7 @@ class DialogueCutscene extends Cutscene {
|
||||
curMusic = curLine.changeMusic;
|
||||
curMusic.play();
|
||||
curMusic.fadeIn(1, 0, curMusic.volume);
|
||||
}
|
||||
} else if(curLine.musicVolume != null && curMusic != null) curMusic.volume = curLine.musicVolume;
|
||||
}
|
||||
|
||||
public override function close() {
|
||||
@@ -165,6 +171,7 @@ typedef DialogueLine = {
|
||||
var bubble:String;
|
||||
var callback:String;
|
||||
var speed:Float;
|
||||
var musicVolume:Null<Float>;
|
||||
var changeMusic:FlxSound;
|
||||
var playSound:FlxSound;
|
||||
var nextSound:FlxSound;
|
||||
|
||||
@@ -13,6 +13,7 @@ import haxe.xml.Access;
|
||||
class DialogueBox extends FunkinSprite {
|
||||
public var dialogueBoxData:Access;
|
||||
public var positions:Map<String, CharPosDef> = [];
|
||||
public var dialogueEnded:Bool = false; // Using text._typing is also fair but it doesnt check for eventual opening anims! - Nex
|
||||
|
||||
public var nextSFX:String = Paths.sound('dialogue/next');
|
||||
public var defaultTextTypeSFX:Array<FlxSound>;
|
||||
@@ -127,8 +128,12 @@ class DialogueBox extends FunkinSprite {
|
||||
|
||||
if(event.customSFX != null) event.customSFX.play();
|
||||
else if(event.allowDefault) FlxG.sound.play(nextSFX);
|
||||
var idk:Void->Void = () -> if(text != null && text.trim().length > 0) setText(event.text, event.speed, event.customTypeSFX);
|
||||
var idk:Void->Void = () -> {
|
||||
if(text != null && text.trim().length > 0) setText(event.text, event.speed, event.customTypeSFX);
|
||||
else dialogueEnded = true;
|
||||
}
|
||||
|
||||
dialogueEnded = false;
|
||||
this.text.resetText('');
|
||||
var anim:String = event.bubble + event.suffix;
|
||||
if(hasAnimation(anim)) playAnim(anim, true);
|
||||
@@ -152,6 +157,7 @@ class DialogueBox extends FunkinSprite {
|
||||
this.text.sounds = event.customTypeSFX != null ? event.customTypeSFX : defaultTextTypeSFX;
|
||||
this.text.delay = event.speed;
|
||||
this.text.start(event.speed, true);
|
||||
this.text.completeCallback = () -> dialogueEnded = true;
|
||||
}
|
||||
|
||||
public override function destroy() {
|
||||
|
||||
Reference in New Issue
Block a user