Code: Select all
screen save():
tag menu
use file_slots(_("Save"))
add "gui/game_menu.png"
textbutton "Return" action Return() xalign 0.03 yalign 0.90
hbox:
text "Save"
xalign 0.03 yalign 0.05
hbox:
xalign 0.80
yalign 0.90
spacing 50
textbutton "About" action ShowMenu("about")
textbutton "Help" action ShowMenu("help")
textbutton "Quit" action Quit(confirm=not main_menu)
screen load():
tag menu
use file_slots(_("Load"))
add "gui/game_menu.png"
textbutton "Return" action Return() xalign 0.03 yalign 0.90
hbox:
text "Load"
xalign 0.03 yalign 0.05
hbox:
xalign 0.80
yalign 0.90
spacing 50
textbutton "About" action ShowMenu("about")
textbutton "Help" action ShowMenu("help")
textbutton "Quit" action Quit(confirm=not main_menu)
screen file_slots(title):
default page_name_value = FilePageNameInputValue(pattern=_("Page {}"), auto=_("Automatic saves"), quick=_("Quick saves"))
#use game_menu(title)
fixed:
## This ensures the input will get the enter event before any of the
## buttons do.
order_reverse True
## The page name, which can be edited by clicking on a button.
#button:
#style "page_label"
#key_events True
#xalign 1.0
#yalign 0.05
#action page_name_value.Toggle()
#input:
#style "page_label_text"
#value page_name_value
## The grid of file slots.
grid gui.file_slot_cols gui.file_slot_rows:
style_prefix "slot"
xalign 0.03
yalign 0.35
spacing gui.slot_spacing
for i in range(gui.file_slot_cols * gui.file_slot_rows):
$ slot = i + 1
button:
action FileAction(slot)
has vbox
add FileScreenshot(slot) xalign 0.5
text FileTime(slot, format=_("{#file_time}%A, %B %d %Y, %H:%M"), empty=_("empty slot")):
style "slot_time_text"
text FileSaveName(slot):
style "slot_name_text"
key "save_delete" action FileDelete(slot)
## Buttons to access other pages.
hbox:
style_prefix "page"
xalign 0.53
yalign 1.0
spacing gui.page_spacing
textbutton _("<") action FilePagePrevious()
if config.has_autosave:
textbutton _("{#auto_page}A") action FilePage("auto")
if config.has_quicksave:
textbutton _("{#quick_page}Q") action FilePage("quick")
## range(1, 10) gives the numbers from 1 to 9.
for page in range(1, 10):
textbutton "[page]" action FilePage(page)
textbutton _(">") action FilePageNext()