From 001d7fff0f764e9039b29594cf54d0f50800e5d9 Mon Sep 17 00:00:00 2001 From: GManon Date: Tue, 29 Nov 2022 00:40:14 -0300 Subject: [PATCH 1/5] Trying to fix mods and gallery in android --- game/src/cg_gallery.rpy | 2 +- game/src/mod_menu.rpy | 52 +++++++++++++++++++++++++++++++++-------- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/game/src/cg_gallery.rpy b/game/src/cg_gallery.rpy index 296f670..3cd8d3b 100644 --- a/game/src/cg_gallery.rpy +++ b/game/src/cg_gallery.rpy @@ -109,7 +109,7 @@ init 2 python: #CACHE_PATH = config.basedir.replace("\\","/") + "/game/cache/" FILENAME = os.path.join(config.basedir, 'game/src/gallery_dataset.json') #CACHE_PATH = config.basedir.replace("\\","/") + "/game/cache/" - fp = open(FILENAME) + fp = renpy.open_file('src/gallery_dataset.json') data = json.load(fp) list_img = renpy.list_images() diff --git a/game/src/mod_menu.rpy b/game/src/mod_menu.rpy index f40fe0f..4d5fdc9 100644 --- a/game/src/mod_menu.rpy +++ b/game/src/mod_menu.rpy @@ -56,18 +56,50 @@ screen mod_menu(): ymaximum 0.8 ypos 200 yinitial 0 - scrollbars "vertical" + if len(mod_menu_access) > 5: # Hides the scrollbar when not needed. Ideally nobody would install mora than one at the same time, but oh well + scrollbars "vertical" mousewheel True draggable 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 ) - else: - use mod_menu_button("gui/button/menubuttons/template_idle.png", "You have no mods", None) + else: + 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 center + +############################# +# Stuff for mods in android # +############################# + +init python: + + import os + + if renpy.windows: + moddir = renpy.config.gamedir.replace("\\", "/") + + elif 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 = renpy.config.gamedir + + moddir += "/mods/" \ No newline at end of file From dc80db05c7c163236de9c0da7c688d233a03a464 Mon Sep 17 00:00:00 2001 From: GManon Date: Tue, 29 Nov 2022 01:14:31 -0300 Subject: [PATCH 2/5] Adds back mod button to android --- game/screens.rpy | 1 + 1 file changed, 1 insertion(+) diff --git a/game/screens.rpy b/game/screens.rpy index 326a9bb..d015839 100644 --- a/game/screens.rpy +++ b/game/screens.rpy @@ -1785,6 +1785,7 @@ screen extrasnavigation(): #Updates are removed (not even supported by Ren'Py) [ "Help", ShowMenu("help") ], [ "About", ShowMenu("about") ], [ "Gallery", ShowMenu("cg_gallery_0") ], + [ "Mods", ShowMenu("mod_menu") ], [ "Return", ShowMenu("main_menu") ] ] ) From 18d4688ced65f8bdd7cfb696612b18bb24e2e733 Mon Sep 17 00:00:00 2001 From: GManon Date: Tue, 29 Nov 2022 02:33:26 -0300 Subject: [PATCH 3/5] Solves privacy concern --- game/src/mod_menu.rpy | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/game/src/mod_menu.rpy b/game/src/mod_menu.rpy index 4d5fdc9..e8948f2 100644 --- a/game/src/mod_menu.rpy +++ b/game/src/mod_menu.rpy @@ -56,7 +56,7 @@ screen mod_menu(): ymaximum 0.8 ypos 200 yinitial 0 - if len(mod_menu_access) > 5: # Hides the scrollbar when not needed. Ideally nobody would install mora than one at the same time, but oh well + 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 draggable True @@ -75,7 +75,7 @@ screen mod_menu(): size 45 text_align 0.5 outlines [(3, "#445ABB", absolute(0), absolute(0))] - at center + at truecenter ############################# # Stuff for mods in android # @@ -85,10 +85,7 @@ init python: import os - if renpy.windows: - moddir = renpy.config.gamedir.replace("\\", "/") - - elif renpy.android: + if renpy.android: moddir = os.path.join(os.environ["ANDROID_PUBLIC"], "game") @@ -100,6 +97,6 @@ init python: pass else: - moddir = renpy.config.gamedir + moddir = ".../game" moddir += "/mods/" \ No newline at end of file From c76d6f81522bec301c58156418ba29bd9372ed86 Mon Sep 17 00:00:00 2001 From: GManon Date: Tue, 29 Nov 2022 02:45:40 -0300 Subject: [PATCH 4/5] Marks text as translatable --- game/src/mod_menu.rpy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game/src/mod_menu.rpy b/game/src/mod_menu.rpy index e8948f2..ba667ce 100644 --- a/game/src/mod_menu.rpy +++ b/game/src/mod_menu.rpy @@ -70,7 +70,7 @@ screen mod_menu(): use mod_menu_buttons("gui/button/menubuttons/template_idle.png", mod_menu_access ) else: use mod_menu_button("gui/button/menubuttons/template_idle.png", "Return", ShowMenu("main_menu")) - text "You have no mods! \nInstall some in:\n\"[moddir]\"": + text _("You have no mods! \nInstall some in:\n\"[moddir]\""): style_prefix "navigation" size 45 text_align 0.5 From 9f8982512aa311f4d75a337ebe9fa9b241185452 Mon Sep 17 00:00:00 2001 From: GManon Date: Tue, 29 Nov 2022 02:47:12 -0300 Subject: [PATCH 5/5] More translatable text --- game/src/mod_menu.rpy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game/src/mod_menu.rpy b/game/src/mod_menu.rpy index ba667ce..8035584 100644 --- a/game/src/mod_menu.rpy +++ b/game/src/mod_menu.rpy @@ -65,11 +65,11 @@ screen mod_menu(): if len(mod_menu_access) != 0: vbox: - use mod_menu_button("gui/button/menubuttons/template_idle.png", "Return", ShowMenu("main_menu")) + 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 ) else: - use mod_menu_button("gui/button/menubuttons/template_idle.png", "Return", ShowMenu("main_menu")) + 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