From ee768b18cec53641e767fe895d0f787036af631b Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Tue, 28 May 2024 20:51:41 +0100 Subject: [PATCH] Choice progression * Add completion status info to the choice menu * Add style support for kinetic text tags * Begin modal prompt screen implementation * Cleanup --- game/gui/creamy_pumpkin_pie/choice_alt.png | 3 + game/scripts/gui/frame.rpy | 10 +- game/scripts/gui/say.rpy | 125 +++------------------ game/scripts/utility/text_tags.rpy | 20 ++-- 4 files changed, 38 insertions(+), 120 deletions(-) create mode 100644 game/gui/creamy_pumpkin_pie/choice_alt.png diff --git a/game/gui/creamy_pumpkin_pie/choice_alt.png b/game/gui/creamy_pumpkin_pie/choice_alt.png new file mode 100644 index 00000000..8d102ab3 --- /dev/null +++ b/game/gui/creamy_pumpkin_pie/choice_alt.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09fe21bfc6e6dd6281a879f98cbe7944d36d3a6f9cc677325ae9f594d5090189 +size 5446 diff --git a/game/scripts/gui/frame.rpy b/game/scripts/gui/frame.rpy index 53efbe96..4c010855 100644 --- a/game/scripts/gui/frame.rpy +++ b/game/scripts/gui/frame.rpy @@ -43,7 +43,7 @@ transform gui_modal_popup: on show: zoom 0.0 alpha 0.0 - easein_back 0.5 zoom 1.0 alpha 1.0 + easein_back 0.4 zoom 1.0 alpha 1.0 on hide: easeout_back 0.4 zoom 0.0 alpha 0.0 @@ -55,7 +55,6 @@ style frame is empty: xfill False yfill False padding (50, 10) - # background Frame(Image("gui/creamy_pumpkin_pie/window_bottom.png", oversample=4), 8, 8, 8, 75, tile=False) background Frame(Image("gui/creamy_pumpkin_pie/window_frame.png", oversample=4), 50, 100, 50, 75, tile=False) style frame_vbox: @@ -79,4 +78,9 @@ style frame_text is what: color "#fff" outlines [(1, "#000000", 1, 1)] hinting "bytecode" - size 12 \ No newline at end of file + size 12 + +style frame_button is button: + hover_background Frame(Image("gui/creamy_pumpkin_pie/choice_alt.png", oversample=4), 0, 4, 0, 4, tile=False) +style frame_button_text is choice_text: + align (0.5, 0.5) \ No newline at end of file diff --git a/game/scripts/gui/say.rpy b/game/scripts/gui/say.rpy index c6075135..441044c8 100644 --- a/game/scripts/gui/say.rpy +++ b/game/scripts/gui/say.rpy @@ -152,9 +152,7 @@ screen choice(items): zorder 1 variant "pc" - # 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 vbox: at gui_choice_show_hide @@ -178,13 +176,6 @@ screen choice(items): 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 @@ -195,6 +186,11 @@ screen choice(items): 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: @@ -208,6 +204,15 @@ transform gui_perspective_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_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: @@ -288,106 +293,8 @@ style choice_bar is empty: 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)] - -# 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" +style choice_progress: + pos (520, 15) # Input screen # diff --git a/game/scripts/utility/text_tags.rpy b/game/scripts/utility/text_tags.rpy index 4326027d..a9e09d21 100644 --- a/game/scripts/utility/text_tags.rpy +++ b/game/scripts/utility/text_tags.rpy @@ -3,9 +3,12 @@ init python: def convert_tags_to_kwargs(contents): - kwargs = {} + kwargs = {"style": "what"} for kind, text in contents: if kind == renpy.TEXT_TAG: + if text.startswith("="): + kwargs["style"] = text.split("=")[1] + if text.startswith("color="): kwargs["color"] = text.split("=")[1] @@ -20,6 +23,7 @@ init python: if text == "i": kwargs["italics"] = True + return kwargs @renpy.pure @@ -54,7 +58,7 @@ init python: end_pause = len(text)/100.0 for i, letter in enumerate(text): start_pause = i/100.0 - d = At(Text(letter, style="what", **kwargs), wave_text(start_pause, end_pause)) + d = At(Text(letter, **kwargs), wave_text(start_pause, end_pause)) rv.append((renpy.TEXT_DISPLAYABLE, d)) else: rv.append((kind, text)) @@ -69,7 +73,7 @@ init python: end_pause = len(text)/100.0 for i, letter in enumerate(text): start_pause = i/100.0 - d = At(Text(letter, style="what", **kwargs), bounce_text(start_pause, end_pause)) + d = At(Text(letter, **kwargs), bounce_text(start_pause, end_pause)) rv.append((renpy.TEXT_DISPLAYABLE, d)) else: rv.append((kind, text)) @@ -82,7 +86,7 @@ init python: for kind, text in contents: if kind == renpy.TEXT_TEXT: for i, letter in enumerate(text): - d = At(Text(letter, style="what", **kwargs), shake_text) + d = At(Text(letter, **kwargs), shake_text) rv.append((renpy.TEXT_DISPLAYABLE, d)) else: rv.append((kind, text)) @@ -94,7 +98,7 @@ init python: kwargs = convert_tags_to_kwargs(contents) for kind, text in contents: if kind == renpy.TEXT_TEXT: - d = At(Text(text, style="what", **kwargs), pulse_text) + d = At(Text(text, **kwargs), pulse_text) rv.append((renpy.TEXT_DISPLAYABLE, d)) else: rv.append((kind, text)) @@ -106,7 +110,7 @@ init python: kwargs = convert_tags_to_kwargs(contents) for kind, text in contents: if kind == renpy.TEXT_TEXT: - d = At(Text(text, style="what", **kwargs), shudder_text) + d = At(Text(text, **kwargs), shudder_text) rv.append((renpy.TEXT_DISPLAYABLE, d)) else: rv.append((kind, text)) @@ -118,7 +122,7 @@ init python: kwargs = convert_tags_to_kwargs(contents) for kind, text in contents: if kind == renpy.TEXT_TEXT: - d = Transform(At(Text(text, style="what", **kwargs), flip_text), pos=(240, -2)) + d = Transform(At(Text(text, **kwargs), flip_text), pos=(240, -2)) rv.append((renpy.TEXT_DISPLAYABLE, d)) else: rv.append((kind, text)) @@ -131,7 +135,7 @@ init python: for kind, text in contents: if kind == renpy.TEXT_TEXT: for i, letter in enumerate(text): - d = Transform(At(Text(letter, style="what", **kwargs), rotate_text), pos=(240, -2)) + d = Transform(At(Text(letter, **kwargs), rotate_text), pos=(240, -2)) rv.append((renpy.TEXT_DISPLAYABLE, d)) else: rv.append((kind, text))