talkpal-frontend/scenes/board/current_time.gd
DarkSlein dd8057fdf4 Implemented calendar
Fixed bugs with reservations and rooms

Created Dockerfile
2025-03-21 00:26:39 +03:00

34 lines
790 B
GDScript

extends VBoxContainer
const WorkingDayStart = 8
const WorkingDayEnd = 20
@onready var _main: Main = get_tree().get_current_scene()
@onready var _bg := $Background
func _process(delta):
_process_current_time()
func _process_current_time():
if _main.is_current_date_selected():
show()
else:
hide()
return
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