[RenPy] 纯文本查看 复制代码
# Item Gallery
init python:
# Galleries settings - start
# List the item gallery images here:
gallery_item_items = ["clock", "shopsign", "sealstamp01", "cake", "invitation", "memento", "flower",
"vial",
"coffee", "bullet01", "blueprints", "cal", "mask", "pudding",
"pendant01", "pendant02", "mill", "pendant03", "pendant04", "sealstamp02",
"rifle", "dinner", "bullet02", "goldfish", "gown", "food", "memento02",
"souffle", "veil", "bouquet",
"bletter", "flowertrap", "dlletter", "glasses", "cape", "dportrait", "strawberrym", "sudoku", "lemontea", "bullet03", "pendant05", "dress",
"xbox", "wpump", "eaglehuntress", "mcookie", "weagle", "apple", "teatin", "manonsucre", "takeout", "anotebook", "venerec", "anurn",]
# How many rows and columns in the gallery screens?
gal_item_rows = 10
gal_item_cols = 10
# Thumbnail size in pixels:
thumbnail_x1 = 60
thumbnail_y1 = 60
# Galleries settings - end
gal_item_cells = gal_item_rows * gal_item_cols
g_item = Gallery()
for gal_item in gallery_item_items:
g_item.button(gal_item + " butt")
g_item.image(LiveComposite((800, 600), (0, 0), "ui/showitem_background.jpg", (250, 165), ImageReference(gal_item)))
g_item.unlock(gal_item)
g_item.transition = fade
item_page = 0
init +1 python:
# Here we create the thumbnails.
for gal_item in gallery_item_items:
renpy.image (gal_item + " butt", im.Scale(ImageReference(gal_item), thumbnail_x1, thumbnail_y1))
renpy.image (gal_item + " butt dis", im.Grayscale(ImageReference(gal_item + " butt")))
screen item_gallery:
tag menu
add "ui/item_gallery_ground.jpg"
imagebutton auto "ui/game_menu_return_%s.png" xpos 420 ypos 516 focus_mask True action ShowMenu("extra") hovered [Play ("test_two", "sd/click.wav")]
imagebutton auto "ui/game_menu_quit_%s.png" xpos 610 ypos 515 focus_mask True action Quit() hovered [ Play ("test_three", "sd/click.wav") ]
imagebutton auto "ui/game_menu_main_%s.png" xpos 45 ypos 525 focus_mask True action Return() hovered [ Play ("test_one", "sd/click.wav")]
frame background None xpos 143:
grid gal_item_rows gal_item_cols:
ypos 50
$ i = 0
$ next_item_page = item_page + 1
$ previous_item_page = item_page - 1
if next_item_page >= int(len(gallery_item_items)/gal_item_cells):
$ next_item_page = 1 #enter (last page number -1) here
if previous_item_page < 1:
$ previous_item_page = 0
for gal_item in gallery_item_items:
$ i += 1
if i <= (item_page+1)*gal_item_cells and i>item_page*gal_item_cells:
add g_item.make_button(gal_item + " butt", gal_item + " butt", gal_item + " butt dis",
xalign=0.5, yalign=0.5, idle_border=None, background=None, bottom_margin=15)
for j in range(i, (item_page+1)*gal_item_cells): #we need this to fully fill the grid
null
if len(gallery_item_items)>gal_item_cells:
imagebutton auto "ui/cg_menu_previous_%s.png" xpos 28 ypos 200 focus_mask True action [SetVariable('item_page', previous_item_page), ShowMenu("item_gallery")] hovered [Play ("test_one", "sd/click.wav")]
imagebutton auto "ui/cg_menu_next_%s.png" xpos 727 ypos 200 focus_mask True action [SetVariable('item_page', next_item_page), ShowMenu("item_gallery")] hovered [Play ("test_one", "sd/click.wav")]