2024-02-07 18:45:13 -05:00
|
|
|
package funkin.ui.debug.dialogue;
|
|
|
|
|
|
|
|
import flixel.FlxState;
|
|
|
|
import funkin.modding.events.ScriptEventDispatcher;
|
|
|
|
import funkin.modding.events.ScriptEvent;
|
|
|
|
import flixel.util.FlxColor;
|
|
|
|
import funkin.ui.MusicBeatState;
|
|
|
|
import funkin.data.dialogue.ConversationData;
|
|
|
|
import funkin.data.dialogue.ConversationRegistry;
|
|
|
|
import funkin.data.dialogue.DialogueBoxData;
|
|
|
|
import funkin.data.dialogue.DialogueBoxRegistry;
|
|
|
|
import funkin.data.dialogue.SpeakerData;
|
|
|
|
import funkin.data.dialogue.SpeakerRegistry;
|
2024-03-20 14:37:24 -04:00
|
|
|
import funkin.data.freeplay.AlbumRegistry;
|
2024-02-07 18:45:13 -05:00
|
|
|
import funkin.play.cutscene.dialogue.Conversation;
|
|
|
|
import funkin.play.cutscene.dialogue.DialogueBox;
|
|
|
|
import funkin.play.cutscene.dialogue.Speaker;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A state with displays a conversation with no background.
|
|
|
|
* Used for testing.
|
|
|
|
* @param conversationId The conversation to display.
|
|
|
|
*/
|
|
|
|
class ConversationDebugState extends MusicBeatState
|
|
|
|
{
|
|
|
|
final conversationId:String = 'senpai';
|
|
|
|
|
|
|
|
var conversation:Conversation;
|
|
|
|
|
|
|
|
public function new()
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
|
|
|
|
// TODO: Fix this BS
|
|
|
|
Paths.setCurrentLevel('week6');
|
|
|
|
}
|
|
|
|
|
|
|
|
public override function create():Void
|
|
|
|
{
|
2024-02-28 03:01:20 -05:00
|
|
|
super.create();
|
|
|
|
startConversation();
|
|
|
|
}
|
|
|
|
|
|
|
|
function startConversation():Void
|
|
|
|
{
|
|
|
|
if (conversation != null) return;
|
|
|
|
|
2024-02-07 18:45:13 -05:00
|
|
|
conversation = ConversationRegistry.instance.fetchEntry(conversationId);
|
2024-02-28 03:01:20 -05:00
|
|
|
if (conversation == null) return;
|
|
|
|
if (!conversation.alive) conversation.revive();
|
|
|
|
|
|
|
|
conversation.zIndex = 1000;
|
2024-02-07 18:45:13 -05:00
|
|
|
add(conversation);
|
2024-02-28 03:01:20 -05:00
|
|
|
refresh();
|
2024-02-07 18:45:13 -05:00
|
|
|
|
2024-02-28 03:01:20 -05:00
|
|
|
var event:ScriptEvent = new ScriptEvent(CREATE, false);
|
|
|
|
ScriptEventDispatcher.callEvent(conversation, event);
|
2024-02-07 18:45:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
function onConversationComplete():Void
|
|
|
|
{
|
|
|
|
remove(conversation);
|
|
|
|
conversation = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override function dispatchEvent(event:ScriptEvent):Void
|
|
|
|
{
|
|
|
|
// Dispatch event to conversation script.
|
|
|
|
ScriptEventDispatcher.callEvent(conversation, event);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override function update(elapsed:Float):Void
|
|
|
|
{
|
|
|
|
super.update(elapsed);
|
|
|
|
|
|
|
|
if (conversation != null)
|
|
|
|
{
|
2024-02-28 03:01:20 -05:00
|
|
|
if (controls.CUTSCENE_ADVANCE)
|
|
|
|
{
|
|
|
|
conversation.advanceConversation();
|
|
|
|
}
|
|
|
|
else if (controls.PAUSE)
|
|
|
|
{
|
|
|
|
conversation.kill();
|
|
|
|
remove(conversation);
|
|
|
|
conversation = null;
|
|
|
|
|
|
|
|
FlxG.switchState(() -> new ConversationDebugState());
|
|
|
|
}
|
2024-02-07 18:45:13 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|