ESC compiler rewrite

Splits the former ESC_Runner and ESC_Level_Runner into multiple dedicated managers. 
Authored-by: Dennis Ploeger <develop@dieploegers.de>
This commit is contained in:
Dennis Ploeger
2021-06-04 16:12:42 +02:00
committed by GitHub
parent f069ab2ffd
commit 746a724f5a
115 changed files with 4740 additions and 2584 deletions

View File

@@ -1,6 +1,7 @@
tool
extends PanelContainer
signal dialog_line_started
signal dialog_line_finished
export(String) var current_character setget set_current_character
@@ -40,6 +41,7 @@ params: Dictionary
"""
func say(character : String, params : Dictionary) :
show()
emit_signal("dialog_line_started")
set_current_character(character)
if !params["line"]:
@@ -70,10 +72,8 @@ func _on_dialog_line_typed(object, key):
$Timer.connect("timeout", self, "_on_dialog_finished")
func _on_dialog_finished():
escoria.esc_level_runner.finished()
escoria.dialog_player.is_speaking = false
escoria.current_state = escoria.GAME_STATE.DEFAULT
# emit_signal("dialog_line_finished")
emit_signal("dialog_line_finished")
queue_free()

View File

@@ -1,10 +0,0 @@
extends Control
func _ready():
pass
func set_answers(answers_array : PoolStringArray):
func _on_answer1_gui_input(event):
pass # Replace with function body.

View File

@@ -12,12 +12,11 @@ func _ready():
c.queue_free()
func set_answers(p_commands : Array):
commands = p_commands
var c = 0
func set_answers(options : Array):
commands = options
for option in commands:
var new_answer_label = RichTextLabel.new()
new_answer_label.text = option.params[0]
new_answer_label.text = option.option
new_answer_label.fit_content_height = true
new_answer_label.add_font_override("normal_font", font)
@@ -27,13 +26,10 @@ func set_answers(p_commands : Array):
new_answer_label.connect("focus_exited", self, "_on_answer_focus_exited", [new_answer_label]) # Focus exited
new_answer_label.connect("mouse_entered", self, "_on_answer_mouse_entered", [new_answer_label]) # Mouse entered
new_answer_label.connect("mouse_exited", self, "_on_answer_mouse_exited", [new_answer_label]) # Mouse exited
new_answer_label.connect("gui_input", self, "_on_answer_gui_input", [c]) # Clicks
c += 1
new_answer_label.connect("gui_input", self, "_on_answer_gui_input", [option]) # Clicks
func _on_answer_gui_input(event : InputEvent, answer_id : int):
func _on_answer_gui_input(event : InputEvent, answer : ESCDialogOption):
if event is InputEventMouseButton and event.is_pressed():
var answer = commands[answer_id].params[1]
printt(answer)
escoria.dialog_player.play_dialog_option_chosen(answer)
func _on_answer_mouse_entered(answer_node : Node):

View File

@@ -1,7 +1,7 @@
extends RichTextLabel
#signal dialog_line_started
#signal dialog_line_finished
signal dialog_line_started
signal dialog_line_finished
onready var tween = $Tween
onready var text_node = self
@@ -28,12 +28,14 @@ params: Dictionary
func say(character : String, params : Dictionary) :
show()
emit_signal("dialog_line_started")
if !params["line"]:
escoria.logger.report_errors("dialog_box_inset.gd:say()", ["No line field in params!"])
return
# Position the RichTextLabel on the character's dialog position, if any.
current_character = escoria.esc_runner.get_object(character)
current_character = escoria.object_manager.get_object(character).node
rect_position = current_character.get_node("dialog_position").get_global_transform_with_canvas().origin
rect_position.x -= rect_size.x / 2
@@ -73,7 +75,7 @@ func _on_dialog_line_typed(object, key):
func _on_dialog_finished():
current_character.stop_talking()
escoria.esc_level_runner.finished()
emit_signal("dialog_line_finished")
escoria.dialog_player.is_speaking = false
escoria.current_state = escoria.GAME_STATE.DEFAULT
queue_free()