145 lines
5.5 KiB
Plaintext
Raw Normal View History

2024-11-17 14:32:23 +00:00
init python in mirror_of_erised:
def select(item):
scope = renpy.get_screen("mirror_interface").scope
scope["selected_item"] = item
item.seen = True
renpy.restart_interaction()
def play(item):
item.play()
renpy.jump("mirror")
label mirror(inter_pause=True):
$ disable_game_menu()
if inter_pause:
# Ensures all irrelevant screens are hidden before capturing the surface tree
with Pause(0.2)
call screen mirror_interface
$ enable_game_menu()
2022-05-17 00:48:22 +01:00
call screen room_menu
2024-11-17 14:32:23 +00:00
screen mirror_interface():
2022-05-17 00:48:22 +01:00
modal True
2024-11-17 14:32:23 +00:00
layer "interface"
zorder 0
style_prefix "mirror"
2022-05-17 00:48:22 +01:00
2024-11-17 14:32:23 +00:00
default navigation_atl = navigation_show
default last_frame = (screenshot.capture() or screenshot.image)
default navigation_last_frame_atl = navigation_last_frame_show
default navigation_exit = False
2022-05-17 00:48:22 +01:00
2024-11-17 14:32:23 +00:00
default menu_categories = mirror.get_tags()
default category = menu_categories[0]
default menu_items = mirror.get_instances_of_tag(category)
default selected_item = None
2022-05-17 00:48:22 +01:00
2024-11-17 14:32:23 +00:00
add last_frame at navigation_last_frame_atl
2022-05-17 00:48:22 +01:00
2024-11-17 14:32:23 +00:00
if navigation_exit:
timer 0.4 action Return()
2022-05-17 00:48:22 +01:00
2024-11-17 14:32:23 +00:00
frame:
2022-05-17 00:48:22 +01:00
style "empty"
2024-11-17 14:32:23 +00:00
align (0.5, 0.5)
at navigation_atl
2022-05-17 00:48:22 +01:00
vbox:
2024-11-17 14:32:23 +00:00
style_prefix "navigation_subtabs"
pos (286, 170)
2022-05-17 00:48:22 +01:00
2024-11-17 14:32:23 +00:00
at navigation_subtabs_show
2022-05-17 00:48:22 +01:00
2024-11-17 14:32:23 +00:00
for i in menu_categories:
textbutton "[i.capitalize()]" action [SetScreenVariable("category", i), SetScreenVariable("menu_items", mirror.get_instances_of_tag(i))] selected (category==i) at navigation_tabs
null height 35
textbutton _("Return") action [SetScreenVariable("navigation_last_frame_atl", navigation_last_frame_hide), SetScreenVariable("navigation_atl", navigation_hide), SetScreenVariable("navigation_exit", True)] keysym ["game_menu", "achievements"] at navigation_tabs
2022-05-17 00:48:22 +01:00
2024-11-17 14:32:23 +00:00
if selected_item:
2022-05-17 00:48:22 +01:00
vbox:
2024-11-17 14:32:23 +00:00
style_prefix "navigation_tabs"
pos (798, 170)
at navigation_tabs_show
textbutton _("Play"):
action Function(mirror_of_erised.play, selected_item)
style "navigation_tabs_button_special"
at navigation_tabs
frame:
label _("Mirror of Erised")
# text "([achievements.get_percentage()]%)" pos (108, -3)
2022-05-17 00:48:22 +01:00
2024-11-17 14:32:23 +00:00
# Add items
viewport:
ypos 32
scrollbars "vertical"
mousewheel True
draggable "touch"
2022-05-17 00:48:22 +01:00
vbox:
2024-11-17 14:32:23 +00:00
for item in menu_items:
$ authors = ", ".join(item.authors)
$ item_unlocked = item.is_unlocked()
$ item_color = "#ffffff" if item_unlocked else "#8d8d8d"
fixed:
fit_first True
button:
hbox:
fixed:
xysize (48, 48)
add Text("Placeholder") xysize (48, 48) fit "contain" align (0.5, 0.5)
# add crop_image_zoom(Text("No icon"), 48, 48, not item_unlocked) xysize (48, 48) fit "contain" align (0.5, 0.5)
null width 5
vbox:
text "[item.name]" color item_color
text _("By [authors]") size 10 color item_color style "mirror_text_small"
text "[item.desc]" color item_color style "mirror_text_small"
action Function(mirror_of_erised.select, item)
selected (selected_item == item)
sensitive (item_unlocked)
if item.played:
add "interface/topbar/icon_check.webp" xysize (24, 24) yalign 0.5
if item_unlocked and not item.seen:
text "NEW" align (1.0, 1.0) offset (-5, -5)
# if item_data.progression:
# if item_unlocked:
# bar value StaticValue(1.0)
# else:
# bar value StaticValue(eval(item_data.progression), item_data.progression_max) style "achievements_bar_disabled"
add "frame_spacer" xalign 0.5 xsize 500
style mirror_viewport is viewport:
xalign 0.5
ymaximum 397
style mirror_vbox is frame_vbox:
ypos 0
yspacing 0
xalign 0
style mirror_frame is frame
style mirror_label is frame_label
style mirror_label_text is frame_label_text
style mirror_text is frame_text:
xalign 0
style mirror_text_small is mirror_text:
xalign 0
size 12
style mirror_button is frame_button:
xfill True
yminimum 48
selected_foreground "#ffffff2d"
style mirror_button_text is frame_button_text
style mirror_bar is player_bar:
xmaximum 400
yalign 1.0
xpos 78
ysize 10
yoffset -2
style mirror_bar_disabled is mirror_bar:
left_bar Frame(Transform(Image("gui/creamy_pumpkin_pie/player/player_bar_full.png", oversample=4), matrixcolor=BrightnessMatrix(-0.5)), 24, 0, tile=False)
right_bar Frame(Transform(Image("gui/creamy_pumpkin_pie/player/player_bar_empty.png", oversample=4), matrixcolor=BrightnessMatrix(-0.5)), 24, 0, tile=False)