2020-10-15 17:23:55 +00:00
|
|
|
extends Control
|
|
|
|
|
|
|
|
signal updated( value_name, value )
|
|
|
|
signal mouse_entered_ui
|
|
|
|
signal mouse_exited_ui
|
|
|
|
signal load_pressed
|
|
|
|
signal save_pressed
|
|
|
|
signal choose_pressed
|
|
|
|
signal quit_pressed
|
|
|
|
signal cloths_button_toggled( button_pressed )
|
|
|
|
signal underwear_button_toggled( button_pressed )
|
|
|
|
signal zoom_head_button_toggled( button_pressed )
|
|
|
|
|
|
|
|
onready var race_popup = $margin_box/window_box/content_box/tabs_box/definition/race/value.get_popup()
|
|
|
|
onready var sex_popup = $margin_box/window_box/content_box/tabs_box/definition/sex/value.get_popup()
|
|
|
|
|
|
|
|
var max_caracteristiques_points = 5*5 + 5
|
|
|
|
|
|
|
|
func _ready():
|
2021-05-27 21:56:16 +00:00
|
|
|
# Race.
|
|
|
|
race_popup.add_item( Globals.race_label[ Globals.RACE.human ] )
|
|
|
|
race_popup.connect("id_pressed", self, "_on_race_id_pressed")
|
2020-10-15 17:23:55 +00:00
|
|
|
|
2021-05-27 21:56:16 +00:00
|
|
|
# Sex.
|
|
|
|
sex_popup.add_item( Globals.sex_label[ Globals.SEX.female ] )
|
|
|
|
sex_popup.add_item( Globals.sex_label[ Globals.SEX.male ] )
|
|
|
|
sex_popup.connect("id_pressed", self, "_on_sex_id_pressed")
|
|
|
|
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_race_id_pressed( ID ):
|
2021-05-27 21:56:16 +00:00
|
|
|
$margin_box/window_box/content_box/tabs_box/definition/race/value.text = race_popup.get_item_text( ID )
|
|
|
|
emit_signal( "updated", "race", ID )
|
|
|
|
|
2020-10-15 17:23:55 +00:00
|
|
|
func _on_sex_id_pressed( ID ):
|
2021-05-27 21:56:16 +00:00
|
|
|
$margin_box/window_box/content_box/tabs_box/definition/sex/value.text = sex_popup.get_item_text( ID )
|
|
|
|
emit_signal( "updated", "sex", ID )
|
|
|
|
|
|
|
|
if ID == Globals.SEX.male:
|
|
|
|
$margin_box/window_box/content_box/tabs_box/Corps/aspect/female_label.hide()
|
|
|
|
$margin_box/window_box/content_box/tabs_box/Corps/aspect/breast.hide()
|
|
|
|
$margin_box/window_box/content_box/tabs_box/Corps/aspect/pregnancy.hide()
|
|
|
|
else:
|
|
|
|
$margin_box/window_box/content_box/tabs_box/Corps/aspect/female_label.show()
|
|
|
|
$margin_box/window_box/content_box/tabs_box/Corps/aspect/breast.show()
|
|
|
|
$margin_box/window_box/content_box/tabs_box/Corps/aspect/pregnancy.show()
|
|
|
|
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func update_sliders( p_creature ):
|
2021-05-27 21:56:16 +00:00
|
|
|
var race = p_creature.get_data( "race", Globals.RACE.human )
|
|
|
|
self._on_race_id_pressed( race )
|
|
|
|
var sex = p_creature.get_data( "sex", Globals.SEX.female )
|
|
|
|
self._on_sex_id_pressed( sex )
|
|
|
|
|
|
|
|
|
|
|
|
for child in $margin_box/window_box/content_box/tabs_box/Corps/aspect.get_children():
|
|
|
|
if not child is Label:
|
|
|
|
if child.get_node( "value" ) is ColorPickerButton:
|
|
|
|
child.get_node( "value" ).color = p_creature.get_data( child.name, Color.white )
|
|
|
|
else:
|
|
|
|
child.get_node( "value" ).value = p_creature.get_data( child.name, 0.0 )
|
|
|
|
for child in self.get_node( "margin_box/window_box/content_box/tabs_box/Tête/aspect" ).get_children():
|
|
|
|
if not child is Label:
|
|
|
|
if child.get_node( "value" ) is ColorPickerButton:
|
|
|
|
child.get_node( "value" ).color = p_creature.get_data( child.name, Color.white )
|
|
|
|
else:
|
|
|
|
child.get_node( "value" ).value = p_creature.get_data( child.name, 0.0 )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
func update_caracteristique( p_name, p_value ):
|
2021-05-27 21:56:16 +00:00
|
|
|
var total_points = 0
|
|
|
|
for caracteristique in $margin_box/window_box/content_box/tabs_box/caracteristiques.get_children():
|
|
|
|
if not caracteristique.name == "lasting_points":
|
|
|
|
total_points += caracteristique.get_node( "value" ).value
|
|
|
|
|
|
|
|
$margin_box/window_box/content_box/tabs_box/caracteristiques/lasting_points/value.text = str(self.max_caracteristiques_points - total_points)
|
2020-10-15 17:23:55 +00:00
|
|
|
|
2021-05-27 21:56:16 +00:00
|
|
|
if int($margin_box/window_box/content_box/tabs_box/caracteristiques/lasting_points/value.text) < 0:
|
|
|
|
var other_points = total_points - p_value
|
|
|
|
var other_lasting_points = self.max_caracteristiques_points - other_points
|
|
|
|
self.get_node( "margin_box/window_box/content_box/tabs_box/caracteristiques/"+p_name+"/value" ).value = other_lasting_points
|
|
|
|
$margin_box/window_box/content_box/tabs_box/caracteristiques/lasting_points/value.text = "0"
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_first_name_text_entered(new_text):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "first_name", new_text )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_last_name_text_entered(new_text):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "last_name", new_text )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_size_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "size", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_fat_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "fat", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_muscle_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "muscles", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_breast_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "breast", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_pregnancy_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "pregnancy", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_skin_tone_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "skin_tone", value )
|
|
|
|
|
2020-10-15 17:23:55 +00:00
|
|
|
func _on_hair_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "hair", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_hair_color_color_changed( color ):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "hair_color", color )
|
|
|
|
|
2020-10-15 17:23:55 +00:00
|
|
|
func _on_caucasian_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "caucasian", value )
|
|
|
|
|
2020-10-15 17:23:55 +00:00
|
|
|
func _on_african_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "african", value )
|
|
|
|
|
2020-10-15 17:23:55 +00:00
|
|
|
func _on_asian_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "asian", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_first_name_text_changed(new_text):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "first_name", new_text )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_last_name_text_changed(new_text):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "last_name", new_text )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_proportion_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "proportion", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_strength_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
self.update_caracteristique( "strength", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_perception_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
self.update_caracteristique( "perception", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_endurance_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
self.update_caracteristique( "endurance", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_constitution_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
self.update_caracteristique( "constitution", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_agility_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
self.update_caracteristique( "agility", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_cleft_chin_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "cleft_chin", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_chin_angle_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "chin_angle", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_mouth_horiz_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "mouth_horiz", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_mouth_vert_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "mouth_vert", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_nose_galbe_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "nose_galbe", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_nose_grec_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "nose_grec", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_nose_horiz_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "nose_horiz", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_nose_depth_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "nose_depth", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_eyes_color_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "eyes_color", value )
|
|
|
|
|
2020-10-15 17:23:55 +00:00
|
|
|
func _on_eyes_vert_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "eyes_vert", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_eyes_gap_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "eyes_gap", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_earlobes_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "earlobes", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_ears_wing_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "ears_wing", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_lips_up_shape_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "lips_up_shape", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_lips_up_shape_2_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "lips_up_shape_2", value )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_skin_value_changed(value):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "updated", "skin", value )
|
|
|
|
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_load_pressed():
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "load_pressed" )
|
|
|
|
|
2020-10-15 17:23:55 +00:00
|
|
|
func _on_save_pressed():
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "save_pressed" )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_choose_pressed():
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "choose_pressed" )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_quit_pressed():
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "quit_pressed" )
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_creature_creation_menu_mouse_entered():
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "mouse_exited_ui")
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
func _on_creature_creation_menu_mouse_exited():
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "mouse_entered_ui")
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_cloths_button_toggled(button_pressed):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "cloths_button_toggled", button_pressed )
|
|
|
|
if button_pressed:
|
|
|
|
$margin_box/window_box/content_box/preview_box/v_box_container/cloths_button.modulate.a = 1.0
|
|
|
|
else:
|
|
|
|
$margin_box/window_box/content_box/preview_box/v_box_container/cloths_button.modulate.a = 0.5
|
2020-10-15 17:23:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_underwear_button_toggled(button_pressed):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "underwear_button_toggled", button_pressed )
|
|
|
|
if button_pressed:
|
|
|
|
$margin_box/window_box/content_box/preview_box/v_box_container/underwear_button.modulate.a = 1.0
|
|
|
|
else:
|
|
|
|
$margin_box/window_box/content_box/preview_box/v_box_container/underwear_button.modulate.a = 0.5
|
2020-10-15 17:23:55 +00:00
|
|
|
|
2021-06-22 16:22:58 +00:00
|
|
|
|
2020-10-15 17:23:55 +00:00
|
|
|
func _on_zoom_head_button_toggled(button_pressed):
|
2021-05-27 21:56:16 +00:00
|
|
|
emit_signal( "zoom_head_button_toggled", button_pressed )
|