SnootGame/game/src/mod_menu.rpy

102 lines
3.0 KiB
Plaintext
Raw Permalink Normal View History

2021-08-07 09:51:40 +00:00
# Mod Menu screen ############################################################
##
## Handles jumping to the mods scripts
## Could be more lean but if this is going to one of last time I touch the UI,
## then fine by me
##
#similar to quick_button funcs
screen mod_menu_button(filename, label, function):
button:
xmaximum 600
ymaximum 129
action function
2021-08-07 14:42:16 +00:00
if 'Back' in label or 'Return' in label or 'Quit' in label or 'Main Menu' in label:
activate_sound "audio/ui/uiBack.wav"
else:
activate_sound "audio/ui/uiClick.wav"
2021-08-07 09:51:40 +00:00
fixed:
add filename xalign 0.5 yalign 0.5 zoom 0.9
text label xalign 0.5 yalign 0.5 xanchor 0.5 size 34
# arr is [{
# 'Name': string (name that appears on the button)
# 'Label': string (jump label)
# }, { .. } ]
# Reuse the same image string and keep things 'neat'.
screen mod_menu_buttons(filename, arr):
for x in arr:
2021-09-22 22:39:56 +00:00
use mod_menu_button(filename, x['Name'], Start(x['Label']) )
2021-08-07 09:51:40 +00:00
screen mod_menu():
tag menu
style_prefix "main_menu"
add gui.main_menu_background
frame:
xsize 420
yfill True
background "gui/overlay/main_menu.png"
#side_yfill True
vbox:
xpos 1940
yalign 0.03
if persistent.splashtype == 1:
add "gui/sneedgame.png"
else:
add "gui/snootgame.png"
viewport:
# this could be better but its ok for now
xpos 1885-540
xmaximum 540
ymaximum 0.8
ypos 200
yinitial 0
2022-11-29 05:33:26 +00:00
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"
2021-08-07 09:51:40 +00:00
mousewheel True
draggable True
pagekeys True
if len(mod_menu_access) != 0:
vbox:
2022-11-29 05:47:12 +00:00
use mod_menu_button("gui/button/menubuttons/template_idle.png", _("Return"), ShowMenu("main_menu"))
spacing 18
2021-10-11 19:31:39 +00:00
use mod_menu_buttons("gui/button/menubuttons/template_idle.png", mod_menu_access )
else:
2022-11-29 05:47:12 +00:00
use mod_menu_button("gui/button/menubuttons/template_idle.png", _("Return"), ShowMenu("main_menu"))
2022-11-29 05:45:40 +00:00
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))]
2022-11-29 05:33:26 +00:00
at truecenter
#############################
# Stuff for mods in android #
#############################
init python:
import os
if renpy.android and not config.developer:
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:
2022-11-29 05:33:26 +00:00
moddir = ".../game"
moddir += "/mods/"