-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29302d9
commit 9fcdb38
Showing
10 changed files
with
97 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
extends CanvasLayer | ||
|
||
onready var system = $DialogueSystem | ||
onready var dialogue = $DialogueSystem/DialogBox/box/dialogue | ||
onready var speaker = $DialogueSystem/DialogBox/box/speaker | ||
onready var box = $DialogueSystem/DialogBox/box | ||
|
||
signal completed | ||
|
||
var index: int = 0 | ||
var loadedDialogue: Dictionary | ||
|
||
onready var tween: Tween = $DialogueSystem/Tween | ||
export (String, FILE, "*.json") var dialogue_file_path = "res://resources/dialogue/ayan.json" setget set_dialogue_file_path | ||
|
||
var state: Dictionary = {} setget set_state | ||
|
||
func set_dialogue_file_path(path: String) -> void: | ||
dialogue_file_path = path | ||
DialogueLoader.set_dialogue_file_path(dialogue_file_path) | ||
|
||
func set_state(new_state: Dictionary) -> void: | ||
state = new_state | ||
|
||
func process_state(new_state: Dictionary) -> void: | ||
speaker.text = new_state["character"]+ ":" | ||
dialogue.text = new_state["text"] | ||
tween.interpolate_property(dialogue, "visible_characters", 0, dialogue.text.length(), 0.08 * dialogue.text.length()) | ||
tween.start() | ||
|
||
func _ready() -> void: | ||
system.set_visible(false) | ||
DialogueLoader.set_dialogue_file_path(dialogue_file_path) | ||
# set_state(loadedDialogue[String(index)]) | ||
# process_state(state) | ||
|
||
func _on_Button_button_down() -> void: | ||
tween.stop(dialogue) | ||
dialogue.visible_characters = dialogue.text.length() | ||
index += 1 | ||
if index < loadedDialogue.size(): | ||
set_state(loadedDialogue[String(index)]) | ||
process_state(state) | ||
else: | ||
system.set_visible(false) | ||
emit_signal("completed") | ||
|
||
func start() -> void: | ||
loadedDialogue = DialogueLoader.load_dialogue() | ||
system.set_visible(true) | ||
set_state(loadedDialogue[String(index)]) | ||
process_state(state) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters