lots of progress
This commit is contained in:
parent
e24568da25
commit
733a8fd6c0
7 changed files with 240 additions and 51 deletions
|
|
@ -1,9 +1,13 @@
|
|||
extends Window
|
||||
|
||||
signal options_changed
|
||||
|
||||
@export var sleep_h: SpinBox
|
||||
@export var sleep_m: SpinBox
|
||||
@export var duration_h: SpinBox
|
||||
@export var duration_m: SpinBox
|
||||
@export var size_label: Label
|
||||
@export var size_slider: HSlider
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
|
|
@ -13,6 +17,8 @@ func _ready() -> void:
|
|||
# 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?
|
||||
if visible:
|
||||
size_label.text = str(Data.save.size)+"px"
|
||||
pass
|
||||
|
||||
|
||||
|
|
@ -24,18 +30,14 @@ func _on_close_requested() -> void:
|
|||
|
||||
|
||||
func _on_cancel_button_pressed() -> void:
|
||||
Data.load_data()
|
||||
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.
|
||||
|
|
@ -48,4 +50,34 @@ func _on_visibility_changed() -> void:
|
|||
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)
|
||||
size_slider.value = Data.save.size
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_duration_value_changed(value: float) -> void:
|
||||
var duration_seconds : float = 0
|
||||
duration_seconds += duration_h.value * 60 * 60
|
||||
duration_seconds += duration_m.value * 60
|
||||
Data.save.duration = duration_seconds
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_sleep_value_changed(value: float) -> void:
|
||||
var end_seconds : float = 0
|
||||
end_seconds += sleep_h.value * 60 * 60
|
||||
end_seconds += sleep_m.value * 60
|
||||
Data.save.end_time = end_seconds
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
func _on_size_slider_value_changed(value: float) -> void:
|
||||
Data.save.size = int(value)
|
||||
options_changed.emit()
|
||||
|
||||
|
||||
func _on_position_dropdown_item_selected(index: int) -> void:
|
||||
if index == 0:
|
||||
Data.save.position = Data.Position.Bottom
|
||||
elif index == 1:
|
||||
Data.save.position = Data.Position.Right
|
||||
options_changed.emit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue