Ajout d'une ebauche de générateur de nom.

This commit is contained in:
osquallo 2018-08-22 08:44:06 +02:00
parent 0d1019614e
commit b744799d34
2 changed files with 266 additions and 16 deletions

View file

@ -4,6 +4,12 @@ signal gender_value_changed( value )
signal return_button_pressed
signal creation_button_pressed
var m_first_name_list = [ "testm1", "testm2", "testm3" ]
var f_first_name_list = [ "testf1", "testf2", "testf3" ]
var name_list = [ "machin", "truc", "bidule", "chose" ]
func _on_h_scroll_bar_value_changed( value ):
emit_signal( "gender_value_changed", value )
@ -14,3 +20,30 @@ func _on_return_button_pressed():
func _on_valid_button_pressed():
emit_signal( "creation_button_pressed" )
func _on_generate_name_pressed():
var sex_slider = $margin_container/v_box_container/sexe_box/h_box_container/h_scroll_bar
var name = "player"
if sex_slider.value == 0:
var name_index = randi()%len(m_first_name_list)
name = m_first_name_list[ name_index ]
else:
var name_index = randi()%len(f_first_name_list)
name = f_first_name_list[ name_index ]
name += " "
name += name_list[ randi()%len(name_list) ]
$margin_container/v_box_container/name_box/line_edit.text = name
func _ready():
var popup_node = $margin_container/v_box_container/generate_name_box/region_menu
var popup = popup_node.get_popup()
popup.add_item( "Culno" )
popup.add_item( "Khanat" )
popup.add_item( "Tcara" )
popup_node.selected = 0

View file

@ -22,7 +22,7 @@ use_filter = true
font_data = ExtResource( 2 )
_sections_unfolded = [ "Extra Spacing", "Font", "Settings" ]
[node name="character_creation_box" type="MarginContainer"]
[node name="character_creation_box" type="MarginContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
@ -54,7 +54,7 @@ anchor_bottom = 0.0
margin_left = 8.0
margin_top = 8.0
margin_right = 1016.0
margin_bottom = 152.0
margin_bottom = 184.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
@ -73,7 +73,7 @@ anchor_bottom = 0.0
margin_left = 8.0
margin_top = 8.0
margin_right = 1016.0
margin_bottom = 152.0
margin_bottom = 184.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
@ -93,9 +93,9 @@ anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 8.0
margin_top = 14.0
margin_top = 8.0
margin_right = 1000.0
margin_bottom = 130.0
margin_bottom = 168.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
@ -169,15 +169,214 @@ caret_blink_speed = 0.65
caret_position = 0
_sections_unfolded = [ "Placeholder", "Size Flags" ]
[node name="sexe_box" type="HBoxContainer" parent="margin_container/v_box_container" index="1"]
[node name="generate_name_box" type="HBoxContainer" parent="margin_container/v_box_container" index="1"]
editor/display_folded = true
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 28.0
margin_right = 992.0
margin_bottom = 42.0
margin_bottom = 52.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
alignment = 0
[node name="region_label" type="Label" parent="margin_container/v_box_container/generate_name_box" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 5.0
margin_right = 40.0
margin_bottom = 19.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "region"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="region_menu" type="OptionButton" parent="margin_container/v_box_container/generate_name_box" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 44.0
margin_right = 83.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
action_mode = 0
enabled_focus_mode = 2
shortcut = null
group = null
flat = false
align = 0
items = [ ]
selected = -1
[node name="nb_syllabe_label" type="Label" parent="margin_container/v_box_container/generate_name_box" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 87.0
margin_top = 5.0
margin_right = 165.0
margin_bottom = 19.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Nb. Syllabes"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="nb_syllabe" type="SpinBox" parent="margin_container/v_box_container/generate_name_box" index="3"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 169.0
margin_right = 243.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
min_value = 0.0
max_value = 100.0
step = 1.0
page = 0.0
value = 0.0
exp_edit = false
rounded = false
editable = true
prefix = ""
suffix = ""
[node name="nb_nom_label" type="Label" parent="margin_container/v_box_container/generate_name_box" index="4"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 247.0
margin_top = 5.0
margin_right = 311.0
margin_bottom = 19.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 4
text = "Nb. Noms"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="nb_nom" type="SpinBox" parent="margin_container/v_box_container/generate_name_box" index="5"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 315.0
margin_right = 389.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
min_value = 0.0
max_value = 100.0
step = 1.0
page = 0.0
value = 0.0
exp_edit = false
rounded = false
editable = true
prefix = ""
suffix = ""
[node name="generate_name" type="Button" parent="margin_container/v_box_container/generate_name_box" index="6"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 875.0
margin_right = 992.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 10
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Générer un nom"
flat = false
align = 1
_sections_unfolded = [ "Focus", "Size Flags", "Theme" ]
[node name="h_separator" type="HSeparator" parent="margin_container/v_box_container" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 56.0
margin_right = 992.0
margin_bottom = 60.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
[node name="sexe_box" type="HBoxContainer" parent="margin_container/v_box_container" index="3"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 64.0
margin_right = 992.0
margin_bottom = 78.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
@ -289,15 +488,31 @@ percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="error_label" type="Label" parent="margin_container/v_box_container" index="2"]
[node name="h_separator2" type="HSeparator" parent="margin_container/v_box_container" index="4"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 46.0
margin_top = 82.0
margin_right = 992.0
margin_bottom = 68.0
margin_bottom = 86.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
[node name="error_label" type="Label" parent="margin_container/v_box_container" index="5"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 90.0
margin_right = 992.0
margin_bottom = 112.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
@ -313,15 +528,15 @@ lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "custom_colors", "custom_fonts", "custom_styles" ]
[node name="valid_button" type="Button" parent="margin_container/v_box_container" index="3"]
[node name="valid_button" type="Button" parent="margin_container/v_box_container" index="6"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 72.0
margin_top = 116.0
margin_right = 992.0
margin_bottom = 92.0
margin_bottom = 136.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
@ -337,15 +552,15 @@ text = "Valider"
flat = false
align = 1
[node name="return_button" type="Button" parent="margin_container/v_box_container" index="4"]
[node name="return_button" type="Button" parent="margin_container/v_box_container" index="7"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 96.0
margin_top = 140.0
margin_right = 992.0
margin_bottom = 116.0
margin_bottom = 160.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
@ -361,6 +576,8 @@ text = "Retour"
flat = false
align = 1
[connection signal="pressed" from="margin_container/v_box_container/generate_name_box/generate_name" to="." method="_on_generate_name_pressed"]
[connection signal="value_changed" from="margin_container/v_box_container/sexe_box/h_box_container/h_scroll_bar" to="." method="_on_h_scroll_bar_value_changed"]
[connection signal="pressed" from="margin_container/v_box_container/valid_button" to="." method="_on_valid_button_pressed"]