Translation additonal and bonus flash fix

This commit is contained in:
Nutbuster 2022-10-29 16:45:15 +11:00
parent dda914a2c5
commit 05269f6770
4 changed files with 81 additions and 39 deletions

View File

@ -461,6 +461,7 @@ screen bonus_chapter_button(f="gui/button/menubuttons/template_idle.png"):
button:
xmaximum 500
ymaximum 129
xysize (500, 129)
action ShowMenu("ex_ch_menu")
activate_sound "audio/ui/uiClick.wav"
fixed:
@ -503,10 +504,14 @@ screen main_menu():
fixed:
xalign 0.125
yalign 0.5
xsize 1920/2
ysize 1080/4
add Solid(gui.accent_color)
xsize int(1920/2)
ysize int(1080/4)
at bonus_notif
fixed:
add Solid("#000")
add Solid(gui.accent_color) xysize ( int(1920/2)-20, int(1080/4)-12 ):
xalign 0.5
yalign 0.5
if persistent.endings == 0b1111:
text "You have unlocked all bonus chapters!" style "main_menu_text" yalign 0.5
else:
@ -994,6 +999,8 @@ screen preferences():
label _("Naughty Stuff")
textbutton _("Enable Lewd Images") action [Function(onclick_audio, persistent.lewd), ToggleVariable("persistent.lewd", True, False)]
use translator_roulette
vbox:
style_prefix "check"
label _("Requires Restart")
@ -1267,7 +1274,7 @@ screen extrasnavigation():
[ "About", ShowMenu("about") ],
[ "Updates", ShowMenu("updates") ],
[ "Gallery", ShowMenu("cg_gallery_0") ],
[ "Mods", ShowMenu("circleBar") ],
[ "Mods", ShowMenu("mod_menu") ],
[ "Return", ShowMenu("main_menu") ]
] )

View File

@ -1,7 +1,6 @@
init python:
import threading
# CONST PARAMS
ALLOW_ZOOM = False
@ -86,7 +85,7 @@ init python:
# Call to loading the gallery
loadGallery()
renpy.start_predict_screen("cg_gallery")
#renpy.start_predict_screen("cg_gallery")
#sort
@ -136,6 +135,7 @@ init python:
global CaveGallery
if (renpy.map_event(ev, 'mouseup_1')): #1026
pass
return
def visit(self):
return self.childs

View File

@ -4,7 +4,7 @@ label splashscreen:
$ renpy.movie_cutscene("images/intros/CaveManonProductions.webm")
python:
import pygame
#import pygame
CACHE_PATH = config.basedir.replace("\\","/") + "/game/cache/"
@ -19,7 +19,7 @@ label splashscreen:
pass
else:
data = src_image.load() #Returns a pygame surface
pygame.image.save(data, final) #Saves the image to file
#pygame.image.save(data, final) #Saves the image to file
#print('O', final)
#save_thumb(NOT_UNLOCKED_COVER,"default","jpg")
@ -61,7 +61,8 @@ label splashscreen:
stop sound
if (persistent.languaged_up == 10000):
if (persistent.languaged_up is None):
$ persistent.languaged_up = True
call screen translator_popup

View File

@ -1,15 +1,22 @@
init offset = -1
"""
In absolute hindsight, this could have been done very similar to bonus flash image
instead of the dynamic displayable stuff
"""
init python:
list_langs_buttons = [
['gui/flag/USofA.png', 'English', Language(None)],
['gui/flag/spain.png', 'Español', Language('test')]
{'image': 'gui/flag/USofA.png', 'name': 'English', 'value': None },
{'image': 'gui/flag/spain.png', 'name': 'Español', 'value': 'test'}
]
class LangCave: #todo: think of a better name
FPS = 1/60 #todo: fetch the actual target render framerate
GRID_ROWS_COLS_TUPLE = (2, 1)
#GRID_ROWS_COLS_TUPLE = (4, (len(list_langs_buttons)//4))
MAX_ITEMS_IN_ROW = 4 #column as well
GRID_ROWS_COLS_TUPLE = (MAX_ITEMS_IN_ROW,
len(list_langs_buttons)//MAX_ITEMS_IN_ROW + 1*((len(list_langs_buttons)%MAX_ITEMS_IN_ROW)>0))
lang_buttons = []
final_displayable = None
@ -17,9 +24,9 @@ init python:
on_disable_interactable = False
LARGE_SIZE = (320, 240)
LARGE_SPACING = 80
SMALL_SIZE = (LARGE_SIZE[0]/2, LARGE_SIZE[1]/2)
SMALL_SPACING = LARGE_SPACING/2
LARGE_SPACING = (80, 40)
SMALL_SIZE = (LARGE_SIZE[0]//3, LARGE_SIZE[1]//3)
SMALL_SPACING = (LARGE_SPACING[0]//2, LARGE_SPACING[1]//2)
class LangButton(renpy.Displayable):
def __init__(self, v, w, h, *childs, **kwargs):
@ -34,16 +41,19 @@ init python:
self.width = w
self.height = h
self.value = v
self.hover = True #not/! breaks everything in renpy
self.hover = True #renpy can't handle not/!
self.selected = False
def render(self, width, height, st, at):
root_render = renpy.Render(self.width, self.height) #overall size i think
root_render = renpy.Render(self.width, self.height) #canvas
args = {}
if (self.hover):
args = {'matrixcolor': TintMatrix("#AAA")}
if (LangCave.on_disable_interactable == False and self.selected):
args = {}
for ch in self.childs: #draw every child
t = Transform(child=ch, **args)
child_render = renpy.render(t, self.width, self.height, st, at)
@ -58,13 +68,19 @@ init python:
if ((ex > 0 and ey > 0) and (ex < self.width and ey < self.height)):
self.hover = False
if (renpy.map_event(ev, 'mouseup_1')): #1026
for lb in LangCave.lang_buttons:
lb.selected = False
self.selected = True
onclick_audio(True)
self.value() #todo: change to function, as value doesn't make sense
if LangCave.on_disable_interactable:
renpy.end_interaction(0)
LangCave.on_disable_interactable = False
recreate_lang_buttons_roulette_style(SMALL_SIZE) #mostly going to happen
LangCave.recreate_lang_buttons_roulette_style(LangCave.SMALL_SIZE) #mostly going to happen
renpy.end_interaction(0)
for lb in LangCave.lang_buttons:
renpy.redraw(lb, 0)
else:
self.hover = True
pass
@ -96,39 +112,56 @@ init python:
LangCave.lang_buttons.clear()
for llb in list_langs_buttons:
tfi = Transform(Image(llb[0]), xysize=size, fit='contain', yalign=0.5)
solid = Solid((22,22,22), xysize=size)
_button = Fixed(solid, tfi, xysize=size)
button = LangCave.LangButton(llb[2], *size, _button)
tfi = Transform(Image(llb['image']), xysize=size, fit='contain', yalign=0.5)
#solid = Solid((22,22,22), xysize=size)
# = Solid((22,22,22), xysize=size)
_button = Fixed(tfi, xysize=size)
lang = Language(llb['value'])
button = LangCave.LangButton(lang, *size, _button)
LangCave.on_disable_interactable = True
text = Text(llb[1], outlines=[(2, "#000", 0, 0)], xalign=0.5)
text = Text(llb['name'], outlines=[(2, "#000", 0, 0)], xalign=0.5)
final = VBox(text, button, style_prefix="navigation")
#LangCave.lang_buttons.append(LangCave.LangButton(llb[2], *size, tfi))
LangCave.lang_buttons.append(final)
LangCave.final_displayable = Grid(*LangCave.GRID_ROWS_COLS_TUPLE, *LangCave.lang_buttons, spacing=spacing)
#prevent underfill
remainder = len(list_langs_buttons)%LangCave.MAX_ITEMS_IN_ROW
for x in range(4-remainder):
n = Null(*size)
LangCave.lang_buttons.append(n)
LangCave.final_displayable = Grid(*LangCave.GRID_ROWS_COLS_TUPLE, *LangCave.lang_buttons,
xspacing=spacing[0], yspacing=spacing[1])
pass
@staticmethod
def recreate_lang_buttons_roulette_style(size, spacing):
def recreate_lang_buttons_roulette_style(size, spacing=0):
global LangCave
LangCave.lang_buttons.clear()
LangCave.on_disable_interactable = False
for llb in list_langs_buttons:
tfi = Transform(Image(llb[0]), xsize=size[0], ysize=size[1], fit='contain', yalign=0.5)
solid = Solid((22,22,22), xysize=(size))
_button = Fixed(solid, tfi, xysize=(size))
text = Text(llb[1], outlines=[(2, "#000", 0, 0)], xalign=0.5)
penultimate = HBox(text, _button, style_prefix="navigation")
tfi = Transform(Image(llb['image']), xsize=size[0], ysize=size[1], fit='contain', yalign=0.5)
#solid = Solid((22,22,22), xysize=(size))
_button = Fixed(tfi, xysize=(size))
button = LangCave.LangButton(llb[2], *size, _button)
text = Text(llb['name'], outlines=[(2, "#000", 0, 0)], xalign=0.5, text_size=16, yalign=0.5) #todo: text_size away
penultimate = HBox(text, _button, style_prefix="navigation", spacing=20)
#print(dir(penultimate))
lang = Language(llb['value'])
button = LangCave.LangButton(lang, *size, penultimate)
if (_preferences.language == llb['value']):
button.selected = True
#final = VBox(text, button, style_prefix="navigation")
#LangCave.lang_buttons.append(LangCave.LangButton(llb[2], *size, tfi))
LangCave.lang_buttons.append(button)
LangCave.final_displayable = Vbox(*LangCave.lang_buttons, spacing=spacing)
LangCave.final_displayable = VBox(*LangCave.lang_buttons, spacing=spacing)
pass
@ -178,21 +211,22 @@ screen translator_popup:
frame:
#background gui.main_menu_background
background Transform(gui.main_menu_background, matrixcolor=TintMatrix('#555'))
background Transform(gui.main_menu_background, matrixcolor=TintMatrix('#222'))
padding (120, 40)
vbox:
style_prefix "navigation"
hbox:
label _("Choose Your Language")
label _("Choose Your Language") text_size 80
hbox:
add Null(80, 40)
add DynamicDisplayable(LangCave.render_langcave)
screen translator_roulette:
label _("Language")
vbox:
label _("Language")
style_prefix "check"
add DynamicDisplayable(LangCave.render_langcave)