mirror of
https://git.cavemanon.xyz/Cavemanon/SnootGame.git
synced 2025-02-24 18:48:55 +01:00
Loopable Screens between different folders
This commit is contained in:
parent
24324ec3ed
commit
c4f95dd7c6
2 changed files with 47 additions and 29 deletions
|
@ -1137,7 +1137,7 @@ screen extrasnavigation():
|
|||
[ "Help", ShowMenu("help") ],
|
||||
[ "About", ShowMenu("about") ],
|
||||
[ "Updates", ShowMenu("updates") ],
|
||||
[ "Gallery", ShowMenu("cg_gallery") ],
|
||||
[ "Gallery", ShowMenu("cg_gallery_0") ],
|
||||
[ "Return", ShowMenu("main_menu") ]
|
||||
] )
|
||||
|
||||
|
|
|
@ -10,10 +10,9 @@ init python:
|
|||
NOT_UNLOCKED_COVER = im.FactorScale("gui/gallery/unlocked_cg_button_cover.png", DEFAULT_WIDTH_SCALE_RATIO, DEFAULT_HEIGHT_SCALE_RATIO)
|
||||
ACCEPTED_EXTENSIONS = ["jpg", "png"]
|
||||
CG_PATHS = [
|
||||
{ 'path': "images/cgs/", 'name': "CG", 'eval': None
|
||||
}, #CG doesn't really make sense
|
||||
{ 'path': "images/animations/", 'name': "Animations", 'eval': None
|
||||
},
|
||||
#CG doesn't really make sense
|
||||
{ 'path': "images/cgs/", 'name': "CG", 'eval': None },
|
||||
#{ 'path': "images/animations/", 'name': "Animations", 'eval': None },
|
||||
{ 'path': "images/NotForKids!/", 'name': "Lewd",
|
||||
'eval': 'presistent.lewd == True'
|
||||
}
|
||||
|
@ -25,8 +24,9 @@ init python:
|
|||
item is name, fn is fullpath
|
||||
ext is the file extension
|
||||
{ item: string; fn: string, cg: Displayable; ext: string }[]
|
||||
(reference in this init python, actually used in screens)
|
||||
"""
|
||||
galleryItems = []
|
||||
gallery_items = []
|
||||
|
||||
# key dict pair, cg <-> cgs' galleryitems []
|
||||
gallery_dic = {} #
|
||||
|
@ -80,11 +80,22 @@ init python:
|
|||
# Call to loading the gallery
|
||||
loadGallery()
|
||||
|
||||
"""
|
||||
'Recursive' / Loopable / Roundtrip Screens
|
||||
_0 <-> _1
|
||||
"""
|
||||
screen cg_gallery_0(__yoffset = 0, origin = 'CG'):
|
||||
tag menu
|
||||
use cg_gallery('1', __yoffset, origin)
|
||||
screen cg_gallery_1( __yoffset = 0, origin = 'CG'):
|
||||
tag menu
|
||||
use cg_gallery('0', __yoffset, origin)
|
||||
|
||||
"""
|
||||
CG Gallery screen - A screen that shows the image gallery
|
||||
Basically Gallery Object has terrible defaults, so I just wrote my own stuff
|
||||
"""
|
||||
screen cg_gallery(__yoffset = 0):
|
||||
screen cg_gallery(flag, __yoffset = 0, origin = 'CG'):
|
||||
|
||||
style_prefix "game_menu"
|
||||
if main_menu:
|
||||
|
@ -93,17 +104,19 @@ screen cg_gallery(__yoffset = 0):
|
|||
add gui.main_menu_background
|
||||
add gui.game_menu_background
|
||||
|
||||
python:
|
||||
galleryItems = gallery_dic["CG"]
|
||||
items = len(galleryItems)
|
||||
galleryRows = (items / GALLERY_COLS) + 1
|
||||
extraSpaces = GALLERY_COLS - (items % GALLERY_COLS)
|
||||
item_counter = 0
|
||||
|
||||
tag menu
|
||||
frame:
|
||||
style "game_menu_outer_frame"
|
||||
|
||||
python:
|
||||
empty_spaces = gallery_rows = item_counter = 0
|
||||
|
||||
gallery_items = gallery_dic[origin]
|
||||
items = len(gallery_items)
|
||||
gallery_rows = (items / GALLERY_COLS) + 1
|
||||
empty_spaces = GALLERY_COLS - (items % GALLERY_COLS)
|
||||
|
||||
frame:
|
||||
|
||||
style "game_menu_outer_frame"
|
||||
viewport:
|
||||
yinitial __yoffset
|
||||
scrollbars "vertical"
|
||||
|
@ -112,8 +125,8 @@ screen cg_gallery(__yoffset = 0):
|
|||
pagekeys True
|
||||
xpos 440
|
||||
|
||||
grid GALLERY_COLS galleryRows:
|
||||
for item in galleryItems:
|
||||
grid GALLERY_COLS gallery_rows:
|
||||
for item in gallery_items:
|
||||
# Should properly fix with actual margin difference but good
|
||||
# enough or the actual position
|
||||
python:
|
||||
|
@ -121,9 +134,9 @@ screen cg_gallery(__yoffset = 0):
|
|||
yoffset = item_counter / 3 * PREFERRED_HEIGHT * 1.15
|
||||
yoffset = int( yoffset + (PREFERRED_HEIGHT * 1.15))
|
||||
|
||||
use flag_button(item, yoffset)
|
||||
use flag_button(item, yoffset, origin)
|
||||
|
||||
for i in range(0, extraSpaces):
|
||||
for i in range(0, empty_spaces):
|
||||
null height 20
|
||||
|
||||
vbox:
|
||||
|
@ -133,10 +146,15 @@ screen cg_gallery(__yoffset = 0):
|
|||
|
||||
spacing gui.navigation_spacing
|
||||
|
||||
textbutton _("CG")
|
||||
textbutton _("NotForKids!")
|
||||
textbutton _("Animations")
|
||||
textbutton _("Return") action Return()
|
||||
|
||||
for cp in CG_PATHS:
|
||||
#gallery_dic[cp['name']] = [] #
|
||||
if cp['name'] is origin:
|
||||
textbutton _(cp['name'])
|
||||
else:
|
||||
textbutton _(cp['name']) action ShowMenu('cg_gallery_'+flag, 0, cp['name'])
|
||||
#textbutton _(cp['name']) action set_reflow(origin, cp['name'], gallery_rows, empty_spaces)
|
||||
textbutton _("Return") action ShowMenu('main_menu')
|
||||
|
||||
if _in_replay:
|
||||
textbutton _("End Replay") action EndReplay(confirm=True)
|
||||
|
@ -150,12 +168,12 @@ screen cg_gallery(__yoffset = 0):
|
|||
"""
|
||||
if/else flow control & extra parameters for Buttons
|
||||
"""
|
||||
screen flag_button(item, yoffset):
|
||||
screen flag_button(item, yoffset, origin):
|
||||
python:
|
||||
flag = renpy.seen_image(item['item'])
|
||||
if flag:
|
||||
button:
|
||||
action ShowMenu('view_image', item['fn'], ShowMenu('cg_gallery', yoffset))
|
||||
action ShowMenu('view_image', item['fn'], ShowMenu('cg_gallery_0', yoffset, origin))
|
||||
xcenter 0.5 ycenter 0.5
|
||||
vbox:
|
||||
text item["item"] xalign 0.5
|
||||
|
@ -170,12 +188,12 @@ screen flag_button(item, yoffset):
|
|||
"""
|
||||
view_image, Loads the image in fullscreen with viewport control.
|
||||
"""
|
||||
screen view_image(fn, origin):
|
||||
screen view_image(fn, _origin):
|
||||
tag menu
|
||||
key "game_menu" action origin
|
||||
key "game_menu" action _origin
|
||||
viewport:
|
||||
#Ren'Py is isn't smart enough to not edgescroll while pressed, so we'll have to disable this for mobile
|
||||
edgescroll (300, 800)
|
||||
edgescroll (300, 1800)
|
||||
draggable True
|
||||
arrowkeys True
|
||||
pagekeys True
|
||||
|
|
Loading…
Reference in a new issue