mirror of
https://git.cavemanon.xyz/Cavemanon/SnootGame.git
synced 2025-02-02 06:46:34 +01:00
cg gallery wip vol5: unlocking cgs
This commit is contained in:
parent
a8c65161be
commit
1f3a04c355
2 changed files with 19 additions and 5 deletions
|
@ -359,6 +359,8 @@ pause 1.0
|
|||
|
||||
"Volcaldera Bluffs."
|
||||
|
||||
$ unlockCg("a02")
|
||||
|
||||
"Weather conditions; cold as balls."
|
||||
|
||||
"It’s my first time living close to water."
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
default persistent.cggallery = []
|
||||
|
||||
init python:
|
||||
# GALLERY OBJECT
|
||||
# Handles unlockables via ren'py
|
||||
g = Gallery()
|
||||
g.transition = dissolve
|
||||
|
||||
# CONST PARAMS
|
||||
GALLERY_COLS = 3
|
||||
|
@ -17,6 +20,13 @@ init python:
|
|||
# Which page of the gallery is shown
|
||||
galleryPage = 1
|
||||
|
||||
# Global function to unlock a cg
|
||||
def unlockCg(fname):
|
||||
unlocked = fname in persistent.cggallery
|
||||
if not unlocked:
|
||||
persistent.cggallery.append(fname)
|
||||
renpy.persistent.save()
|
||||
|
||||
# Make a scaled cg button
|
||||
# (cg: string, unlocked?: boolean): Displayable
|
||||
def cg(fname, unlocked = False):
|
||||
|
@ -33,8 +43,9 @@ init python:
|
|||
|
||||
if unlocked:
|
||||
g.unlock(imageName)
|
||||
g.condition("True")
|
||||
else:
|
||||
g.condition("persistent." + imageName)
|
||||
g.condition("False")
|
||||
|
||||
galleryItems.append({
|
||||
"item": imageName,
|
||||
|
@ -58,7 +69,9 @@ init python:
|
|||
for cgFile in listdir(cgDirPath):
|
||||
if isfile(join(cgDirPath, cgFile)):
|
||||
if (cgFile[-4:] == '.png'):
|
||||
addGalleryItem(cgFile[0:-4], True)
|
||||
fname = str(cgFile[0:-4])
|
||||
unlocked = fname in persistent.cggallery
|
||||
addGalleryItem(fname, unlocked)
|
||||
|
||||
# Add empty items to fill grid after last cg button
|
||||
extraSpaces = GALLERY_COLS - (len(galleryItems) % GALLERY_COLS)
|
||||
|
@ -84,7 +97,7 @@ init python:
|
|||
## A screen that shows the image gallery
|
||||
screen cg_gallery():
|
||||
tag menu
|
||||
use game_menu(_("Gallery"), scroll="viewport"):
|
||||
use game_menu(_("Gallery")):
|
||||
|
||||
fixed:
|
||||
$ pageItems = getGalleryPage(galleryPage)
|
||||
|
@ -99,8 +112,7 @@ screen cg_gallery():
|
|||
# Iterate through galleryItems and add cgs buttons
|
||||
for item in pageItems:
|
||||
if item["item"] == None:
|
||||
# TODO: empty space
|
||||
add g.make_button(pageItems[0]["item"], pageItems[0]["cg"], xalign = 0.5, yalign = 0.5)
|
||||
hbox
|
||||
else:
|
||||
add g.make_button(item["item"], item["cg"], xalign = 0.5, yalign = 0.5)
|
||||
|
||||
|
|
Loading…
Reference in a new issue