WTS/game/scripts/gui/say.rpy
LoafyLemon 8d50133b79 New Textbox
* Implemented new textbox
* Implemented nickname handling for the namebox
* Implemented new reworked fonts
* Implemented PC parts of the textbox
* Recalculated sprite positions, offsets and zooms.
2024-05-14 21:54:03 +01:00

328 lines
9.3 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)
screen say(who, what, side_image=None, icon=None):
style_prefix "say"
layer "interface"
zorder 55
if states.settings.interface_hidden:
use hider
window:
id "textbox"
style "textbox"
# 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
add SideImage()
screen hider():
variant "pc"
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():
variant "pc"
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"
outlines [(3, "#000000", 1, 1)]
size 36
style textbox:
ysize 250
yalign 1.0
background Transform(Image("gui/creamy_pumpkin_pie/textbox.png", xalign=0.5, yalign=1.0, oversample=2), alpha=0.5)
style what:
xpos 0.25
ypos 20
xmaximum 1000
color "#fff"
outlines [(3, "#000000", 1, 1)]
hinting "bytecode"
size 32
justify True
style namebox:
ysize 43 # Halved due to oversampling
padding (50, 0, 50, 0)
fit_first True
xpos 0.5
yalign 1.0
xanchor 0.0
offset (-570, -250)
background Transform(Frame("gui/creamy_pumpkin_pie/namebox.png", 48, 0, 48, 0, oversample=2, tile=True), alpha=0.5)
style who:
color "#EA8E61"
outlines [(3, "#000000", 1, 1)]
hinting "auto"
font gui.bold_font
size 42
style quickbox is namebox:
padding (50, 0, 50, 0)
xanchor 1.0
xoffset 570
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 say(who, what, side_image=None, icon=None):
# zorder 31
# if _windows_hidden:
# use invisible_button(action=SetVariable("_windows_hidden", False))
# else:
# if not renpy.get_screen("choice"):
# use invisible_button(action=Function(ui.saybehavior), keysym="dismiss")
# if side_image:
# add side_image yalign 1.0 zoom 0.5
# else:
# add SideImage()
# window id "window":
# style "say_window"
# if who:
# window:
# id "namebox"
# style "namebox"
# text who:
# style "say_label"
# text what:
# id "what"
# style "say_dialogue"
# if _windows_hidden:
# ypos 1000
# if _game_menu_screen:
# use quick_menu
# Quick menu screen
#
# The quick menu is displayed in-game to provide easy access to the out-of-game menus.
# screen quick_menu():
# hbox:
# style_prefix "quick"
# xalign 1.0
# yoffset -30
# textbutton _("Q.Save") action QuickSave()
# textbutton _("Q.Load") action QuickLoad()
# textbutton _("Skip") action Skip()
# textbutton _("Auto") action Preference("auto-forward", "toggle")
# textbutton _("Preferences") action ShowMenu("preferences")
# style quick_button is default:
# activate_sound "sounds/qubodup-click2.ogg"
# hover_sound "sounds/qubodup-hover2.ogg"
# background None
# xpadding 8
# ypadding 8
# style quick_button_text:
# size 10
# idle_color "#8888"
# hover_color "#fff"
# insensitive_color "#4448"
# idle_outlines [(1, "#0008", 1, 1)]
# hover_outlines [(1, "#000", 1, 1)]
# Choice screen
#
# This screen is used to display the in-game choices presented by the menu
# statement. The one parameter, items, is a list of objects, each with caption
# and action fields.
#
# https://www.renpy.org/doc/html/screen_special.html#choice
define blacklist_screens = {"say", "letter", "bld1"}
define choice_width = int(config.screen_width/2)
screen choice(items, menu_yalign=.6):
tag menu
modal True
zorder 30
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)]
style dark_menu_text:
color "#9b8d84"
insensitive_color "#6c625c"
style light_menu_text:
color "#f9d592"
insensitive_color "#ae9566"
style dark_disabled_menu_text:
color "#6c625c"
style light_disabled_menu_text:
color "#ae9566"
style menu_button is default:
activate_sound "sounds/qubodup-click1.ogg"
hover_sound "sounds/qubodup-hover1.ogg"
style dark_menu_button:
background "#5d5151e6"
hover_background "#897e75"
insensitive_background "#9e8449"
style light_menu_button:
background "#ac8d5ae6"
hover_background "#97681f"
insensitive_background "#d1a02eb3"
# 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")