1234567891011121314151617181920212223242526272829303132333435363738394041 |
- extends Control
- var dialogue_node: Node = null
- func _ready() -> void:
- visible = false
- func show_dialogue(player: Pawn, dialogue: Node) -> void:
- visible = true
- $Button.grab_focus()
- dialogue_node = dialogue
- for c in dialogue.get_signal_connection_list("dialogue_started"):
- if player == c.callable.get_object():
- dialogue_node.start_dialogue()
- $Name.text = "[center]" + dialogue_node.dialogue_name + "[/center]"
- $Text.text = dialogue_node.dialogue_text
- return
- dialogue_node.dialogue_started.connect(player.set_active.bind(false))
- dialogue_node.dialogue_finished.connect(player.set_active.bind(true))
- dialogue_node.dialogue_finished.connect(hide)
- dialogue_node.dialogue_finished.connect(_on_dialogue_finished.bind(player))
- dialogue_node.start_dialogue()
- $Name.text = "[center]" + dialogue_node.dialogue_name + "[/center]"
- $Text.text = dialogue_node.dialogue_text
- func _on_Button_button_up() -> void:
- dialogue_node.next_dialogue()
- $Name.text = "[center]" + dialogue_node.dialogue_name + "[/center]"
- $Text.text = dialogue_node.dialogue_text
- func _on_dialogue_finished(player: Pawn) -> void:
- dialogue_node.dialogue_started.disconnect(player.set_active)
- dialogue_node.dialogue_finished.disconnect(player.set_active)
- dialogue_node.dialogue_finished.disconnect(hide)
- dialogue_node.dialogue_finished.disconnect(_on_dialogue_finished)
|