From c9db632d6b7dd43b1abe8838af5712d5e857e7cc Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Mon, 17 Jun 2024 19:25:20 +0100 Subject: [PATCH] Implement history screen and sliders, add sounds --- .../creamy_pumpkin_pie/book/book_vslider.png | 3 + .../book/book_vslider_thumb.png | 3 + game/scripts/gui/_styles_.rpy | 6 + game/scripts/gui/history.rpy | 116 ++++++++++-------- game/scripts/gui/navigation.rpy | 31 +++-- 5 files changed, 103 insertions(+), 56 deletions(-) create mode 100644 game/gui/creamy_pumpkin_pie/book/book_vslider.png create mode 100644 game/gui/creamy_pumpkin_pie/book/book_vslider_thumb.png diff --git a/game/gui/creamy_pumpkin_pie/book/book_vslider.png b/game/gui/creamy_pumpkin_pie/book/book_vslider.png new file mode 100644 index 00000000..ecd28e64 --- /dev/null +++ b/game/gui/creamy_pumpkin_pie/book/book_vslider.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c6489bdc49ae8d403de667dc8d4d6e5a1f16f68e192384eb1a502a780895a457 +size 33237 diff --git a/game/gui/creamy_pumpkin_pie/book/book_vslider_thumb.png b/game/gui/creamy_pumpkin_pie/book/book_vslider_thumb.png new file mode 100644 index 00000000..0b52ba36 --- /dev/null +++ b/game/gui/creamy_pumpkin_pie/book/book_vslider_thumb.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d56c8082b26942782640877d7cfa798e4bee45fa60d93d9ac1812c178773dfb2 +size 7891 diff --git a/game/scripts/gui/_styles_.rpy b/game/scripts/gui/_styles_.rpy index ef2e4952..4aaaed7e 100644 --- a/game/scripts/gui/_styles_.rpy +++ b/game/scripts/gui/_styles_.rpy @@ -57,6 +57,8 @@ style bar: ysize gui.scrollbar_size base_bar Frame("scrollbar_horizontal_[prefix_]bar", gui.slider_borders, tile=gui.slider_tile) thumb Frame("scrollbar_horizontal_[prefix_]thumb", gui.slider_borders, tile=gui.slider_tile) + hover_sound "sounds/qubodup-hover1.ogg" + activate_sound "sounds/qubodup-click2.ogg" # style vbar: # unscrollable gui.unscrollable @@ -69,12 +71,16 @@ style scrollbar: ysize gui.scrollbar_size base_bar Frame("scrollbar_horizontal_[prefix_]bar", gui.slider_borders, tile=gui.slider_tile) thumb Frame("scrollbar_horizontal_[prefix_]thumb", gui.slider_borders, tile=gui.slider_tile) + hover_sound "sounds/qubodup-hover1.ogg" + activate_sound "sounds/qubodup-click2.ogg" style vscrollbar: unscrollable gui.unscrollable xsize gui.scrollbar_size base_bar Frame("scrollbar_vertical_[prefix_]bar", gui.slider_borders, tile=gui.slider_tile) thumb Frame("scrollbar_vertical_[prefix_]thumb", gui.slider_borders, tile=gui.slider_tile) + hover_sound "sounds/qubodup-hover1.ogg" + activate_sound "sounds/qubodup-click2.ogg" # style dark_vscrollbar: # unscrollable gui.unscrollable diff --git a/game/scripts/gui/history.rpy b/game/scripts/gui/history.rpy index ba3a28de..edce4b2f 100644 --- a/game/scripts/gui/history.rpy +++ b/game/scripts/gui/history.rpy @@ -1,20 +1,76 @@ -# -# History screen -# -# This is a screen that displays the dialogue history to the player. While -# there isn't anything special about this screen, it does have to access the -# dialogue history stored in _history_list. -# -# https://www.renpy.org/doc/html/history.html - init offset = -1 screen history(): + layer "interface" + predict False - tag menu + frame style "navigation_page_left": + has vbox + + label _("History") + null height 10 + + viewport: + style_prefix "history" + yinitial 1.0 + scrollbars "vertical" + mousewheel not renpy.android + + vbox: + style "history_vbox" + for entry in _history_list: + button: + style "history_entry" + action Confirm("Rollback to the selected statement?\nThis will lose unsaved progress.", RollbackToIdentifier(entry.rollback_identifier)) + + vbox: + spacing 0 + if entry.who: + $ who = renpy.filter_text_tags(entry.who, allow=gui.history_allow_tags) + + hbox: + if (icon := entry.show_args.get("icon", None)): + $ icon = f"interface/icons/head/{icon}.webp" + add icon xysize (32, 32) + text who style "history_text_who" + + $ what = renpy.filter_text_tags(entry.what, allow=gui.history_allow_tags) + text what style "history_text_what": + substitute False + frame style "navigation_page_right": + pass + +style history_viewport: + xmaximum 300 + ymaximum 400 + +style history_vscrollbar is navigation_vscrollbar + +style history_vbox: + spacing 10 + xmaximum 295 + +style history_entry: + xfill True + padding (4, 6) + background Frame(Image("gui/creamy_pumpkin_pie/book/book_select.png", oversample=4), 20, 8, 20, 8, tile=False) + hover_background Fixed("#C69D65", Frame(Image("gui/creamy_pumpkin_pie/book/book_select.png", oversample=4), 20, 8, 20, 8, tile=False)) + +style history_text_what is navigation_text: + # color "#fff" + # outlines [(1, "#000000", 1, 1)] + # hinting "bytecode" + size 10 + +style history_text_who is navigation_text: + # color "#EA8E61" + # outlines [(1, "#000000", 1, 1)] + hinting "auto" + font gui.bold_font + size 12 # Avoid predicting this screen, as it can be very large - predict False + # predict False # use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport"), yinitial=1.0): @@ -58,40 +114,4 @@ screen history(): # if not _history_list: # label _("The dialogue history is empty.") - -# Tags that are allowed to be displayed on the history screen -define gui.history_allow_tags = ("number", "heart", "unicode") - -# Height of a history screen entry, or None for variable height at the cost of performance -define gui.history_height = None #117 - -style history_name is gui_label -style history_name_text is gui_label_text -style history_text is gui_text - -style history_text is gui_text - -style history_label is gui_label -style history_label_text is gui_label_text: - color "#402313" - -style history_window is empty: - xfill True - ysize gui.history_height - padding (0,6) - -style history_name: - align (0.1, 0.5) - size 22 - -style history_name_text: - text_align 1.0 - -style history_text: - text_align 0.0 - -style history_label: - xfill True - -style history_label_text: - xalign 0.5 +define gui.history_allow_tags = ("number", "unicode", "color") diff --git a/game/scripts/gui/navigation.rpy b/game/scripts/gui/navigation.rpy index ad8ab25e..91c70988 100644 --- a/game/scripts/gui/navigation.rpy +++ b/game/scripts/gui/navigation.rpy @@ -174,6 +174,8 @@ screen navigation(): default page_right_atl = None default page_left_atl = None + on "show" action Play("sound", "sounds/bookopen.ogg") + add last_frame at navigation_last_frame_atl # add "gui_fade_both" at gui_fade @@ -194,8 +196,9 @@ screen navigation(): textbutton _("Settings") action [SetLocalVariable("subcategory", "general"), SetLocalVariable("category", "settings")] at navigation_tabs textbutton _("Main Menu") action MainMenu() at navigation_tabs null height 35 - textbutton _("Return") action [SetScreenVariable("navigation_last_frame_atl", navigation_last_frame_hide), SetScreenVariable("navigation_atl", navigation_hide), SetScreenVariable("navigation_exit", True)] keysym "game_menu" at navigation_tabs + textbutton _("Return") action [SetScreenVariable("navigation_last_frame_atl", navigation_last_frame_hide), SetScreenVariable("navigation_atl", navigation_hide), SetScreenVariable("navigation_exit", True)] keysym "game_menu" activate_sound "sounds/bookclose.ogg" at navigation_tabs null height 35 + textbutton _("History") action [SetLocalVariable("subcategory", None), SetLocalVariable("category", "history")] selected (category=="history") at navigation_tabs textbutton _("Credits") action Show("credits") at navigation_tabs if category == "save": @@ -241,6 +244,8 @@ screen navigation(): use settings_display elif subcategory == "general": use settings_general + elif category == "history": + use history transform navigation_tabs: subpixel True @@ -315,6 +320,7 @@ style navigation_tabs_button: background Frame(Image("gui/creamy_pumpkin_pie/book/book_tab.png", oversample=4), 0, 0, 80, 0, tile=False) selected_background Frame(Transform(Image("gui/creamy_pumpkin_pie/book/book_tab.png", oversample=4), matrixcolor=HueMatrix(180.0)), 0, 0, 80, 0, tile=False) insensitive_background Frame(Transform(Image("gui/creamy_pumpkin_pie/book/book_tab.png", oversample=4), matrixcolor=SaturationMatrix(0.0)), 0, 0, 80, 0, tile=False) + activate_sound "sounds/pageflip.ogg" style navigation_tabs_button_text is who: color "#ffffff" @@ -340,6 +346,7 @@ style navigation_subtabs_button: background Frame(Transform(Image("gui/creamy_pumpkin_pie/book/book_tab.png", oversample=4), xzoom=-1), 80, 0, 0, 0, tile=False) selected_background Frame(Transform(Image("gui/creamy_pumpkin_pie/book/book_tab.png", oversample=4), xzoom=-1, matrixcolor=HueMatrix(180.0)), 80, 0, 0, 0, tile=False) insensitive_background Frame(Transform(Image("gui/creamy_pumpkin_pie/book/book_tab.png", oversample=4), xzoom=-1, matrixcolor=SaturationMatrix(0.0)), 80, 0, 0, 0, tile=False) + activate_sound "sounds/pageflip.ogg" style navigation_subtabs_button_text is navigation_tabs_button_text: selected_xoffset -15 @@ -412,7 +419,7 @@ style navigation_radio_button_text is navigation_text: first_indent 24 insensitive_color "#704F3280" -style navigation_slider is empty: +style navigation_slider: xalign 0.5 xmaximum 300 ysize 20 @@ -421,14 +428,22 @@ style navigation_slider is empty: thumb Image("gui/creamy_pumpkin_pie/book/book_slider_thumb.png", oversample=4) thumb_offset 16 -style navigation_bar is empty: +style navigation_vscrollbar: + xalign 0.5 + xsize 20 + base_bar Frame(Image("gui/creamy_pumpkin_pie/book/book_vslider.png", oversample=4), 8, 40, 8, 40, tile=False) + thumb Image("gui/creamy_pumpkin_pie/book/book_vslider_thumb.png", oversample=4) + thumb_offset 1 + +style navigation_bar: xalign 0.5 xmaximum 300 ysize 20 - left_bar Frame(Image("gui/creamy_pumpkin_pie/book/book_bar_full.png", oversample=4), tile=False) - right_bar Frame(Image("gui/creamy_pumpkin_pie/book/book_bar_empty.png", oversample=4), tile=False) - hover_right_bar Fixed(Frame(Image("gui/creamy_pumpkin_pie/book/book_select.png", oversample=4), 20, 4, 20, 4, tile=False), Frame(Image("gui/creamy_pumpkin_pie/book/book_bar_empty.png", oversample=4), tile=False)) - hover_left_bar Fixed(Frame(Image("gui/creamy_pumpkin_pie/book/book_select.png", oversample=4), 20, 4, 20, 4, tile=False), Frame(Image("gui/creamy_pumpkin_pie/book/book_bar_full.png", oversample=4), tile=False)) + left_bar Frame(Image("gui/creamy_pumpkin_pie/book/book_bar_full.png", oversample=4), 40, 8, 40, 8, tile=False) + right_bar Frame(Image("gui/creamy_pumpkin_pie/book/book_bar_empty.png", oversample=4), 40, 8, 40, 8, tile=False) + hover_right_bar Fixed(Frame(Image("gui/creamy_pumpkin_pie/book/book_select.png", oversample=4), 20, 4, 20, 4, tile=False), Frame(Image("gui/creamy_pumpkin_pie/book/book_bar_empty.png", oversample=4), 40, 8, 40, 8, tile=False)) + hover_left_bar Fixed(Frame(Image("gui/creamy_pumpkin_pie/book/book_select.png", oversample=4), 20, 4, 20, 4, tile=False), Frame(Image("gui/creamy_pumpkin_pie/book/book_bar_full.png", oversample=4), 40, 8, 40, 8, tile=False)) + thumb None style navigation_note: padding (6, 4) @@ -440,4 +455,4 @@ image doodle_letter = Image("gui/creamy_pumpkin_pie/book/book_doodles_letter.png image doodle_owl = Image("gui/creamy_pumpkin_pie/book/book_doodles_owl.png", oversample=4) image doodle_panties = Image("gui/creamy_pumpkin_pie/book/book_doodles_panties.png", oversample=4) image doodle_snitch = Image("gui/creamy_pumpkin_pie/book/book_doodles_snitch.png", oversample=4) -image doodle_glasses = Image("gui/creamy_pumpkin_pie/book/book_doodles_glasses.png", oversample=4) \ No newline at end of file +image doodle_glasses = Image("gui/creamy_pumpkin_pie/book/book_doodles_glasses.png", oversample=4)