diff options
author | dusoleil <howcansocksbereal@gmail.com> | 2022-08-27 00:39:58 -0400 |
---|---|---|
committer | dusoleil <howcansocksbereal@gmail.com> | 2022-08-27 00:39:58 -0400 |
commit | e4322bde34c2c8c864e3fd40bd254894d18fb15f (patch) | |
tree | fb07ac99416cbe258bb8415e39eeb1597b7be8d1 /screens/Schedule/Header.gd | |
parent | 260fa2214e298686678d43ca58bcbfd493d563b3 (diff) | |
download | Planner-e4322bde34c2c8c864e3fd40bd254894d18fb15f.tar.gz Planner-e4322bde34c2c8c864e3fd40bd254894d18fb15f.zip |
Add Main Schedule Screen Prototype
Diffstat (limited to '')
-rw-r--r-- | screens/Schedule/Header.gd | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/screens/Schedule/Header.gd b/screens/Schedule/Header.gd new file mode 100644 index 0000000..3cf6e01 --- /dev/null +++ b/screens/Schedule/Header.gd @@ -0,0 +1,26 @@ +extends Button + +var timeslots = [] +var current_timeslot = null +var last_minute = -1 + +func populate(data): + timeslots = data + +func _process(_delta): + var time = Time.get_unix_time_from_system() + var time_dict = Time.get_time_dict_from_unix_time(time) + if time_dict.minute != last_minute: + last_minute = time_dict.minute + $"%Time".text = DataHelpers.timeofday(time) + time = Time.get_unix_time_from_datetime_dict(time_dict) + current_timeslot = null + for timeslot in timeslots: + if time >= timeslot.start_time && time <= timeslot.end_time: + current_timeslot = timeslot + break + $"%Name".text = "Free Time" if current_timeslot == null else current_timeslot.name + +func _on_ScheduleHeader_button_up(): + if current_timeslot != null: + $"/root/Main".nav_screen("TimeSlot", TimeSlot, "get_by_id", [current_timeslot.id]) |