422 lines
13 KiB
Plaintext
422 lines
13 KiB
Plaintext
init offset = -1
|
|
|
|
screen nvl(dialogue, items=None):
|
|
null
|
|
|
|
# init python:
|
|
# import re
|
|
# def text_inner_thought(string, pattern=re.compile(r"\(([^)]+)\)")):
|
|
# return re.findall(pattern, string)
|
|
|
|
# default _next_say_who = None
|
|
|
|
# init python:
|
|
# def next_who(*args, **kwargs):
|
|
# # Unfortunately does not work because '_last_say_who' is a lie. It points to the currently run statement.
|
|
# if not hasattr(renpy.store, "_next_say_who", ):
|
|
# return
|
|
|
|
# global _next_say_who
|
|
|
|
# scry = renpy.scry().next()
|
|
# _next_say_who = scry.who.__name__ if scry and scry.who else None
|
|
|
|
# config.all_character_callbacks.append(next_who)
|
|
|
|
screen say(who, what, side_doll=None, side_image=None, icon=None):
|
|
style_prefix "say"
|
|
layer "interface"
|
|
zorder 0
|
|
|
|
if not is_game_menu():
|
|
# Allows dialogues to function inside interface elements
|
|
# add "gui_fade_bottom"
|
|
use invisible_button(Return(), keysym="dismiss")
|
|
|
|
if states.settings.interface_hidden:
|
|
use hider
|
|
|
|
window:
|
|
id "textbox"
|
|
style "textbox"
|
|
|
|
# Ren'py will flicker the box on {w} tags,
|
|
# so we use a func.
|
|
at gui_say_show_hide(what)
|
|
|
|
# Ren'py hard crashes without textbox windows,
|
|
# this is the workaround that just works.
|
|
if states.settings.interface_hidden:
|
|
yoffset 1000
|
|
|
|
if who:
|
|
|
|
window:
|
|
id "namebox"
|
|
style "namebox"
|
|
text who id "who" style "who"
|
|
|
|
text what id "what" style "what"
|
|
|
|
use quickbox
|
|
|
|
# Note: Weird quirk. As per documentation;
|
|
# Keyword arguments passed to the say character
|
|
# beginning with ``show_`` have the prefix
|
|
# stripped off, and are passed to the screen as arguments. For
|
|
# example, the value of ``show_myflag`` will become the value of
|
|
# the ``myflag`` variable in the screen. (The ``myflag`` variable isn't
|
|
# used by default, but can be used by a custom say screen.)
|
|
|
|
if side_doll:
|
|
add side_doll
|
|
elif side_image: # Compat
|
|
add side_image zoom 0.5 align (0.0, 1.0) xoffset 16
|
|
else:
|
|
add SideImage()
|
|
|
|
screen say_centered(who, what, icon=None):
|
|
style_prefix "say"
|
|
layer "interface"
|
|
zorder 0
|
|
|
|
window:
|
|
id "textbox"
|
|
xfill True
|
|
yfill True
|
|
|
|
text what id "what" style "what_centered"
|
|
|
|
screen hider():
|
|
if states.settings.interface_hidden:
|
|
button action ToggleVariable("states.settings.interface_hidden", True, False) style "empty"
|
|
|
|
window:
|
|
id "hider"
|
|
style "hider"
|
|
style_prefix "hider"
|
|
textbutton "" action ToggleVariable("states.settings.interface_hidden", True, False) tooltip _("Unhide Interface")
|
|
|
|
default states.settings.quickbox_expanded = True
|
|
default states.settings.interface_hidden = False
|
|
default states.settings.interface_alpha = 0.5
|
|
|
|
screen quickbox():
|
|
window:
|
|
id "quickbox"
|
|
style "quickbox"
|
|
style_prefix "quickbox"
|
|
|
|
hbox:
|
|
xalign 1.0
|
|
if states.settings.quickbox_expanded:
|
|
textbutton "" action ToggleVariable("states.settings.interface_hidden", True, False) tooltip _("Hide Interface") keysym "hide_windows" # Hide Interface (\F0209)
|
|
textbutton "" action QuickSave() tooltip _("Quick Save") sensitive is_game_menu() # File Save (\F01DA)
|
|
textbutton "" action QuickLoad() tooltip _("Quick Load") sensitive is_game_menu() # File Load (\F0552)
|
|
textbutton "" action Preference("auto-forward", "toggle") tooltip _("Auto-Forward Dialogue") # Autoplay (\F18F2)
|
|
textbutton "" action ShowMenu("navigation") tooltip _("Game Options") sensitive is_game_menu() # Settings (\F0493)
|
|
textbutton "" action ToggleVariable("states.settings.quickbox_expanded", True, False) tooltip _("Toggle Quick Action Box") # Menu (\F0BAB)
|
|
|
|
style quickbox_button
|
|
style quickbox_button_text:
|
|
font gui.glyph_font
|
|
color "#bbbbbb"
|
|
insensitive_color "#505050"
|
|
hover_color "#ffffff"
|
|
selected_color "#EA8E61"
|
|
selected_hover_color "#ffffff"
|
|
outlines [(2, "#000000", 1, 1)]
|
|
size 24
|
|
|
|
style textbox:
|
|
ysize 125
|
|
align (0.5, 1.0)
|
|
background Transform(Image("gui/creamy_pumpkin_pie/textbox.png", xalign=0.5, yalign=1.0, oversample=4), alpha=0.5)
|
|
|
|
style what:
|
|
xpos 0.5
|
|
ypos 10
|
|
xsize 500
|
|
xoffset -240
|
|
color "#fff"
|
|
outlines [(2, "#000000", 1, 1)]
|
|
hinting "bytecode"
|
|
size 24
|
|
justify True
|
|
|
|
style what_centered:
|
|
align (0.5, 0.5)
|
|
text_align 0.5
|
|
color "#fff"
|
|
outlines [(2, "#000000", 1, 1)]
|
|
hinting "bytecode"
|
|
size 48
|
|
|
|
style what_centered_small:
|
|
align (0.5, 0.5)
|
|
text_align 0.5
|
|
color "#fff"
|
|
outlines [(2, "#000000", 1, 1)]
|
|
hinting "bytecode"
|
|
size 24
|
|
|
|
style namebox:
|
|
ysize 22 # Halved due to oversampling
|
|
padding (32, 0, 32, 0)
|
|
fit_first True
|
|
xpos 0.5
|
|
yalign 1.0
|
|
xanchor 0.0
|
|
offset (-320, -125)
|
|
background Transform(Frame(Image("gui/creamy_pumpkin_pie/namebox.png", oversample=4), 32, 0, 32, 0, tile=True), alpha=0.5)
|
|
|
|
style who:
|
|
color "#EA8E61"
|
|
outlines [(2, "#000000", 1, 1)]
|
|
hinting "auto"
|
|
font gui.bold_font
|
|
size 32
|
|
|
|
style quickbox is namebox:
|
|
padding (32, 0, 32, 0)
|
|
xanchor 1.0
|
|
xoffset 320
|
|
|
|
style hider is namebox:
|
|
align (0.5, 1.0)
|
|
offset (0, 0)
|
|
padding (50, 0, 50, 0)
|
|
|
|
style hider_button is quickbox_button
|
|
style hider_button_text is quickbox_button_text
|
|
|
|
screen choice(items):
|
|
style_prefix "choice"
|
|
layer "interface"
|
|
zorder 1
|
|
variant "pc"
|
|
|
|
default has_icons = any(x is not None for x in [e.kwargs.get("icon", None) for e in items])
|
|
default columns = math.ceil(len(items) / 12)
|
|
|
|
key "K_h" action ToggleVariable("states.settings.interface_hidden", True, False)
|
|
|
|
if states.settings.interface_hidden:
|
|
use hider
|
|
|
|
hbox:
|
|
if states.settings.interface_hidden:
|
|
yoffset 1000
|
|
|
|
at gui_choice_show_hide
|
|
for column in range(columns):
|
|
vbox:
|
|
$ start_index = column * 12
|
|
$ end_index = start_index + 12
|
|
|
|
for i, entry in enumerate(items[start_index:end_index], 1):
|
|
$ scale = (1.0 * (28 / max(28, len(entry.caption))))
|
|
$ icon = entry.kwargs.get("icon", None)
|
|
$ progress = entry.kwargs.get("progress", None)
|
|
$ btn_style = entry.kwargs.get("style", None)
|
|
$ is_disabled = btn_style == "disabled"
|
|
|
|
button:
|
|
action entry.action
|
|
|
|
if is_disabled:
|
|
style "choice_button_disabled"
|
|
|
|
# Handle columns
|
|
if columns > 1:
|
|
xmaximum (config.screen_width // columns)
|
|
|
|
if i < 10 and entry.action:
|
|
keysym ("K_"+str(i), "K_KP"+str(i))
|
|
|
|
text "[i+start_index]" style "choice_number":
|
|
at gui_perspective
|
|
|
|
hbox:
|
|
null width 16
|
|
if is_disabled:
|
|
at gui_perspective, gui_perspective_disabled_hover
|
|
else:
|
|
at gui_perspective, gui_perspective_hover
|
|
|
|
if has_icons:
|
|
if icon:
|
|
add icon xysize (32, 32) xcenter 12 yalign 1.0 yoffset -4
|
|
else:
|
|
null width 32
|
|
|
|
text entry.caption:
|
|
size 32 * scale
|
|
if is_disabled:
|
|
style "choice_disabled_text"
|
|
|
|
if progress:
|
|
bar value StaticValue(progress[0], progress[1]) offset (-16, 22)
|
|
|
|
if progress[0] == progress[1]:
|
|
text _("{wave}{size=20}Done!{/size}{/wave}") style "choice_progress" at transform:
|
|
rotate 12.5
|
|
gui_hover
|
|
|
|
|
|
transform gui_perspective:
|
|
perspective True
|
|
matrixanchor (0.5, 0.0)
|
|
matrixtransform RotateMatrix(45.0, -12.5, 0.0)
|
|
|
|
transform gui_perspective_hover:
|
|
perspective True
|
|
on hover:
|
|
easein 0.1 matrixtransform ScaleMatrix(1.05, 1.05, 1.05)
|
|
easeout 0.1 matrixtransform ScaleMatrix(1.0, 1.0, 1.0)
|
|
|
|
transform gui_perspective_disabled_hover:
|
|
perspective True
|
|
on hover:
|
|
easein 0.1 matrixtransform OffsetMatrix(5, 0, 0)
|
|
easein 0.1 matrixtransform OffsetMatrix(-5, 0, 0)
|
|
easeout 0.1 matrixtransform OffsetMatrix(0, 0, 0)
|
|
|
|
transform gui_hover:
|
|
subpixel True
|
|
zoom 1.0
|
|
xzoom 1.0
|
|
anchor (0.5, 0.5)
|
|
on hover:
|
|
easein 0.1 zoom 1.05 xzoom 1.1
|
|
easeout 0.1 zoom 1.0 xzoom 1.0
|
|
|
|
transform gui_say_show_hide(what):
|
|
show_cancels_hide True
|
|
on show:
|
|
alpha 0
|
|
zoom 1.05
|
|
pause 0.1
|
|
easein 0.1 zoom 1.00 alpha 1
|
|
on replace:
|
|
alpha 1.0
|
|
zoom 1.0
|
|
on hide:
|
|
# easeout 0.1 zoom 0.95 alpha 0
|
|
function renpy.partial(gui_say_hide, what)
|
|
|
|
init python:
|
|
def gui_say_hide(what, trans, st, at):
|
|
if st > 0.1:
|
|
return None
|
|
|
|
if any(x in what for x in ("{w}", "{w=", "{nw}", "{p}", "{p=")):
|
|
return None
|
|
|
|
warper = _warper.easein(st / 0.1)
|
|
trans.alpha = renpy.atl.interpolate(warper, 1.0, 0.0, renpy.atl.PROPERTIES["alpha"])
|
|
trans.zoom = renpy.atl.interpolate(warper, 1.0, 0.95, renpy.atl.PROPERTIES["zoom"])
|
|
return 0.01
|
|
|
|
transform gui_choice_show_hide:
|
|
show_cancels_hide True
|
|
on start:
|
|
events False
|
|
xoffset -100
|
|
alpha 0
|
|
pause 0.1
|
|
easein 0.1 alpha 1 xoffset 0
|
|
events True
|
|
on hide:
|
|
easeout 0.2 alpha 0 xoffset 100
|
|
|
|
style choice_vbox is vbox
|
|
style choice_button is button
|
|
style choice_button_text is button_text
|
|
|
|
style choice_vbox:
|
|
align (0.5, 1.0)
|
|
spacing 10
|
|
|
|
style choice_hbox:
|
|
xalign 0.5
|
|
yanchor 1.0
|
|
ypos 0.75
|
|
spacing 2
|
|
|
|
style choice_button:
|
|
ysize 24
|
|
xmaximum 0.6
|
|
xalign 0.5
|
|
padding (48, 0, 24, 0)
|
|
background Transform(Frame(Image("gui/creamy_pumpkin_pie/choice.png", oversample=4), 24, 0, 24, 0, tile=True, xmaximum=0.9, xalign=0.5), matrixcolor=SaturationMatrix(0.0))
|
|
hover_background Fixed(
|
|
Frame(Image("gui/creamy_pumpkin_pie/choice_arrow.png", oversample=4), 48, 0, 96, 0, tile=True, xoffset=8),
|
|
Frame(Image("gui/creamy_pumpkin_pie/choice.png", oversample=4), 24, 0, 24, 0, tile=True, xmaximum=0.9, xalign=0.5)
|
|
)
|
|
|
|
style choice_button_disabled is choice_button:
|
|
background Fixed(
|
|
Transform(Frame(Image("gui/creamy_pumpkin_pie/choice.png", oversample=4), 24, 0, 24, 0, tile=True, xmaximum=0.9, xalign=0.5), matrixcolor=SaturationMatrix(0.0)),
|
|
Frame(Image("gui/creamy_pumpkin_pie/choice_disabled.png", oversample=4), 0, 0, 0, 0, tile=True),
|
|
)
|
|
hover_background Fixed(
|
|
Frame(Image("gui/creamy_pumpkin_pie/choice_arrow.png", oversample=4), 48, 0, 96, 0, tile=True, xoffset=8),
|
|
Fixed(
|
|
Transform(Frame(Image("gui/creamy_pumpkin_pie/choice.png", oversample=4), 24, 0, 24, 0, tile=True, xmaximum=0.9, xalign=0.5), matrixcolor=SaturationMatrix(0.0)),
|
|
Frame(Image("gui/creamy_pumpkin_pie/choice_disabled.png", oversample=4), 0, 0, 0, 0, tile=True),
|
|
)
|
|
)
|
|
|
|
style choice_text:
|
|
color "#cccccc"
|
|
hover_color "#ffffff"
|
|
selected_color "#EA8D60"
|
|
outlines [(1, "#000000", 1, 2), (1, "#000000", 0, 1), (1, "#000000", 0, 0)]
|
|
hinting "bytecode"
|
|
size 32
|
|
|
|
style choice_disabled_text is choice_text:
|
|
color "#7e7e7e"
|
|
hover_color "#bebebe"
|
|
|
|
style choice_number is choice_text:
|
|
offset (0, 5)
|
|
size 16
|
|
|
|
style choice_bar is empty:
|
|
ysize 10
|
|
left_bar Transform(Frame(Image("gui/creamy_pumpkin_pie/choice_bar_full.png", oversample=4), 24, 0, 24, 0, tile=True), matrixcolor=SaturationMatrix(0.5))
|
|
hover_left_bar Frame(Image("gui/creamy_pumpkin_pie/choice_bar_full.png", oversample=4), 24, 0, 24, 0, tile=True)
|
|
right_bar Frame(Image("gui/creamy_pumpkin_pie/choice_bar_empty.png", oversample=4), 24, 0, 24, 0, tile=True)
|
|
|
|
style choice_progress:
|
|
pos (520, 15)
|
|
|
|
# Input screen
|
|
#
|
|
# This screen is used to display renpy.input. The prompt parameter is used to
|
|
# pass a text prompt in.
|
|
#
|
|
# This screen must create an input displayable with id "input" to accept the
|
|
# various input parameters.
|
|
#
|
|
# https://www.renpy.org/doc/html/screen_special.html#input
|
|
|
|
screen input(prompt):
|
|
zorder 30
|
|
|
|
style_prefix "say"
|
|
window:
|
|
id "window"
|
|
style gui.theme("say_window")
|
|
|
|
if prompt:
|
|
window:
|
|
style gui.theme("namebox")
|
|
text prompt:
|
|
style gui.theme("say_label")
|
|
|
|
input id "input":
|
|
style gui.theme("say_dialogue")
|