WTS/game/scripts/gui/say.rpy

383 lines
12 KiB
Plaintext
Raw Normal View History

2022-05-16 23:48:22 +00:00
init offset = -1
screen nvl(dialogue, items=None):
null
2024-05-14 20:54:03 +00:00
# init python:
# import re
# def text_inner_thought(string, pattern=re.compile(r"\(([^)]+)\)")):
# return re.findall(pattern, string)
2022-05-16 23:48:22 +00:00
screen say(who, what, side_image=None, icon=None):
2024-05-14 20:54:03 +00:00
style_prefix "say"
layer "interface"
zorder 0
2024-04-23 18:25:17 +00:00
2024-05-14 20:54:03 +00:00
if states.settings.interface_hidden:
use hider
2024-05-14 20:54:03 +00:00
window:
id "textbox"
style "textbox"
2024-05-21 00:58:08 +00:00
at gui_show_hide
2024-05-19 20:00:48 +00:00
2024-05-14 20:54:03 +00:00
# Ren'py hard crashes without textbox windows,
# this is the workaround that just works.
if states.settings.interface_hidden:
yoffset 1000
2024-04-23 18:25:17 +00:00
if who:
2024-05-14 20:54:03 +00:00
2024-04-23 18:25:17 +00:00
window:
id "namebox"
style "namebox"
2024-05-14 20:54:03 +00:00
text who id "who" style "who"
2022-05-16 23:48:22 +00:00
2024-05-14 20:54:03 +00:00
text what id "what" style "what"
2022-05-16 23:48:22 +00:00
2024-05-14 20:54:03 +00:00
use quickbox
2022-05-16 23:48:22 +00:00
2024-05-14 20:54:03 +00:00
add SideImage()
2022-05-16 23:48:22 +00:00
2024-05-14 20:54:03 +00:00
screen hider():
variant "pc"
if states.settings.interface_hidden:
button action ToggleVariable("states.settings.interface_hidden", True, False) style "empty"
2022-05-16 23:48:22 +00:00
2024-05-14 20:54:03 +00:00
window:
id "hider"
style "hider"
style_prefix "hider"
textbutton "󰈈" action ToggleVariable("states.settings.interface_hidden", True, False) tooltip _("Unhide Interface")
2022-05-16 23:48:22 +00:00
2024-05-14 20:54:03 +00:00
default states.settings.quickbox_expanded = True
default states.settings.interface_hidden = False
default states.settings.interface_alpha = 0.5
2022-05-16 23:48:22 +00:00
2024-05-14 20:54:03 +00:00
screen quickbox():
variant "pc"
2022-05-16 23:48:22 +00:00
2024-05-14 20:54:03 +00:00
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") # Hide Interface (\F0209)
textbutton "󰇚" action QuickSave() tooltip _("Quick Save") # File Save (\F01DA)
textbutton "󰕒" action QuickLoad() tooltip _("Quick Load") # File Load (\F0552)
textbutton "󰁪" action Preference("auto-forward", "toggle") tooltip _("Auto-Forward Dialogue") # Autoplay (\F18F2)
textbutton "󰒓" action ShowMenu("preferences") tooltip _("Game Options") # 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"
hover_color "#ffffff"
selected_color "#EA8E61"
2024-05-21 00:58:08 +00:00
outlines [(2, "#000000", 1, 1)]
size 24
2024-05-14 20:54:03 +00:00
style textbox:
2024-05-21 00:58:08 +00:00
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)
2024-05-14 20:54:03 +00:00
style what:
2024-05-19 20:00:48 +00:00
xpos 0.5
2024-05-21 00:58:08 +00:00
ypos 10
xsize 500
xoffset -240
2024-05-14 20:54:03 +00:00
color "#fff"
2024-05-21 00:58:08 +00:00
outlines [(2, "#000000", 1, 1)]
2024-05-14 20:54:03 +00:00
hinting "bytecode"
2024-05-21 00:58:08 +00:00
size 24
2024-05-14 20:54:03 +00:00
justify True
style namebox:
2024-05-21 00:58:08 +00:00
ysize 22 # Halved due to oversampling
padding (32, 0, 32, 0)
2024-05-14 20:54:03 +00:00
fit_first True
xpos 0.5
yalign 1.0
xanchor 0.0
2024-05-21 00:58:08 +00:00
offset (-320, -125)
background Transform(Frame(Image("gui/creamy_pumpkin_pie/namebox.png", oversample=4), 32, 0, 32, 0, tile=True), alpha=0.5)
2024-05-14 20:54:03 +00:00
style who:
color "#EA8E61"
2024-05-21 00:58:08 +00:00
outlines [(2, "#000000", 1, 1)]
2024-05-14 20:54:03 +00:00
hinting "auto"
font gui.bold_font
2024-05-21 00:58:08 +00:00
size 32
2024-05-14 20:54:03 +00:00
style quickbox is namebox:
2024-05-21 00:58:08 +00:00
padding (32, 0, 32, 0)
2024-05-14 20:54:03 +00:00
xanchor 1.0
2024-05-21 00:58:08 +00:00
xoffset 320
2024-05-14 20:54:03 +00:00
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
2024-05-20 23:08:41 +00:00
screen choice(items):
style_prefix "choice"
2024-05-15 22:02:05 +00:00
layer "interface"
2024-05-20 23:08:41 +00:00
zorder 1
variant "pc"
2022-05-16 23:48:22 +00:00
2024-05-20 23:08:41 +00:00
# default max_progress = max(len(e.kwargs.get("progress", [])) for e in items)
default has_icons = any(x is not None for x in [e.kwargs.get("icon", None) for e in items])
# add Image("gui/creamy_pumpkin_pie/fade_top.png", oversample=2) alpha 0.5
2022-05-16 23:48:22 +00:00
2024-05-20 23:08:41 +00:00
vbox:
2024-05-21 01:27:21 +00:00
at gui_choice_show_hide
2024-05-20 23:08:41 +00:00
for i, entry in enumerate(items, 1):
$ scale = (1.0 * (32 / max(32, len(entry.caption))))
$ icon = entry.kwargs.get("icon", None)
$ progress = entry.kwargs.get("progress", None)
2022-05-16 23:48:22 +00:00
2024-05-20 23:08:41 +00:00
vbox:
spacing 2
2022-05-16 23:48:22 +00:00
button:
action entry.action
if i < 10 and entry.action:
2023-07-05 21:35:28 +00:00
keysym ("K_"+str(i), "K_KP"+str(i))
2022-05-16 23:48:22 +00:00
2024-05-20 23:08:41 +00:00
text "[i]" style "choice_number":
at gui_perspective
hbox:
null width 16
at gui_perspective, gui_perspective_hover
# if progress:
# for j in range(max_progress):
# if j < len(progress):
# add progress[j] xysize (32, 32)
# else:
# null width 32
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 progress:
bar value StaticValue(progress[0], progress[1]) offset (-16, 22)
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)
2024-05-21 01:07:48 +00:00
transform gui_show_hide:
2024-05-21 01:10:28 +00:00
show_cancels_hide False
2024-05-21 00:58:08 +00:00
on start:
alpha 0
zoom 1.05
2024-05-21 01:07:48 +00:00
pause 0.1
2024-05-21 00:58:08 +00:00
easein 0.1 zoom 1.00 alpha 1
on hide:
easeout 0.1 zoom 0.95 alpha 0
2024-05-21 01:27:21 +00:00
transform gui_choice_show_hide:
show_cancels_hide False
on start:
2024-05-21 01:28:55 +00:00
events False
2024-05-21 01:27:21 +00:00
xoffset -100
alpha 0
pause 0.1
easein 0.1 alpha 1 xoffset 0
2024-05-21 01:28:55 +00:00
events True
2024-05-21 01:27:21 +00:00
on hide:
easeout 0.2 alpha 0 xoffset 100
2024-05-20 23:08:41 +00:00
style choice_vbox is vbox
style choice_button is button
style choice_button_text is button_text
style choice_vbox:
xalign 0.5
yanchor 1.0
ypos 0.75
spacing 10
style choice_hbox:
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_text:
color "#dddddd"
hover_color "#ffffff"
outlines [(1, "#000000", 1, 2), (1, "#000000", 0, 1), (1, "#000000", 0, 0)]
hinting "bytecode"
size 32
2022-05-16 23:48:22 +00:00
2024-05-20 23:08:41 +00:00
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)
# define blacklist_screens = {"say", "letter", "bld1"}
# define choice_width = int(config.screen_width/2)
# screen choice(items, menu_yalign=.6):
# tag menu
# zorder 0
# layer "interface"
# style_prefix gui.theme("menu")
# default blacklist_tags = set(get_character_tag(x) for x in states.dolls)
# # Dont add the fade if character or saybox is present (They have their own triggers for fading)
# if not any(renpy.get_screen(x) for x in blacklist_screens) and not any(renpy.showing(x, layer="screens") for x in blacklist_tags):
# add "interface/bld.webp" at fade_hide(0.15)
# window at fade_show_hide(0.15):
# style "empty"
# xalign .5
# yalign menu_yalign
# vbox:
# spacing 0
# default max_progress = max(len(e.kwargs.get("progress", [])) for e in items)
# for i, entry in enumerate(items, 1):
# $ style_part = entry.kwargs.get("style", None)
# button:
# xsize choice_width
# ypadding 5
# action entry.action
# sensitive bool(entry.action)
# if i < 10 and entry.action:
# keysym ("K_"+str(i), "K_KP"+str(i))
# fixed:
# style "empty"
# if style_part:
# style_prefix gui.theme(f"{style_part}_menu")
# fit_first "height"
# text entry.caption:
# xsize choice_width-120 # Leave enough margin for number and icon
# align (0.5, 0.5)
# if i < 10 and entry.action:
# text "{size=-2}[i].{/size}" xpos 5 yalign 0.5
# $ icon = entry.kwargs.get("icon", None)
# if icon:
# add icon xcenter 40 yalign 0.5
# $ progress = entry.kwargs.get("progress", None)
# if progress:
# hbox:
# spacing 2
# xpos choice_width - 5
# xanchor 1.
# yalign .5
# for i in range(max_progress):
# if i < len(progress):
# add progress[i]
# else:
# null width 21 # Assume icon width
# style menu_text is default:
# hover_color "#fff"
# text_align 0.5
# outlines [(1, "#00000080", 1, 0)]
2022-05-16 23:48:22 +00:00
2024-05-20 23:08:41 +00:00
# style dark_menu_text:
# color "#9b8d84"
# insensitive_color "#6c625c"
2022-05-16 23:48:22 +00:00
2024-05-20 23:08:41 +00:00
# style light_menu_text:
# color "#f9d592"
# insensitive_color "#ae9566"
2022-05-16 23:48:22 +00:00
2024-05-20 23:08:41 +00:00
# style dark_disabled_menu_text:
# color "#6c625c"
2022-05-16 23:48:22 +00:00
2024-05-20 23:08:41 +00:00
# style light_disabled_menu_text:
# color "#ae9566"
2022-05-16 23:48:22 +00:00
2024-05-20 23:08:41 +00:00
# style menu_button is default:
# activate_sound "sounds/qubodup-click1.ogg"
# hover_sound "sounds/qubodup-hover1.ogg"
2022-05-16 23:48:22 +00:00
2024-05-20 23:08:41 +00:00
# style dark_menu_button:
# background "#5d5151e6"
# hover_background "#897e75"
# insensitive_background "#9e8449"
2022-05-16 23:48:22 +00:00
2024-05-20 23:08:41 +00:00
# style light_menu_button:
# background "#ac8d5ae6"
# hover_background "#97681f"
# insensitive_background "#d1a02eb3"
2022-05-16 23:48:22 +00:00
# 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":
2024-05-20 23:08:41 +00:00
style gui.theme("say_dialogue")