I managed to mostly figure out how to reverse-engineer it based on the save slots screen in screens.rpy, however what I'm finding is that it's not allowing me to dismiss the screen if I don't want to make a selection—once you select this screen, you will make a choice or else you'll have to force-quit the app. Clicking on the main menu choices does nothing; neither does the Return button.
I've consulted the original screen's code to see if there is something I'm missing, but I can't see what the issue might be, unless perhaps there's just something inherent to the scrollable area that's getting in the way.
The following is the complete code for the screen, along with some seed data to display on it.
Code: Select all
init python:
import math
# Define our story list here
stories = [
{
"title": "Jugemu",
"prefix": "jugemu",
"summary": "What to name the kid?"
},
{
"title": "Binbougami",
"prefix": "binbougami",
"summary": "Who is lazier?"
},
{
"title": "Tairabayashi",
"prefix": "tairabayashi",
"summary": "Can anyone read this?"
},
{
"title": "Amidaike",
"prefix": "amidaike",
"summary": "A joke goes too far"
},
]
screen story_list():
default page_name_value = FilePageNameInputValue(_("Story List"))
use game_menu(_("Story List")):
viewport:
scrollbars "vertical"
mousewheel True
arrowkeys True
vbox:
## This ensures the input will get the enter event before any of the
## buttons do.
order_reverse True
## The grid of file slots.
grid gui.file_slot_cols story_grid_rows:
style_prefix "slot"
xalign 0.5
yalign 0.5
spacing gui.slot_spacing
for i in range(story_grid_cells):
if (i < len(stories)):
button:
action Start(stories[i]["prefix"] + "_start") ## Start telling story from Label in string
has vbox
add im.Scale("bg temple outside.png", config.thumbnail_width, config.thumbnail_height) xalign 0.5
text stories[i]["title"]:
style "slot_time_text"
text stories[i]["summary"]:
style "slot_name_text"
else: ## Create an empty button
button:
has vbox
add im.Scale("bg home.jpg", config.thumbnail_width, config.thumbnail_height) xalign 0.5
text "":
style "slot_time_text"
text "":
style "slot_name_text"
Code: Select all
screen navigation():
vbox:
style_prefix "navigation"
xpos gui.navigation_xpos
yalign 0.5
spacing gui.navigation_spacing
if main_menu:
textbutton _("Start") action Start()
else:
textbutton _("History") action ShowMenu("history")
textbutton _("Save") action ShowMenu("save")
textbutton _("Load") action ShowMenu("load")
textbutton _("Story List") action ShowMenu("story_list") # Added item here
textbutton _("Glossary") action ShowMenu("glossary")
textbutton _("Preferences") action ShowMenu("preferences")
...