Here we have two gallery buttons defined like so (with the red one unlocked):
Code: Select all
default file_dict = {"red_file": False, "blue_file": False}
init python:
global file_dict
g = Gallery()
g.navigation = True
g.span_buttons = True
g.unlocked_advance = True
g.button("red_square")
g.condition("file_dict['red_file']")
g.image("Red_50x50.png")
g.button("blue_square")
g.condition("file_dict['blue_file']")
g.image("Blue_50x50.png")
screen file_gallery:
tag menu
use game_menu(_("Files")):
grid 3 3:
xfill True
yfill True
add g.make_button("red_square", "Red_50x50.png", locked = "Gray_50x50.png", xalign = 0.5, yalign = 0.5)
add g.make_button("blue_square", "Blue_50x50.png", locked = "Gray_50x50.png", xalign = 0.5, yalign = 0.5)
However, in the menu of the red square, the menu enabled by 'g.navigation = True', it is posible to navigate into the blue square by clicking next, dispite blue remaining locked.
I looked closer into the gallery source code, 00gallery.rpy, and found the part handeling the navigation behavior:
Code: Select all
def show(self, button=0, image=0):
# A list of (button, image) index pairs for all of the images we know
# about.
all_images = [ ]
# A list of (button, image) index pairs for all of the unlocked
# images.
unlocked_images = [ ]
for bi, b in enumerate(self.button_list):
all_unlocked = True
for ii, i in enumerate(b.images):
all_images.append((bi, ii))
unlocked = i.check_unlock(all_unlocked)
if unlocked:
unlocked_images.append((bi, ii))
else:
all_unlocked = False
if self.unlocked_advance and (button == bi) and (image == ii):
image += 1
self.slideshow = False
# Loop, displaying the images.
while True:
...
# At this point, result is either 'next', "next_unlocked", "previous", or "previous_unlocked"
# Go through the common advance code.
if self.unlocked_advance:
images = unlocked_images
else:
images = all_images
if (button, image) in images:
index = images.index((button, image))
else:
index = -1
if result.startswith('previous'):
index -= 1
else:
index += 1
if index < 0 or index >= len(images):
break
new_button, new_image = images[index]
if not self.span_buttons:
if new_button != button:
break
button = new_button
image = new_image
I would like to do more research, but I am unable to get the state of 'unlocked_images' at runtime. Does anyone have an idear of what the problem could be and how I could get to the value at runtime?