WTS/game/scripts/interface/calendar.rpy
LoafyLemon 2c9348be59 Calendar
* Add weekdays method and weekday display to the calendar
* Bug fixes
2024-04-23 20:19:36 +01:00

69 lines
1.8 KiB
Plaintext

init python:
class Calendar(object):
def __init__(self):
pass
def get_schedule(self, span=35):
contents = {i: "" for i in range(span)}
# Add moon cycles
for i in range(span):
if (i % 7 == 0):
contents[i] += "🌕"
elif (i % 7 == 3):
contents[i] += "🌓"
# elif (game.day % 60 == 30) # Blood moon
# Add letters
letters = mailbox.get_letters(True)
for i in letters:
contents[game.day+i.wait] += "✉️"
# Add parcels
parcels = mailbox.get_parcels(True)
for i in parcels:
contents[game.day+i.wait] += "📦"
return contents
def get_weekday(self, n):
weekdays = ("Monday", "Tuesday", "Wednsday", "Thursday", "Friday", "Saturday", "Sunday")
return weekdays[n % 7]
default calendar = Calendar()
label calendar:
call screen calendar
jump main_room_menu
screen calendar:
default contents = calendar.get_schedule().items()
grid 7 6:
style "empty"
align (0.5, 0.5)
for i in ("MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"):
fixed:
xysize (64, 64)
add "#fff"
text "[i]"
for i, ev in contents:
fixed:
xysize (64, 64)
if i > 29:
add "#888888"
elif i == (game.day % 30):
add "#ff0000ff"
else:
add "#fff"
vbox:
text "[(i % 30) + 1]" size 10 color "#000"
text "[ev]" size 12
textbutton "Close" action Return() align (0.5, 0.9)