cooking options, start refactor process
This commit is contained in:
parent
c083791b9a
commit
2322ae9ec2
6 changed files with 106 additions and 35 deletions
51
options_window.gd
Normal file
51
options_window.gd
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
extends Window
|
||||
|
||||
@export var sleep_h: SpinBox
|
||||
@export var sleep_m: SpinBox
|
||||
@export var duration_h: SpinBox
|
||||
@export var duration_m: SpinBox
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
#validate inputs?, disable save button if somehow invalid?
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_close_requested() -> void:
|
||||
hide()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_cancel_button_pressed() -> void:
|
||||
hide()
|
||||
|
||||
|
||||
func _on_save_button_pressed() -> void:
|
||||
var end_seconds : float = 0
|
||||
end_seconds += sleep_h.value * 60 * 60
|
||||
end_seconds += sleep_m.value * 60
|
||||
var duration_seconds : float = 0
|
||||
duration_seconds += duration_h.value * 60 * 60
|
||||
duration_seconds += duration_m.value * 60
|
||||
Data.save.duration = duration_seconds
|
||||
Data.save.end_time = end_seconds
|
||||
if Data.save_data():
|
||||
hide()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
#populate form
|
||||
#print(Data.save.end_time)
|
||||
sleep_h.value = int(Data.save.end_time/(60*60))
|
||||
sleep_m.value = int((Data.save.end_time-sleep_h.value*60*60)/60)
|
||||
duration_h.value = int(Data.save.duration/(60*60))
|
||||
duration_m.value = int((Data.save.duration-duration_h.value*60*60)/60)
|
||||
pass # Replace with function body.
|
||||
Loading…
Add table
Add a link
Reference in a new issue