From 6244dbbcce0cc3ac75cb9efe13f14fcfe4afb641 Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Thu, 6 Jun 2024 20:25:13 +0100 Subject: [PATCH] Enable new navigation menu --- game/scripts/gui/main_menu.rpy | 167 +++++++++++----------- game/scripts/gui/preferences.rpy | 13 +- game/scripts/gui/save_files.rpy | 52 ++++--- game/scripts/options.rpy | 6 +- game/scripts/utility/common_functions.rpy | 2 +- game/scripts/wardrobe/wardrobe.rpy | 4 +- 6 files changed, 131 insertions(+), 113 deletions(-) diff --git a/game/scripts/gui/main_menu.rpy b/game/scripts/gui/main_menu.rpy index 182fb54b..3f7d4661 100644 --- a/game/scripts/gui/main_menu.rpy +++ b/game/scripts/gui/main_menu.rpy @@ -83,7 +83,7 @@ screen main_menu(): align (0.5, 0.5) action OpenURL("https://www.silverstudiogames.org") - use navigation + use navigation_main_menu image main_menu_bg: alpha 0.5 @@ -121,62 +121,62 @@ style main_menu_version is main_menu_text: screen game_menu(title, scroll=None, yinitial=0.0): - style_prefix "game_menu" + # style_prefix "game_menu" - add gui.game_menu_background + # add gui.game_menu_background - frame: - style "game_menu_outer_frame" + # frame: + # style "game_menu_outer_frame" - if gui.theme() == "light": - background "#00000040" - else: - background "#00000080" + # if gui.theme() == "light": + # background "#00000040" + # else: + # background "#00000080" - hbox: - box_reverse True - spacing 25 + # hbox: + # box_reverse True + # spacing 25 - # Reserve space for the navigation section - frame: - style "game_menu_navigation_frame" + # # Reserve space for the navigation section + # frame: + # style "game_menu_navigation_frame" - frame: - # Content frame uses GUI theme - style gui.theme("game_menu_content_frame") - style_prefix gui.theme() + # frame: + # # Content frame uses GUI theme + # style gui.theme("game_menu_content_frame") + # style_prefix gui.theme() - if scroll == "viewport": - viewport: - yinitial yinitial - scrollbars "vertical" - mousewheel True - draggable True - pagekeys True - side_yfill True - frame: - style "empty" - padding (15, 15, 15, 15) - transclude + # if scroll == "viewport": + # viewport: + # yinitial yinitial + # scrollbars "vertical" + # mousewheel True + # draggable True + # pagekeys True + # side_yfill True + # frame: + # style "empty" + # padding (15, 15, 15, 15) + # transclude - elif scroll == "vpgrid": - vpgrid: - cols 1 - yinitial yinitial - scrollbars "vertical" - mousewheel True - draggable True - pagekeys True - side_yfill True - transclude + # elif scroll == "vpgrid": + # vpgrid: + # cols 1 + # yinitial yinitial + # scrollbars "vertical" + # mousewheel True + # draggable True + # pagekeys True + # side_yfill True + # transclude - else: - frame: - style "empty" - padding (15, 15, 15, 15) - transclude + # else: + # frame: + # style "empty" + # padding (15, 15, 15, 15) + # transclude - use navigation(title) + use navigation # use navigation(title): @@ -227,7 +227,7 @@ style game_menu_label_text is gui_label_text: # This screen is included in the main and game menus, and provides navigation # to other menus, and to start the game. -screen navigation(title=None): +screen navigation_main_menu(title=None): default show_quick_start = False default show_dev_start = False @@ -289,20 +289,26 @@ screen navigation(title=None): textbutton _("Help") action ShowMenu("help") sensitive is_sensitive textbutton _("Quit to menu") action MainMenu() sensitive is_sensitive -screen navigation2(title="Title"): +screen navigation(): style_prefix "navigation" - default category = "settings" - default subcategory = "general" + default last_frame = (screenshot.capture() or screenshot.image) + default category = "save" + default subcategory = None default page = 0 + add last_frame at navigation_blackout + # add "gui_fade_both" at gui_fade + frame: + at navigation_showhide vbox: style_prefix "navigation_tabs" textbutton "Save" action [SetLocalVariable("subcategory", None), SetLocalVariable("category", "save")] selected (category=="save") at navigation_tabs textbutton "Load" action [SetLocalVariable("subcategory", None), SetLocalVariable("category", "load")] selected (category=="load") at navigation_tabs 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 Return() at navigation_tabs @@ -354,6 +360,33 @@ transform navigation_tabs: easein 0.1 xzoom 1.1 easeout 0.1 xzoom 1.0 +transform navigation_blackout: + matrixcolor SaturationMatrix(1.0) + on start: + easein 1.0 matrixcolor SaturationMatrix(0.33) + on hide: + easeout 0.4 matrixcolor SaturationMatrix(1.0) + +transform navigation_showhide: + subpixel True + + on show: + zoom 0.0 + alpha 0.0 + easein_back 0.4 zoom 1.0 alpha 1.0 + + on hide: + zoom 1.0 + alpha 1.0 + easeout_back 0.4 zoom 0.0 alpha 0.0 + +transform pause_trans(p, old_widget=None, new_widget=None): + events False + old_widget + pause p + new_widget + events True + style navigation_frame is empty: align (0.5, 0.5) xysize (750, 512) @@ -474,7 +507,7 @@ style navigation_radio_vbox: style navigation_radio_label is navigation_label: xsize 206 background Image("gui/creamy_pumpkin_pie/book/book_spacer.png", oversample=4) - + style navigation_radio_label_text is navigation_label_text: xalign 0.5 size 24 @@ -508,32 +541,6 @@ style navigation_bar is empty: 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)) -style navigation_grid is empty: - xspacing 0 - yspacing 0 - # ypos 0 - -style navigation_picture_button: +style navigation_note: padding (6, 4) - background Frame(Image("gui/creamy_pumpkin_pie/book/book_note.png", oversample=4), 40, 40, 40, 40, tile=False) - -# style navigation_vbox: -# xsize 250 -# spacing gui.navigation_spacing -# xoffset -150 -# xpos 1.0 -# xanchor 0.5 - -# style navigation_button is gui_button: -# # size_group "navigation" -# background None -# xalign 0.5 - -# style navigation_button_text is gui_button_text: -# background None -# size 19 -# xalign 0.5 -# idle_color Color('#888') -# hover_color '#fff' -# selected_color '#fff' -# insensitive_color Color('#888', alpha=0.5) + background Frame(Image("gui/creamy_pumpkin_pie/book/book_note.png", oversample=4), 40, 40, 40, 40, tile=False) \ No newline at end of file diff --git a/game/scripts/gui/preferences.rpy b/game/scripts/gui/preferences.rpy index 23255cb1..2339e984 100644 --- a/game/scripts/gui/preferences.rpy +++ b/game/scripts/gui/preferences.rpy @@ -204,7 +204,18 @@ screen preferences_accessibility(): textbutton "Delete persistent data ({color=#f00}!{/color})" action Confirm(gui.CONFIRM_DELETE_PERSISTENT, Function(delete_persistent)) textbutton "Delete save files ({color=#f00}!{/color})" action Confirm(gui.CONFIRM_DELETE_SAVES, Function(delete_saves)) frame style "navigation_page_right": - pass + frame style "navigation_note": + xysize (180, 180) + pos (20, 50) + at transform: + rotate 6 + text "TIP: If text overflows, try reducing vertical text spacing." + frame style "navigation_note": + xysize (180, 180) + pos (25, 150) + at transform: + rotate -4 + text "You could also try changing the font, it might help! :)" define gui.CONFIRM_DELETE_PERSISTENT = """{color=#7a0000}Warning!{/color} {size=-4}You are about to reset all persistent data, including diff --git a/game/scripts/gui/save_files.rpy b/game/scripts/gui/save_files.rpy index 95123da7..55a4f650 100644 --- a/game/scripts/gui/save_files.rpy +++ b/game/scripts/gui/save_files.rpy @@ -11,10 +11,12 @@ init offset = -1 screen save(): + use navigation use file_slots(_("Save")) screen load(): + use navigation use file_slots(_("Load")) @@ -38,7 +40,8 @@ screen file_slots(title): frame style "empty": for i in range(1, 7): button: - style "navigation_picture_button" + style "navigation_note" + at note_hover(slot_rotations[i]) xysize (150, 140) xpos ((i-1) % 2) * 160 ypos ((i-1) // 2) * 140 @@ -49,9 +52,11 @@ screen file_slots(title): add "#C69D65" xysize (135, 75) xalign 0.5 ypos 16 if not FileCompatible(i) and title == "Load": - action Confirm(gui.SAVE_INCOMPATIBLE_WARNING, FileAction(i)) + action Confirm(gui.SAVE_INCOMPATIBLE_WARNING, FileLoad(i)) + elif title == "Load": + action FileLoad(i) else: - action FileAction(i) + action FileSave(i) # FileSaveName sometimes returns an empty string regardless of 'empty' parameter. /shrugs $ file_name = (FileSaveName(i) or f"Slot {i}") @@ -67,16 +72,6 @@ screen file_slots(title): $ hours, minutes = divmod(minutes, 60) text f"Playtime: {hours}H {minutes}M {seconds}S" style "file_description_text" - at transform: - subpixel True - offset (75, 70) - anchor (0.5, 0.5) - rotate slot_rotations[i] - - on idle: - easein 0.25 rotate slot_rotations[i] - on hover: - easein 0.25 rotate 0 frame style "navigation_page_right": vbox: @@ -91,7 +86,8 @@ screen file_slots(title): frame style "empty": for i in range(7, 13): button: - style "navigation_picture_button" + style "navigation_note" + at note_hover(slot_rotations[i]) xysize (150, 140) xpos ((i-7) % 2) * 160 ypos ((i-7) // 2) * 140 @@ -102,9 +98,11 @@ screen file_slots(title): add "#C69D65" xysize (135, 75) xalign 0.5 ypos 16 if not FileCompatible(i) and title == "Load": - action Confirm(gui.SAVE_INCOMPATIBLE_WARNING, FileAction(i)) + action Confirm(gui.SAVE_INCOMPATIBLE_WARNING, FileLoad(i)) + elif title == "Load": + action FileLoad(i) else: - action FileAction(i) + action FileSave(i) # FileSaveName sometimes returns an empty string regardless of 'empty' parameter. /shrugs $ file_name = (FileSaveName(i) or f"Slot {i}") @@ -120,23 +118,23 @@ screen file_slots(title): $ hours, minutes = divmod(minutes, 60) text f"Playtime: {hours}H {minutes}M {seconds}S" style "file_description_text" - at transform: - subpixel True - offset (75, 70) - anchor (0.5, 0.5) - rotate slot_rotations[i] - - on idle: - easein 0.25 rotate slot_rotations[i] - on hover: - easein 0.25 rotate 0 - transform file_hover: on hover: matrixcolor SaturationMatrix(1.0) on idle: matrixcolor SaturationMatrix(0.5) +transform note_hover(r): + subpixel True + offset (75, 70) + anchor (0.5, 0.5) + rotate r + + on idle: + easein 0.25 rotate r + on hover: + easein 0.25 rotate 0 + style file_delete style file_delete_text: diff --git a/game/scripts/options.rpy b/game/scripts/options.rpy index 2078b865..90b1fff3 100644 --- a/game/scripts/options.rpy +++ b/game/scripts/options.rpy @@ -27,6 +27,8 @@ init python: renpy.music.register_channel("sound2", "sfx", False) renpy.music.register_channel("weather", "weather", True) +default _game_menu_screen = "navigation" + # Configuration # https://www.renpy.org/doc/html/config.html @@ -126,8 +128,8 @@ define config.default_music_volume = 0.8 define config.default_sfx_volume = 1.0 # Transitions -define config.enter_transition = f3 -define config.exit_transition = f3 +define config.enter_transition = None +define config.exit_transition = pause_trans(0.4) define config.intra_transition = d1 define config.main_game_transition = f3 define config.game_main_transition = f3 diff --git a/game/scripts/utility/common_functions.rpy b/game/scripts/utility/common_functions.rpy index 57c02c83..e2dec0aa 100644 --- a/game/scripts/utility/common_functions.rpy +++ b/game/scripts/utility/common_functions.rpy @@ -123,7 +123,7 @@ init python early: def enable_game_menu(): global _game_menu_screen - _game_menu_screen = "save_screen" + _game_menu_screen = "navigation" def make_revertable(obj): if isinstance(obj, _list): diff --git a/game/scripts/wardrobe/wardrobe.rpy b/game/scripts/wardrobe/wardrobe.rpy index 1a82deb4..2f195567 100644 --- a/game/scripts/wardrobe/wardrobe.rpy +++ b/game/scripts/wardrobe/wardrobe.rpy @@ -211,8 +211,8 @@ label _wardrobe: show screen main_room show screen ui_top_bar - $ _game_menu_screen = "save" # documented - $ _skipping = True # documented + $ _game_menu_screen = "navigation" + $ _skipping = True $ renpy.stop_predict(__predicted) $ __predicted = None $ renpy.suspend_rollback(False)