34 lines
899 B
GDScript
34 lines
899 B
GDScript
extends Control
|
|
|
|
onready var label_t_o = get_node("LabelTO")
|
|
onready var spin_box_hours = get_node("SpinBoxHours")
|
|
onready var spin_box_minutes = get_node("SpinBoxMinutes")
|
|
|
|
var unapplied_time_offset: int
|
|
|
|
|
|
func _ready():
|
|
# warning-ignore:integer_division
|
|
var offset_hours = Time.offset / 3600
|
|
# warning-ignore:integer_division
|
|
var offset_minutes = Time.offset % 3600 / 60
|
|
|
|
spin_box_hours.value = offset_hours
|
|
spin_box_minutes.value = offset_minutes
|
|
_display_applied_time_offset()
|
|
|
|
|
|
func _update_unapplied_time_offset(_value):
|
|
var offset_hours = spin_box_hours.value * 3600
|
|
var offset_minutes = spin_box_minutes.value * 60
|
|
unapplied_time_offset = offset_hours + offset_minutes
|
|
|
|
|
|
func _on_ApplyTimeOffset_pressed():
|
|
Time.offset = unapplied_time_offset
|
|
_display_applied_time_offset()
|
|
|
|
|
|
func _display_applied_time_offset():
|
|
label_t_o.text = "Applied Time Offset: " + str(Time.offset) + "s"
|