extends MarginContainer #signal character_changed signal sex_bar_changed( value ) signal size_bar_changed( value ) signal ears_size_bar_changed( value ) signal return_button_pressed signal creation_button_pressed ######## #### Name generator. var syllabes_culno = [ "Cmachin", "Ctruc", "Cbidule", "Cchose" ] var syllabes_culno_trad = [ "TradCmachin", "TradCtruc", "TradCbidule", "TradCchose" ] var syllabes_khanat = [ "Kmachin", "Ktruc", "Kbidule", "Kchose" ] var syllabes_khanat_trad = [ "TradKmachin", "TradKtruc", "TradKbidule", "TradKchose" ] var syllabes_tcara = [ "Tmachin", "Ttruc", "Tbidule", "Tchose" ] var syllabes_tcara_trad = [ "TradTmachin", "TradTtruc", "TradTbidule", "TradTchose" ] func _on_return_button_pressed(): emit_signal( "return_button_pressed" ) func _on_valid_button_pressed(): emit_signal( "creation_button_pressed" ) func show_error( string ): $margin_container/v_box_container/error_label.set( "custom_colors/font_color", Color( 1, 0, 0, 1 )) $margin_container/v_box_container/error_label.text = string func show_help( string ): $margin_container/v_box_container/error_label.set( "custom_colors/font_color", Color( 0, 1, 0, 1 )) $margin_container/v_box_container/error_label.text = string func _on_generate_name_pressed(): var nb_syllabes = $margin_container/v_box_container/generate_name_box/nb_syllabe.value var nb_noms = $margin_container/v_box_container/generate_name_box/nb_nom.value var region = $margin_container/v_box_container/generate_name_box/region_menu.text var name = "" var trad = "" for nom_index in range( 0, nb_noms ): for syllabe_index in range( 0, nb_syllabes ): if region == "Culno": var index = randi()%len(syllabes_culno) name += syllabes_culno[ index ] trad += syllabes_culno_trad[ index ] elif region == "Tcara": var index = randi()%len(syllabes_tcara) name += syllabes_tcara[ index ] trad += syllabes_tcara_trad[ index ] else: var index = randi()%len(syllabes_khanat) name += syllabes_khanat[ index ] trad += syllabes_khanat_trad[ index ] if nom_index+1 < nb_noms: name += " " trad += " / " $margin_container/v_box_container/name_box/line_edit.text = name self.show_help( trad ) func _ready(): var popup_node = $margin_container/v_box_container/generate_name_box/region_menu var popup = popup_node.get_popup() popup.add_item( "Khanat" ) popup.add_item( "Culno" ) popup.add_item( "Tcara" ) popup_node.selected = 1 func _on_sex_bar_value_changed( value ): emit_signal( "sex_bar_changed", value ) func _on_size_bar_value_changed( value ): emit_signal( "size_bar_changed", value ) func _on_ears_size_value_changed(value): emit_signal( "ears_size_bar_changed", value )