37 lines
964 B
GDScript
37 lines
964 B
GDScript
extends HBoxContainer
|
|
class_name Reservation
|
|
|
|
const HourSize = 150
|
|
|
|
const Colors = {
|
|
1: Color("00b1a1d6"),
|
|
2: Color("f431e0d6"),
|
|
3: Color("eb7130d6")
|
|
}
|
|
|
|
@onready var _main: Main = get_tree().get_current_scene()
|
|
@onready var _title = $Section/SectionLabel
|
|
@onready var _panel = $Section/SectionPanel
|
|
|
|
func _ready():
|
|
initialize_signals()
|
|
|
|
func initialize_signals():
|
|
_panel.gui_input.connect(_on_section_panel_gui_input)
|
|
|
|
func set_title(title):
|
|
_title.text = title
|
|
|
|
func set_minutes(minutes):
|
|
_panel.size.y = minutes * HourSize / 60
|
|
custom_minimum_size.y = _panel.size.y
|
|
|
|
func set_color(color):
|
|
var new_style_box: StyleBoxFlat = _panel.get("theme_override_styles/panel").duplicate()
|
|
new_style_box.bg_color = Colors[color]
|
|
_panel.set("theme_override_styles/panel", new_style_box)
|
|
|
|
func _on_section_panel_gui_input(event):
|
|
if event is InputEventScreenTouch or (event is InputEventMouseButton and event.pressed):
|
|
print("emit open reservation info signal")
|