Implements mod support and fixes the gallery in Android #211

Merged
MapAnon merged 5 commits from Legalo/SnootGame:android_mods into Patch8-RAGE 2022-11-29 07:12:20 +00:00
3 changed files with 41 additions and 11 deletions

View File

@ -1785,6 +1785,7 @@ screen extrasnavigation(): #Updates are removed (not even supported by Ren'Py)
[ "Help", ShowMenu("help") ], [ "Help", ShowMenu("help") ],
[ "About", ShowMenu("about") ], [ "About", ShowMenu("about") ],
[ "Gallery", ShowMenu("cg_gallery_0") ], [ "Gallery", ShowMenu("cg_gallery_0") ],
[ "Mods", ShowMenu("mod_menu") ],
[ "Return", ShowMenu("main_menu") ] [ "Return", ShowMenu("main_menu") ]
] ) ] )

View File

@ -109,7 +109,7 @@ init 2 python:
#CACHE_PATH = config.basedir.replace("\\","/") + "/game/cache/" #CACHE_PATH = config.basedir.replace("\\","/") + "/game/cache/"
FILENAME = os.path.join(config.basedir, 'game/src/gallery_dataset.json') FILENAME = os.path.join(config.basedir, 'game/src/gallery_dataset.json')
#CACHE_PATH = config.basedir.replace("\\","/") + "/game/cache/" #CACHE_PATH = config.basedir.replace("\\","/") + "/game/cache/"
fp = open(FILENAME) fp = renpy.open_file('src/gallery_dataset.json')
data = json.load(fp) data = json.load(fp)
list_img = renpy.list_images() list_img = renpy.list_images()

View File

@ -56,18 +56,47 @@ screen mod_menu():
ymaximum 0.8 ymaximum 0.8
ypos 200 ypos 200
yinitial 0 yinitial 0
scrollbars "vertical" if len(mod_menu_access) > 5: # Hides the scrollbar when not needed. Ideally nobody would install more than one mod at the same time, but oh well
scrollbars "vertical"
mousewheel True mousewheel True
draggable True draggable True
pagekeys True pagekeys True
vbox:
#xpos 1885
spacing 18
#yalign 0.98
#buttons are messed up but that's ok
use mod_menu_button("gui/button/menubuttons/template_idle.png", "Return", ShowMenu("main_menu")) if len(mod_menu_access) != 0:
if len(mod_menu_access) != 0: vbox:
use mod_menu_button("gui/button/menubuttons/template_idle.png", _("Return"), ShowMenu("main_menu"))
spacing 18
use mod_menu_buttons("gui/button/menubuttons/template_idle.png", mod_menu_access ) use mod_menu_buttons("gui/button/menubuttons/template_idle.png", mod_menu_access )
else: else:
use mod_menu_button("gui/button/menubuttons/template_idle.png", "You have no mods", None) use mod_menu_button("gui/button/menubuttons/template_idle.png", _("Return"), ShowMenu("main_menu"))
text _("You have no mods! \nInstall some in:\n\"[moddir]\""):
style_prefix "navigation"
size 45
text_align 0.5
outlines [(3, "#445ABB", absolute(0), absolute(0))]
at truecenter
#############################
# Stuff for mods in android #
#############################
init python:
import os
if renpy.android:
moddir = os.path.join(os.environ["ANDROID_PUBLIC"], "game")
try:
# We have to create both the 'game' and 'mods' folder for android.
os.mkdir(moddir)
os.mkdir(os.path.join(moddir, "mods"))
except:
pass
else:
moddir = ".../game"
moddir += "/mods/"