53 lines
1.5 KiB
GDScript
53 lines
1.5 KiB
GDScript
extends Control
|
|
|
|
@onready var firstEdit : TextEdit = %FirstNameEdit
|
|
@onready var lastEdit : TextEdit = %LastNameEdit
|
|
@onready var signButton : Button = %SignButton
|
|
@onready var portraitButton : TextureButton = %PortraitButton
|
|
@onready var signature : TextureRect = %Signature
|
|
@onready var write_sound : AudioStreamPlayer = $AudioStreamPlayer
|
|
var first_set : bool = false
|
|
var last_set : bool = false
|
|
var portrait_set : bool = false
|
|
|
|
func validate_signature() -> void:
|
|
signButton.disabled = !(first_set and last_set and portrait_set)
|
|
|
|
func _on_portrait_button_pressed() -> void:
|
|
#Open the Portrait Screesn
|
|
portrait_set = true
|
|
validate_signature()
|
|
|
|
|
|
func _on_first_name_edit_text_changed() -> void:
|
|
if firstEdit.text != "":
|
|
first_set = true
|
|
else:
|
|
last_set = true
|
|
validate_signature()
|
|
|
|
|
|
func _on_last_name_edit_text_changed() -> void:
|
|
if lastEdit.text != "":
|
|
last_set = true
|
|
else:
|
|
last_set = false
|
|
validate_signature()
|
|
|
|
func update_signature_threshold(value : float) -> void:
|
|
signature.set_instance_shader_parameter("threshold", value)
|
|
|
|
func _on_sign_button_pressed() -> void:
|
|
signButton.visible = false
|
|
var tween = create_tween()
|
|
Game.player_data.name = %FirstNameEdit.text
|
|
Game.player_data.surname = %LastNameEdit.text
|
|
write_sound.play()
|
|
tween.tween_method(update_signature_threshold, -0.1, 1.1, .5)
|
|
tween.tween_interval(1)
|
|
tween.tween_callback(Game.switch_dialogue.bind("game_start", "Start Schedule"))
|
|
#Sign the card.
|
|
#Dialogic.paused = false
|
|
#Dialogic.Jump.jump_to_label("")
|
|
pass # Replace with function body.
|