https://imgur.com/YMxD83u
Now I have two doubts:
First one would be like adding a 'next' button as I put it in the image, this button will show for example rin ryusaki2
and second how to put an imagebutton instead of that which comes predetermined?
Here is the code
This is art.rpy
Code: Select all
init:
# Position the navigation on the right side of the screen.
$ style.gallery_nav_frame.xpos = 800 - 10
$ style.gallery_nav_frame.xanchor = 0.0
$ style.gallery_nav_frame.ypos = 12
# Add the gallery to the main menu.
$ config.main_menu.insert(2, ('Gallery', "gallery", "True"))
# The entry point to the gallery code.
label gallery:
python hide:
# Construct a new gallery object.
g = Gallery()
# The image used for locked buttons.
g.locked_button = "images/gallocked.png"
# The background of a locked image.
g.locked_background = "images/intro.jpg"
# Frames added over unlocked buttons, in hover and idle states.
g.hover_border = "images/transparente.png"
g.idle_border = "images/transparente.png"
# An images used as the background of the various gallery pages.
g.background = "images/Zapatos.jpg"
# Lay out the gallery images on the screen.
# These settings lay images out 3 across and 4 down.
# The upper left corner of the gird is at xpos 10, ypos 20.
# They expect button images to be 155x112 in size.
g.grid_layout((3, 4), (10, 12), (260, 164))
# We can use g.page to introduce a second page.
g.page("Rin Ryusaki")
g.button("images/Desbloqueada/cg.png")
g.unlock_image("rinx1")
g.unlock_image("rinx2")
g.unlock_image("rinx3")
g.button("images/Desbloqueada/mini-matones.png")
g.unlock_image("matyryu")
g.button("images/Desbloqueada/rin-sexo.png")
g.unlock_image("rinsex1")
g.unlock_image("rinsex2")
g.unlock_image("rinsexx3")
g.button("images/Desbloqueada/mini-abrazo.png")
g.unlock_image("abrazorin")
g.button("images/Desbloqueada/mini-besohuida.png")
g.unlock_image("besohuida")
g.button("images/Desbloqueada/mini-finalerin.png")
g.unlock_image("rinfinales")
g.button("images/Desbloqueada/mini-rincasada.png")
g.unlock_image("rincasada")
g.button("images/Desbloqueada/mini-huidatragica.png")
g.unlock_image("huidatragica")
g.unlock_image("huidatragica2")
g.unlock_image("huidatragica3")
g.unlock_image("huidatragica4")
g.button("images/Desbloqueada/mini-rinbeso.png")
g.unlock_image("rinbeso")
g.unlock_image("rinbeso2")
g.button("images/Desbloqueada/mini-rincama.png")
g.unlock_image("rincamasorpresa")
g.unlock_image("rincamatriste")
g.unlock_image("rincamallorando")
g.button("images/Desbloqueada/mini-rincocina.png")
g.unlock_image("rincocina")
g.unlock_image("rincocina2")
g.unlock_image("rincocina3")
g.button("images/Desbloqueada/mini-rinabrazito.png")
g.unlock_image("rinfinale")
g.unlock_image("rinfinale2")
g.page("Rin Ryusaki 2")#12
g.button("images/Desbloqueada/mini-rinhija.png")
g.unlock_image("rinhija")
g.button("images/Desbloqueada/mini-rinsexo.png")
g.unlock_image("rins")
g.unlock_image("rins2")
g.unlock_image("rins3")
g.button("images/Desbloqueada/mini-rinmuerta.png")
g.unlock_image("rinsuicidio")
g.button("images/Desbloqueada/mini-rintropiezo.png")
g.unlock_image("rintropiezo")
g.button("images/Desbloqueada/mini-rinyh.png")
g.unlock_image("rincama")
g.unlock_image("rincama2")
g.unlock_image("rincama3")
g.button("images/Desbloqueada/mini-yandere.png")
g.unlock_image("yandererin")
g.button("images/Desbloqueada/mini-azotea.png")
g.unlock_image("comerazotea")
g.show()
jump main_menu_screen
Code: Select all
init -50 python:
style.create('gallery_nav_frame', 'frame')
style.create('gallery_nav_vbox', 'vbox')
style.create('gallery_nav_button', 'button')
style.create('gallery_nav_button_text', 'button_text')
style.gallery_nav_button.size_group = "gallery_nav_button"
class GalleryGridLayout(object):
def __init__(self, gridsize, upperleft, offsets):
self.gridsize = gridsize
self.upperleft = upperleft
self.offsets = offsets
def __call__(self, imagenum, image_count):
cols, rows = self.gridsize
ulx, uly = self.upperleft
ox, oy = self.offsets
return dict(
xpos = ulx + (imagenum % cols) * ox,
ypos = uly + (imagenum // cols) * oy,
)
class GalleryAllPriorCondition(object):
def check(self, all_prior):
return all_prior
class GalleryArbitraryCondition(object):
def __init__(self, condition):
self.condition = condition
def check(self, all_prior):
return eval(self.condition)
class GalleryUnlockCondition(object):
def __init__(self, images):
self.images = images
def check(self, all_prior):
for i in self.images:
if tuple(i.split()) not in persistent._seen_images:
return False
return True
class GalleryImage(object):
def __init__(self, gallery, images, displayable):
self.gallery = gallery
self.images = images or [ ]
self.displayable = displayable
self.conditions = [ ]
def check_unlock(self, all_prior):
for i in self.conditions:
if not i.check(all_prior):
return False
return True
def show_locked(self, image_num, image_count):
renpy.transition(self.gallery.transition)
self.gallery.locked_image(image_num, image_count)
ui.saybehavior()
ui.interact()
def show(self, image_num, image_count):
renpy.transition(self.gallery.transition)
renpy.scene()
for i in self.images:
renpy.show(i)
if self.displayable:
ui.add(self.displayable)
ui.saybehavior()
ui.interact()
class GalleryButton(object):
def __init__(self, gallery, idle, hover, insensitive, properties):
self.gallery = gallery
self.idle = idle
self.hover = hover
self.insensitive = insensitive
self.properties = properties
self.images = [ ]
self.conditions = [ ]
def check_unlock(self):
for i in self.conditions:
if not i.check(True):
return False
for i in self.images:
if i.check_unlock(False):
return True
return False
def render(self, i, pos):
props = pos.copy()
props.update(self.properties)
if not self.check_unlock():
insensitive = self.insensitive or self.gallery.locked_button
if insensitive is not None:
ui.image(insensitive, **props)
return
if self.hover:
ui.imagebutton(self.idle,
self.hover,
clicked=ui.returns(("button", i)),
**props)
else:
ui.image(self.idle, **props)
ui.imagebutton(self.gallery.idle_border,
self.gallery.hover_border,
clicked=ui.returns(("button", i)),
**props)
def show(self):
all_prior = True
for i, img in enumerate(self.images):
if img.check_unlock(all_prior):
img.show(i, len(self.images))
else:
img.show_locked(i, len(self.images))
all_prior = False
class GalleryPage(object):
def __init__(self, gallery, name, background):
self.gallery = gallery
self.name = name
self.background = background
self.buttons = [ ]
class Gallery(object):
transition = dissolve
locked_button = None
locked_background = "#000"
hover_border = None
idle_border = None
background = None
def __init__(self):
self.pages = [ ]
self.page_ = None
self.button_ = None
self.image_ = None
self.unlockable = None
def page(self, name, background="gui/file_picker_ground2.jpg"):
self.page_ = GalleryPage(self, name, background)
self.pages.append(self.page_)
def button(self, idle, hover=None, locked=None, **properties):
self.button_ = GalleryButton(self, idle, hover, locked, properties)
self.page_.buttons.append(self.button_)
self.unlockable = self.button_
def image(self, *images):
self.image_ = GalleryImage(self, images, None)
self.button_.images.append(self.image_)
self.unlockable = self.image_
def display(self, displayable):
self.image_ = GalleryImage(self, [ ], displayable)
self.button_.images.append(self.image_)
self.unlockable = self.image_
def unlock(self, *images):
self.unlockable.conditions.append(GalleryUnlockCondition(images))
def condition(self, condition):
self.unlockable.conditions.append(GalleryArbitraryCondition(condition))
def allprior(self):
self.unlockable.conditions.append(GalleryAllPriorCondition())
def unlock_image(self, *images):
self.image(*images)
self.unlock(*images)
def navigation(self, page_name, page_num, pages):
ui.frame(style='gallery_nav_frame')
ui.vbox(style='gallery_nav_vbox')
for i, p in enumerate(self.pages):
layout.button(p.name,
"gallery_nav",
selected=(i == page_num),
clicked=ui.returns(("page", i)))
ui.null(height=22)
layout.button("Return", "gallery_nav", clicked=ui.returns(("return", 0)))
ui.close()
def grid_layout(self, gridsize, upperleft, offsets):
self.layout = GalleryGridLayout(gridsize, upperleft, offsets)
def layout(self, i, n):
return { }
def locked_image(self, num, total):
ui.add(self.locked_background)
ui.text(_("Imagen %d de %d está bloqueada.") % (num + 1, total), xalign=0.5, yalign=0.5)
def show(self, page=0):
while True:
renpy.transition(self.transition)
p = self.pages[page]
bg = p.background or self.background
if bg is not None:
renpy.scene()
ui.add(bg)
self.navigation(p.name, page, len(self.pages))
for i, b in enumerate(p.buttons):
pos = self.layout(i, len(p.buttons))
b.render(i, pos)
cmd, arg = ui.interact(suppress_overlay=True, suppress_underlay=True)
if cmd == "return":
return
elif cmd == "page":
page = arg
continue
elif cmd == "button":
p.buttons[arg].show()
continue