talkpal-frontend/scenes/board/current_time.gd
DarkSlein db273bab0b Fixed wrong reservaiton time view
Redone reservation indent logic

Web build added
2025-02-15 12:51:07 +03:00

27 lines
659 B
GDScript

extends VBoxContainer
const WorkingDayStart = 8
const WorkingDayEnd = 20
@onready var _bg := $Background
func _process(delta):
_process_current_time()
func _process_current_time():
var time = Time.get_time_dict_from_system()
if time.hour < WorkingDayStart or time.hour > WorkingDayEnd:
_set_current_time(0)
return
_set_current_time(time.hour*60 + time.minute - WorkingDayStart*60)
func _set_current_time(minutes):
if minutes == 0:
_bg.custom_minimum_size.y = 0
else:
var hour_size := get_viewport_rect().size.y/15
var additional_height = 0.65*floor(minutes/12)
_bg.custom_minimum_size.y = minutes * hour_size / 60 + additional_height