education-apps/podbooker/ButtonScript.gd

407 lines
7.1 KiB
GDScript

extends GridContainer
@onready var booking_screen = $"%BookingScreen"
@onready var important_vars = $"%impvars"
@onready var booking_vars = $"%bookings"
@onready var lesson_grid = $"%LessonGrid"
@onready var times = $"%time"
@onready var settings_button = $"%SettingsButton"
@onready var name1 = $"%Name1"
@onready var name2 = $"%Name2"
@onready var form1 = $"%Form1"
@onready var form2 = $"%Form2"
@onready var reason = $"%ReasonField"
@onready var name3 = $"%Name3"
@onready var form3 = $"%Form3"
@onready var name4 = $"%Name4"
@onready var form4 = $"%Form4"
@onready var pod_name_label = $"%PodName"
@onready var lesson_name = $"%LessonName"
@onready var day_name = $"%DayName"
@onready var book_button = $"%BookButton"
@onready var clear_button = $"%ClearButton"
func _ready():
pass
func topbar_color():
if important_vars.pod == "A1":
$"%BookTopBar".color = Color.html("#baa7c2")
if important_vars.pod == "A2":
$"%BookTopBar".color = Color.html("#e5c67a")
if important_vars.pod == "B1":
$"%BookTopBar".color = Color.html("#3b719c")
if important_vars.pod == "B2":
$"%BookTopBar".color = Color.html("#3b719c")
if important_vars.pod == "C":
$"%BookTopBar".color = Color.html("#baa7c2")
if important_vars.pod == "D":
$"%BookTopBar".color = Color.html("#aec48c")
if important_vars.pod == "E":
$"%BookTopBar".color = Color.html("#6dc1f0")
if important_vars.pod == "F":
$"%BookTopBar".color = Color.html("#e5c67a")
func set_booking_screen_values():
pod_name_label.text = "Pod " + important_vars.pod
lesson_name.text = "Lesson " + str(important_vars.time)
if important_vars.time == 8:
lesson_name.text = "Lunch Time"
day_name.text = "Today is " + times.dayofweek_word
topbar_color()
booking_vars.read_values()
# if name1.text != "":
# book_button.text = "Save Changed Booking"
# else:
# book_button.text = "Book"
func drop_names_to_two():
print(important_vars.pod)
# or "A2" or "B1" or "B2"
if important_vars.pod == "A1":
name3.visible = false
form3.visible = false
name4.visible = false
form4.visible = false
if important_vars.pod == "A2":
name3.visible = false
form3.visible = false
name4.visible = false
form4.visible = false
if important_vars.pod == "B1":
name3.visible = false
form3.visible = false
name4.visible = false
form4.visible = false
if important_vars.pod == "B2":
name3.visible = false
form3.visible = false
name4.visible = false
form4.visible = false
# Let's agree that lesson 8 = lunch. No breaktime bookings anymore.
func book_button_pressed(pod_name, lesson):
# Only do anything if it's not empty
important_vars.pod = pod_name
important_vars.time = lesson
# This creates a variable called A1L1 etc
important_vars.current_pod = str(pod_name) + "L" + str(lesson)
set_booking_screen_values()
drop_names_to_two()
booking_screen.visible = true
# lesson_grid.visible = false
# settings_button.visible = false
if name1.text != "":
clear_button.visible = true
$"%ChangeButton".visible = true
$"%ClearBookPw".visible = true
$"%BookPw".visible = true
$"%BookButton".visible = false
if name1.text == "":
clear_button.visible = false
$"%ChangeButton".visible = false
$"%ClearBookPw".visible = false
$"%BookPw".visible = false
$"%BookButton".visible = true
func _on_A1L1_pressed():
book_button_pressed("A1", 1)
func _on_A2L1_pressed():
book_button_pressed("A2", 1)
func _on_B1L1_pressed():
book_button_pressed("B1", 1)
func _on_B2L1_pressed():
book_button_pressed("B2", 1)
func _on_CL1_pressed():
book_button_pressed("C", 1)
func _on_DL1_pressed():
book_button_pressed("D", 1)
func _on_EL1_pressed():
book_button_pressed("E", 1)
func _on_FL1_pressed():
book_button_pressed("F", 1)
func _on_GL1_pressed():
book_button_pressed("G", 1)
func _on_A1L2_pressed():
book_button_pressed("A1", 2)
func _on_A2L2_pressed():
book_button_pressed("A2", 2)
func _on_B1L2_pressed():
book_button_pressed("B1", 2)
func _on_B2L2_pressed():
book_button_pressed("B2", 2)
func _on_CL2_pressed():
book_button_pressed("C", 2)
func _on_DL2_pressed():
book_button_pressed("D", 2)
func _on_EL2_pressed():
book_button_pressed("E", 2)
func _on_FL2_pressed():
book_button_pressed("F", 2)
func _on_GL2_pressed():
book_button_pressed("G", 2)
func _on_A1L3_pressed():
book_button_pressed("A1", 3)
func _on_A2L3_pressed():
book_button_pressed("A2", 3)
func _on_B1L3_pressed():
book_button_pressed("B1", 3)
func _on_B2L3_pressed():
book_button_pressed("B2", 3)
func _on_CL3_pressed():
book_button_pressed("C", 3)
func _on_DL3_pressed():
book_button_pressed("D", 3)
func _on_EL3_pressed():
book_button_pressed("E", 3)
func _on_FL3_pressed():
book_button_pressed("F", 3)
func _on_GL3_pressed():
book_button_pressed("G", 3)
func _on_A1L4_pressed():
book_button_pressed("A1", 4)
func _on_A2L4_pressed():
book_button_pressed("A2", 4)
func _on_B1L4_pressed():
book_button_pressed("B1", 4)
func _on_B2L4_pressed():
book_button_pressed("B2", 4)
func _on_CL4_pressed():
book_button_pressed("C", 4)
func _on_DL4_pressed():
book_button_pressed("D", 4)
func _on_EL4_pressed():
book_button_pressed("E", 4)
func _on_FL4_pressed():
book_button_pressed("F", 4)
func _on_GL4_pressed():
book_button_pressed("G", 4)
func _on_A1L5_pressed():
book_button_pressed("A1", 5)
func _on_A2L5_pressed():
book_button_pressed("A2", 5)
func _on_B1L5_pressed():
book_button_pressed("B1", 5)
func _on_B2L5_pressed():
book_button_pressed("B2", 5)
func _on_CL5_pressed():
book_button_pressed("C", 5)
func _on_DL5_pressed():
book_button_pressed("D", 5)
func _on_EL5_pressed():
book_button_pressed("E", 5)
func _on_FL5_pressed():
book_button_pressed("F", 5)
func _on_GL5_pressed():
book_button_pressed("G", 5)
func _on_A1L6_pressed():
book_button_pressed("A1", 6)
func _on_A2L6_pressed():
book_button_pressed("A2", 6)
func _on_B1L6_pressed():
book_button_pressed("B1", 6)
func _on_B2L6_pressed():
book_button_pressed("B2", 6)
func _on_CL6_pressed():
book_button_pressed("C", 6)
func _on_DL6_pressed():
book_button_pressed("D", 6)
func _on_EL6_pressed():
book_button_pressed("E", 6)
func _on_FL6_pressed():
book_button_pressed("F", 6)
func _on_GL6_pressed():
book_button_pressed("G", 6)
func _on_A1L7_pressed():
book_button_pressed("A1", 7)
func _on_A2L7_pressed():
book_button_pressed("A2", 7)
func _on_B1L7_pressed():
book_button_pressed("B1", 7)
func _on_B2L7_pressed():
book_button_pressed("B2", 7)
func _on_CL7_pressed():
book_button_pressed("C", 7)
func _on_DL7_pressed():
book_button_pressed("D", 7)
func _on_EL7_pressed():
book_button_pressed("E", 7)
func _on_FL7_pressed():
book_button_pressed("F", 7)
func _on_GL7_pressed():
book_button_pressed("G", 7)
func _on_A1L8_pressed():
book_button_pressed("A1", 8)
func _on_A2L8_pressed():
book_button_pressed("A2", 8)
func _on_B1L8_pressed():
book_button_pressed("B1", 8)
func _on_B2L8_pressed():
book_button_pressed("B2", 8)
func _on_CL8_pressed():
book_button_pressed("C", 8)
func _on_DL8_pressed():
book_button_pressed("D", 8)
func _on_EL8_pressed():
book_button_pressed("E", 8)
func _on_FL8_pressed():
book_button_pressed("F", 8)
func _on_GL8_pressed():
book_button_pressed("G", 8)