[wip] rework edit panel

This commit is contained in:
Fabien Freling 2020-06-04 18:39:27 +02:00
parent 5f84111cdd
commit c8bd0412f3
3 changed files with 135 additions and 112 deletions

View file

@ -61,7 +61,7 @@ func _ready():
edit_panel.hide()
edit_button.hide()
var button_max_width: int = $EditPanel/VBoxContainer.rect_size.x / 4
var button_max_width: int = $EditPanel/VBoxContainer.rect_size.x / 3.5
var button_width := min(200, button_max_width)
print_debug("button max width = ", button_max_width)
easy_button.rect_min_size.x = button_width
@ -94,6 +94,7 @@ func flip_over():
tween.start()
func flip_back():
_update_description()
tween.remove_all()
var mid_duration = flip_duration / 2.0
tween.interpolate_property(self, "rect_scale:x", 1.0, 0.0, mid_duration)
@ -210,18 +211,12 @@ func _on_Edit_Cancel_pressed():
flip_back()
func _on_Edit_Save_pressed():
preferences.set_value("game", "custom_columns", columns_spinbox.value) as int
preferences.set_value("game", "custom_rows", rows_spinbox.value) as int
preferences.set_value("game", "custom_shuffle_iterations", iterations_spinbox.value) as int
print_debug(columns_spinbox.value)
preferences.set_value("game", "custom_columns", columns_spinbox.value as int)
preferences.set_value("game", "custom_rows", rows_spinbox.value as int)
preferences.set_value("game", "custom_shuffle_iterations", iterations_spinbox.value as int)
flip_back()
func _on_Custom_toggled(value: bool):
if value:
edit_button.show()
_update_description()
else:
edit_button.hide()
func _on_Easy_pressed():
_update_description()
@ -230,3 +225,7 @@ func _on_Normal_pressed():
func _on_Hard_pressed():
_update_description()
func _on_Custom_pressed():
_update_description()
flip_over()