36 lines
1.4 KiB
GDScript3
36 lines
1.4 KiB
GDScript3
|
extends Control
|
||
|
|
||
|
var character_mesh = null
|
||
|
var name_input = null
|
||
|
onready var error_label = $v_box_container/h_box_container/margin_container/margin_container/v_box_container/error_label
|
||
|
|
||
|
signal valid_button_pressed
|
||
|
signal return_button_pressed
|
||
|
|
||
|
func _ready():
|
||
|
character_mesh = $v_box_container/h_box_container/center_container/character_creation_scene/mesh_instance
|
||
|
name_input = $v_box_container/h_box_container/margin_container/margin_container/v_box_container/name_box/line_edit
|
||
|
|
||
|
|
||
|
func _on_h_scroll_bar_value_changed(value):
|
||
|
if value == 1:
|
||
|
global.character_sex = 1
|
||
|
character_mesh.get_surface_material(0).albedo_color = Color( 1.0, 0.25, 0.25, 1.0 )
|
||
|
else:
|
||
|
global.character_sex = 0
|
||
|
character_mesh.get_surface_material(0).albedo_color = Color( 0.0, 0.0, 1.0, 1.0 )
|
||
|
|
||
|
func _on_valid_button_pressed():
|
||
|
if not name_input.text or name_input.text == "":
|
||
|
error_label.text = "You need to choose a character's name."
|
||
|
return
|
||
|
global.character_name = name_input.text
|
||
|
global.character_color = character_mesh.get_surface_material(0).albedo_color
|
||
|
emit_signal( "valid_button_pressed" )
|
||
|
|
||
|
|
||
|
func _on_return_button_pressed():
|
||
|
get_node( "../character_selection_menu/viewport/character_preview" ).show()
|
||
|
# get_node( "v_box_container/h_box_container/center_container/character_creation_scene").hide()
|
||
|
emit_signal( "return_button_pressed" )
|