education-apps/podbooker/BookingScreen.gd

91 lines
2.2 KiB
GDScript3
Raw Normal View History

extends CanvasLayer
2022-10-21 09:42:42 +00:00
2023-03-06 22:52:14 +00:00
@onready var booking_screen = $"%BookingScreen"
@onready var lesson_grid = $"%LessonGrid"
@onready var settings_button = $"%SettingsButton"
@onready var important_vars = $"%impvars"
@onready var booking_vars = $"%bookings"
@onready var timer = $"%time"
@onready var err_label = $"%ErrLabel"
@onready var clear_button = $"%ClearButton"
@onready var name1 = $"%Name1"
@onready var name2 = $"%Name2"
@onready var form1 = $"%Form1"
@onready var form2 = $"%Form2"
@onready var name3 = $"%Name3"
@onready var form3 = $"%Form3"
@onready var name4 = $"%Name4"
@onready var form4 = $"%Form4"
@onready var reason = $"%ReasonField"
2023-05-10 04:09:13 +00:00
@onready var book_pw = $"%BookPw"
2022-10-21 09:42:42 +00:00
func _clear_form():
name1.text = ""
name2.text = ""
form1.text = ""
form2.text = ""
name3.text = ""
name4.text = ""
form3.text = ""
form4.text = ""
reason.text = ""
2023-05-10 04:09:13 +00:00
book_pw.text = ""
2022-10-21 09:42:42 +00:00
func restore_names_to_four():
name3.visible = true
form3.visible = true
name4.visible = true
form4.visible = true
func _on_CancelButton_pressed():
booking_screen.visible = false
lesson_grid.visible = true
settings_button.visible = true
err_label.visible = false
clear_button.visible = false
restore_names_to_four()
_clear_form()
func _book_it():
booking_vars.set_values()
_clear_form()
func _on_BookButton_pressed():
if name1.text == "" or reason.text =="":
err_label.visible = true
else:
var namer = "/root/MainStartScreen/ButtonGrid/" + important_vars.pod + "L" + str(important_vars.time)
var sp = get_node(str(namer))
sp.text = "BOOKED"
_book_it()
_on_CancelButton_pressed()
func _on_ClearButton_pressed():
var namer = "/root/MainStartScreen/ButtonGrid/" + important_vars.pod + "L" + str(important_vars.time)
var sp = get_node(str(namer))
sp.text = ""
2023-05-10 04:09:13 +00:00
if $"%BookPw".text == "WhoIsJaap":
_clear_form()
_book_it()
_on_CancelButton_pressed()
func _on_change_button_pressed():
if $"%BookPw".text == "WhoIsJaap":
if name1.text == "" or reason.text =="":
err_label.visible = true
else:
var namer = "/root/MainStartScreen/ButtonGrid/" + important_vars.pod + "L" + str(important_vars.time)
var sp = get_node(str(namer))
sp.text = "BOOKED"
_book_it()
_on_CancelButton_pressed()