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