From 4b7c4ff60f19071feacc5b2eabbfa9787bcc52a2 Mon Sep 17 00:00:00 2001 From: LoafyLemon Date: Fri, 14 Jun 2024 16:34:50 +0100 Subject: [PATCH] GUI Cleanup and restructuring --- game/scripts/gui/about.rpy | 26 +- game/scripts/gui/help.rpy | 46 +-- game/scripts/gui/history.rpy | 58 ++-- game/scripts/gui/mods.rpy | 164 ++++----- .../gui/{main_menu.rpy => navigation.rpy} | 147 +------- game/scripts/gui/save_files.rpy | 318 ------------------ game/scripts/gui/saves.rpy | 142 ++++++++ .../gui/{preferences.rpy => settings.rpy} | 165 +-------- game/scripts/utility/updater.rpy | 96 +++--- 9 files changed, 348 insertions(+), 814 deletions(-) rename game/scripts/gui/{main_menu.rpy => navigation.rpy} (81%) delete mode 100644 game/scripts/gui/save_files.rpy create mode 100644 game/scripts/gui/saves.rpy rename game/scripts/gui/{preferences.rpy => settings.rpy} (69%) diff --git a/game/scripts/gui/about.rpy b/game/scripts/gui/about.rpy index b3ccb8ec..452e3319 100644 --- a/game/scripts/gui/about.rpy +++ b/game/scripts/gui/about.rpy @@ -15,24 +15,24 @@ screen about(): ## This use statement includes the game_menu screen inside this one. The ## vbox child is then included inside the viewport inside the game_menu ## screen. - use game_menu(_("About"), scroll="viewport"): + # use game_menu(_("About"), scroll="viewport"): - style_prefix gui.theme("about") + # style_prefix gui.theme("about") - vbox: - spacing gui.pref_spacing + # vbox: + # spacing gui.pref_spacing - if config.window_title: - label "[config.window_title]" - else: - label "[config.name!t]" - #text _("Version [config.version!t]\n") + # if config.window_title: + # label "[config.window_title]" + # else: + # label "[config.name!t]" + # #text _("Version [config.version!t]\n") - ## gui.about is usually set in options.rpy. - if gui.about: - text "[gui.about!t]\n" + # ## gui.about is usually set in options.rpy. + # if gui.about: + # text "[gui.about!t]\n" - text _("Made with {a=https://www.renpy.org/}Ren'Py{/a} [renpy.version_only].\n\n[renpy.license!t]") size 12 + # text _("Made with {a=https://www.renpy.org/}Ren'Py{/a} [renpy.version_only].\n\n[renpy.license!t]") size 12 style about_label is gui_label diff --git a/game/scripts/gui/help.rpy b/game/scripts/gui/help.rpy index fcfb4ba8..e6329c87 100644 --- a/game/scripts/gui/help.rpy +++ b/game/scripts/gui/help.rpy @@ -4,34 +4,34 @@ init offset = -1 screen help(page='tutorials'): tag menu - use game_menu(_("Help"), scroll="viewport"): + # use game_menu(_("Help"), scroll="viewport"): - style_prefix "help" + # style_prefix "help" - vbox: - spacing 8 - null # Tab margin + # vbox: + # spacing 8 + # null # Tab margin - if page == 'tutorials': - use tutorials_help - elif page == "controls": - use controls_help - elif page == "gamepad": - use gamepad_help - elif page == "about": - use about_help + # if page == 'tutorials': + # use tutorials_help + # elif page == "controls": + # use controls_help + # elif page == "gamepad": + # use gamepad_help + # elif page == "about": + # use about_help - hbox: - style_prefix gui.theme("tab") - pos (25 + 15, 100) - yanchor 0.5 + # hbox: + # style_prefix gui.theme("tab") + # pos (25 + 15, 100) + # yanchor 0.5 - textbutton _("Tutorials") action [SelectedIf(page == 'tutorials'), Show("help", config.intra_transition, "tutorials")] - if not renpy.mobile: - textbutton _("Controls") action [SelectedIf(page == 'controls'), Show("help", config.intra_transition, "controls")] - if GamepadExists(): - textbutton _("Gamepad") action [SelectedIf(page == 'gamepad'), Show("help", config.intra_transition, "gamepad")] - textbutton _("About") action [SelectedIf(page == 'about'), Show("help", config.intra_transition, "about")] + # textbutton _("Tutorials") action [SelectedIf(page == 'tutorials'), Show("help", config.intra_transition, "tutorials")] + # if not renpy.mobile: + # textbutton _("Controls") action [SelectedIf(page == 'controls'), Show("help", config.intra_transition, "controls")] + # if GamepadExists(): + # textbutton _("Gamepad") action [SelectedIf(page == 'gamepad'), Show("help", config.intra_transition, "gamepad")] + # textbutton _("About") action [SelectedIf(page == 'about'), Show("help", config.intra_transition, "about")] screen tutorials_help(): for entry, tutorial in tutorial_dict.items(): diff --git a/game/scripts/gui/history.rpy b/game/scripts/gui/history.rpy index 3574a9cc..ba3a28de 100644 --- a/game/scripts/gui/history.rpy +++ b/game/scripts/gui/history.rpy @@ -16,47 +16,47 @@ screen history(): # Avoid predicting this screen, as it can be very large predict False - use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport"), yinitial=1.0): + # use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport"), yinitial=1.0): - style_prefix gui.theme("history") + # style_prefix gui.theme("history") - has vbox - spacing 12 + # has vbox + # spacing 12 - default last_who = "" + # default last_who = "" - for entry in _history_list: - vbox: - xfill True - spacing 12 + # for entry in _history_list: + # vbox: + # xfill True + # spacing 12 - if not last_who == entry.who: - hbox: - spacing 12 + # if not last_who == entry.who: + # hbox: + # spacing 12 - if "icon" in entry.show_args: - $ icon = entry.show_args["icon"] - add Fixed(gui.format("interface/achievements/{}/iconbox.webp"), Transform(f"interface/icons/head/{icon}.webp", xzoom=-1, size=(40, 40), align=(0.5, 0.5)), fit_first=True) + # if "icon" in entry.show_args: + # $ icon = entry.show_args["icon"] + # add Fixed(gui.format("interface/achievements/{}/iconbox.webp"), Transform(f"interface/icons/head/{icon}.webp", xzoom=-1, size=(40, 40), align=(0.5, 0.5)), fit_first=True) - if entry.who: - text entry.who: - style "history_name" - substitute False + # if entry.who: + # text entry.who: + # style "history_name" + # substitute False - if "color" in entry.who_args: - color entry.who_args["color"] + # if "color" in entry.who_args: + # color entry.who_args["color"] - vbox: - spacing 6 - $ what = renpy.filter_text_tags(entry.what, allow=gui.history_allow_tags) + # vbox: + # spacing 6 + # $ what = renpy.filter_text_tags(entry.what, allow=gui.history_allow_tags) - text what: - substitute False + # text what: + # substitute False - $ last_who = entry.who + # $ last_who = entry.who - if not _history_list: - label _("The dialogue history is empty.") + # if not _history_list: + # label _("The dialogue history is empty.") # Tags that are allowed to be displayed on the history screen diff --git a/game/scripts/gui/mods.rpy b/game/scripts/gui/mods.rpy index efb1cb1e..a8bf266d 100644 --- a/game/scripts/gui/mods.rpy +++ b/game/scripts/gui/mods.rpy @@ -4,110 +4,110 @@ init offset = -1 screen mods(): tag menu - use game_menu("Mods"): + # use game_menu("Mods"): - default selection = next(iter(mods_list.keys())) - default checkbox_enabled = gui.theme("check_true") - default checkbox_disabled = gui.theme("check_false") - default mods_enabled_now = set(persistent.mods_enabled) - $ awaits_restart = bool(mods_enabled_now != persistent.mods_enabled) + # default selection = next(iter(mods_list.keys())) + # default checkbox_enabled = gui.theme("check_true") + # default checkbox_disabled = gui.theme("check_false") + # default mods_enabled_now = set(persistent.mods_enabled) + # $ awaits_restart = bool(mods_enabled_now != persistent.mods_enabled) - fixed: + # fixed: - ## The grid of file slots. - hbox: - spacing 5 + # ## The grid of file slots. + # hbox: + # spacing 5 - vpgrid: - cols 1 - scrollbars "vertical" - mousewheel True - draggable True - pagekeys True - side_yfill True - spacing gui.slot_spacing + # vpgrid: + # cols 1 + # scrollbars "vertical" + # mousewheel True + # draggable True + # pagekeys True + # side_yfill True + # spacing gui.slot_spacing - style_prefix gui.theme("slot") + # style_prefix gui.theme("slot") - for mod in mods_list.values(): - $ name = mod["Name"] - $ desc = mod["Description"] - $ author = mod["Author"] - $ version = mod["Version"] - $ compat = version_float(mod["GameVer"]) - #$ order = mod["LoadOrder"] - $ logo = mod["Logo"] - $ enabled = bool(name in persistent.mods_enabled) - $ selected = (name == selection) + # for mod in mods_list.values(): + # $ name = mod["Name"] + # $ desc = mod["Description"] + # $ author = mod["Author"] + # $ version = mod["Version"] + # $ compat = version_float(mod["GameVer"]) + # #$ order = mod["LoadOrder"] + # $ logo = mod["Logo"] + # $ enabled = bool(name in persistent.mods_enabled) + # $ selected = (name == selection) - if selected: - $ action = ToggleMod(name) - else: - $ action = SetScreenVariable("selection", name) + # if selected: + # $ action = ToggleMod(name) + # else: + # $ action = SetScreenVariable("selection", name) - button: - action action - selected selected - sensitive main_menu + # button: + # action action + # selected selected + # sensitive main_menu - has fixed + # has fixed - add logo pos (0, 0) size (70, 50) + # add logo pos (0, 0) size (70, 50) - vbox: - xpos config.thumbnail_width - xsize gui.slot_width - config.thumbnail_width - gui.slot_height - yalign 0.5 + # vbox: + # xpos config.thumbnail_width + # xsize gui.slot_width - config.thumbnail_width - gui.slot_height + # yalign 0.5 - text "[name]": - style "mods_text" - size 16 - if not compat >= mods_compatible: - color "#ff8000" + # text "[name]": + # style "mods_text" + # size 16 + # if not compat >= mods_compatible: + # color "#ff8000" - text "[version]": - style "mods_text" + # text "[version]": + # style "mods_text" - if enabled: - add checkbox_enabled align (0.95, 0.5) - else: - add checkbox_disabled align (0.95, 0.5) + # if enabled: + # add checkbox_enabled align (0.95, 0.5) + # else: + # add checkbox_disabled align (0.95, 0.5) - if awaits_restart: - text "Awaiting game restart to apply changes..." + # if awaits_restart: + # text "Awaiting game restart to apply changes..." - frame: - style gui.theme("frame") - xfill True - ymaximum 400 + # frame: + # style gui.theme("frame") + # xfill True + # ymaximum 400 - $ name = mods_list[selection]["Name"] - $ desc = mods_list[selection]["Description"] - $ author = mods_list[selection]["Author"] - $ version = mods_list[selection]["Version"] - $ compat = version_float(mods_list[selection]["GameVer"]) - #$ order = mods_list[selection]["LoadOrder"] - $ logo = mods_list[selection]["Logo"] + # $ name = mods_list[selection]["Name"] + # $ desc = mods_list[selection]["Description"] + # $ author = mods_list[selection]["Author"] + # $ version = mods_list[selection]["Version"] + # $ compat = version_float(mods_list[selection]["GameVer"]) + # #$ order = mods_list[selection]["LoadOrder"] + # $ logo = mods_list[selection]["Logo"] - vbox: - spacing 3 - xpos 3 + # vbox: + # spacing 3 + # xpos 3 - frame: - style gui.theme("frame") - xoffset -3 - ysize 252 - add logo xalign 0.5 size (320, 240) - text "[name]\n[version]" offset (6, 6) + # frame: + # style gui.theme("frame") + # xoffset -3 + # ysize 252 + # add logo xalign 0.5 size (320, 240) + # text "[name]\n[version]" offset (6, 6) - if not compat >= mods_compatible: - text "{color=#ff8000}[compat]{/color}" align (1.0, 1.0) offset (-6, -3) - else: - text "{color=#228B22}[compat]{/color}" align (1.0, 1.0) offset (-6, -3) + # if not compat >= mods_compatible: + # text "{color=#ff8000}[compat]{/color}" align (1.0, 1.0) offset (-6, -3) + # else: + # text "{color=#228B22}[compat]{/color}" align (1.0, 1.0) offset (-6, -3) - text "Author:\n{size=-4}[author]{/size}" size 14 - text "Description:\n{size=-4}[desc]{/size}" size 14 + # text "Author:\n{size=-4}[author]{/size}" size 14 + # text "Description:\n{size=-4}[desc]{/size}" size 14 style mods_text is slot_button_text: selected_color "#000" diff --git a/game/scripts/gui/main_menu.rpy b/game/scripts/gui/navigation.rpy similarity index 81% rename from game/scripts/gui/main_menu.rpy rename to game/scripts/gui/navigation.rpy index bd2447c2..2bc35610 100644 --- a/game/scripts/gui/main_menu.rpy +++ b/game/scripts/gui/navigation.rpy @@ -1,15 +1,5 @@ -# -# Main/game menu screens -# - init offset = -1 -# Main menu screen -# -# Used to display the main menu when Ren'Py starts. -# -# https://www.renpy.org/doc/html/screen_special.html#main-menu - screen main_menu(): # This ensures that any other menu screen is replaced @@ -109,124 +99,6 @@ style main_menu_version is main_menu_text: color "#fff" outlines [(1, "#000000", 1, 0)] - -# Game menu screen -# -# This lays out the basic common structure of a game menu screen. It's called -# with the screen title, and displays the background, title, and navigation. -# -# The scroll parameter can be None, or one of "viewport" or "vpgrid". When -# this screen is intended to be used with one or more children, which are -# transcluded (placed) inside it. - -screen game_menu(title, scroll=None, yinitial=0.0): - - # style_prefix "game_menu" - - # add gui.game_menu_background - - # frame: - # style "game_menu_outer_frame" - - # if gui.theme() == "light": - # background "#00000040" - # else: - # background "#00000080" - - # hbox: - # box_reverse True - # spacing 25 - - # # 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() - - # 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 - - # else: - # frame: - # style "empty" - # padding (15, 15, 15, 15) - # transclude - - use navigation - - # use navigation(title): - - # label title xalign .5 - - if main_menu and not title == "Updater": - key "game_menu" action ShowMenu("main_menu") - -style game_menu_outer_frame is empty: - padding (25, 100, 25, 25) - xfill True - yfill True - -style game_menu_navigation_frame is empty: - xsize 250 - yfill True - -style game_menu_content_frame is empty: - xsize 755 - -style dark_game_menu_content_frame is dark_gui_frame: - take game_menu_content_frame - -style light_game_menu_content_frame is light_gui_frame: - take game_menu_content_frame - -style game_menu_viewport is gui_viewport - -style game_menu_scrollbar is gui_vscrollbar - -style game_menu_vscrollbar: - unscrollable gui.unscrollable - -style game_menu_side is gui_side: - spacing 9 - -style game_menu_label is gui_label: - xpos 50 - ysize 100 - -style game_menu_label_text is gui_label_text: - color gui.accent_color - size 42 - yalign 0.5 - -# Navigation screen -# -# This screen is included in the main and game menus, and provides navigation -# to other menus, and to start the game. - screen navigation_main_menu(title=None): default show_quick_start = False @@ -357,16 +229,16 @@ screen navigation(): textbutton "General" action SetLocalVariable("subcategory", "general") at navigation_tabs textbutton "Display" action SetLocalVariable("subcategory", "display") at navigation_tabs textbutton "Audio" action SetLocalVariable("subcategory", "audio") at navigation_tabs - textbutton "Other" action SetLocalVariable("subcategory", "accessibility") at navigation_tabs + textbutton "Other" action SetLocalVariable("subcategory", "other") at navigation_tabs if subcategory == "audio": - use preferences_sound - elif subcategory == "accessibility": - use preferences_accessibility + use settings_audio + elif subcategory == "other": + use settings_other elif subcategory == "display": - use preferences_visuals + use settings_display elif subcategory == "general": - use preferences_general + use settings_general transform navigation_tabs: subpixel True @@ -397,13 +269,6 @@ transform navigation_hide: 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) diff --git a/game/scripts/gui/save_files.rpy b/game/scripts/gui/save_files.rpy deleted file mode 100644 index 55a4f650..00000000 --- a/game/scripts/gui/save_files.rpy +++ /dev/null @@ -1,318 +0,0 @@ -# -# Load/save screens -# -# These screens are responsible for letting the player save the game and load -# it again. Since they share nearly everything in common, both are implemented -# in terms of a third screen, file_slots. -# -# https://www.renpy.org/doc/html/screen_special.html#save -# https://www.renpy.org/doc/html/screen_special.html#load - -init offset = -1 - -screen save(): - use navigation - use file_slots(_("Save")) - - -screen load(): - use navigation - use file_slots(_("Load")) - - -screen file_slots(title): - default page_name = FilePageNameInputValue(pattern=_("Page {}"), auto=_("Auto Saves"), quick=_("Quick Saves")) - default time_format = "{#file_time}%#d %B, %Y, %#H:%M" if renpy.windows else "{#file_time}%-d %B, %Y, %-H:%M" - default slot_rotations = [renpy.random.randint(-5, 5) for i in range(1, 14)] - - frame style "navigation_page_left": - vbox: - button: - style "navigation_label" - action page_name.Toggle() - input: - style "navigation_label_text" - value page_name - - # Grid breaks as soon as we rotate displaybles, so we have to use our own calculations. /shrugs - # grid 2 3: - - frame style "empty": - for i in range(1, 7): - button: - style "navigation_note" - at note_hover(slot_rotations[i]) - xysize (150, 140) - xpos ((i-1) % 2) * 160 - ypos ((i-1) // 2) * 140 - - if FileLoadable(i): - add At(FileScreenshot(i), file_hover) xysize (135, 75) xalign 0.5 ypos 16 - else: - add "#C69D65" xysize (135, 75) xalign 0.5 ypos 16 - - if not FileCompatible(i) and title == "Load": - action Confirm(gui.SAVE_INCOMPATIBLE_WARNING, FileLoad(i)) - elif title == "Load": - action FileLoad(i) - else: - action FileSave(i) - - # FileSaveName sometimes returns an empty string regardless of 'empty' parameter. /shrugs - $ file_name = (FileSaveName(i) or f"Slot {i}") - text "[file_name]" style "file_description_text" ypos 2 - - vbox style "file_vbox": - ypos 100 - xalign 0.5 - text FileTime(i, format=time_format) style "file_description_text" - if FileLoadable(i): - $ playtime = FileJson(i, "playtime", missing=0) - $ minutes, seconds = divmod(int(playtime), 60) - $ hours, minutes = divmod(minutes, 60) - text f"Playtime: {hours}H {minutes}M {seconds}S" style "file_description_text" - - - frame style "navigation_page_right": - vbox: - null height 38 - # button: - # style "navigation_label" - # action page_name.Toggle() - # input: - # style "navigation_label_text" - # value page_name - - frame style "empty": - for i in range(7, 13): - button: - style "navigation_note" - at note_hover(slot_rotations[i]) - xysize (150, 140) - xpos ((i-7) % 2) * 160 - ypos ((i-7) // 2) * 140 - - if FileLoadable(i): - add At(FileScreenshot(i), file_hover) xysize (135, 75) xalign 0.5 ypos 16 - else: - add "#C69D65" xysize (135, 75) xalign 0.5 ypos 16 - - if not FileCompatible(i) and title == "Load": - action Confirm(gui.SAVE_INCOMPATIBLE_WARNING, FileLoad(i)) - elif title == "Load": - action FileLoad(i) - else: - action FileSave(i) - - # FileSaveName sometimes returns an empty string regardless of 'empty' parameter. /shrugs - $ file_name = (FileSaveName(i) or f"Slot {i}") - text "[file_name]" style "file_description_text" ypos 2 - - vbox style "file_vbox": - ypos 100 - xalign 0.5 - text FileTime(i, format=time_format) style "file_description_text" - if FileLoadable(i): - $ playtime = FileJson(i, "playtime", missing=0) - $ minutes, seconds = divmod(int(playtime), 60) - $ hours, minutes = divmod(minutes, 60) - text f"Playtime: {hours}H {minutes}M {seconds}S" style "file_description_text" - -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: - color "#ffffff" - -style file_description_text: - color "#000000" - size 10 - font gui.bold_font - xalign 0.5 - -style file_vbox is empty: - fit_first True - xfill False - yfill False - xsize 150 - spacing 0 - # pos (4, -16) - - # use game_menu(title): - - # fixed: - - # # This ensures the input will get the enter event before any of the buttons do - # order_reverse True - - # # The page name, which can be edited by clicking on a button - # button: - # style gui.theme("page_label") - - # key_events True - # xalign 0.5 - # action page_name.Toggle() - - # hbox: - # spacing 9 - # input: - # style gui.theme("page_label_text") - # value page_name - - # if page_name.editable: - # text "{size=-4}{font=[gui.glyph_font]}✎{/font}{/size}" - - # ## The grid of file slots. - # grid gui.file_slot_cols gui.file_slot_rows: - # style_prefix gui.theme("slot") - - # xalign 0.5 - # yalign 0.5 - - # spacing gui.slot_spacing - - # transpose True - - # for i in range(gui.file_slot_cols * gui.file_slot_rows): - - # $ slot = i + 1 - - # button: - # if not FileCompatible(slot) and title == "Load": - # action Confirm(gui.SAVE_INCOMPATIBLE_WARNING, FileAction(slot)) - # else: - # action FileAction(slot) - - # has fixed - - # if FileLoadable(slot): - # add FileScreenshot(slot) - - # vbox: - # style_prefix "slot_button" - # xpos config.thumbnail_width - # xsize gui.slot_width - config.thumbnail_width - gui.slot_height - # yalign 0.5 - - # if FileCompatible(slot): - # default slot_time_format = "{#file_time}%#d %B, %Y, %#H:%M" if renpy.windows else "{#file_time}%-d %B, %Y, %-H:%M" - # $ day = FileJson(slot, "day", missing="Unknown") - # $ playtime = FileJson(slot, "playtime", missing=0) - # $ minutes, seconds = divmod(int(playtime), 60) - # $ hours, minutes = divmod(minutes, 60) - - # text FileTime(slot, format=slot_time_format) - # text f"Day: {day}" - # text f"Playtime: {hours}H {minutes}M {seconds}S" - # else: - # text "INCOMPATIBLE VERSION" color "#f00" - - # textbutton "{font=[gui.glyph_font]}✘{/font}": - # style "slot_delete_button" - # action FileDelete(slot) - - # key "save_delete" action FileDelete(slot) - # else: - # text f"Empty Slot {FileSlotName(slot, gui.file_slot_cols * gui.file_slot_rows)}." style "slot_button_text" - - # ## Buttons to access other pages. - # hbox: - # style_prefix gui.theme("page") - - # align (0.5, 1.0) - # yoffset 8 - - # spacing gui.page_spacing - - # textbutton _("<") action FilePagePrevious() - - # if config.has_autosave: - # textbutton _("{#auto_page}A") action FilePage("auto") keysym "K_a" - - # if config.has_quicksave: - # textbutton _("{#quick_page}Q") action FilePage("quick") keysym "K_q" - - - # $ page_modifier = max(0, int(FilePageName(str(page_modifier+9), str(page_modifier+9)))-9) - - # for page in range(1+page_modifier, 10+page_modifier): - # textbutton "[page]": - # xminimum 40 - # action FilePage(page) - # if page < 10: - # keysym f"K_{page}" - - # textbutton _(">") action FilePageNext() - - # key ["mousedown_4", "K_RIGHT", "repeat_K_RIGHT"] action FilePageNext() - # key ["mousedown_5", "K_LEFT", "repeat_K_LEFT"] action FilePagePrevious() - - -# style page_label is gui_label - -# style page_label_text is gui_label_text: -# text_align 0.5 -# layout "subtitle" -# hover_color gui.hover_color - -# style dark_page_label_text is dark_label_text: -# take page_label_text - -# style light_page_label_text is light_label_text: -# take page_label_text - -# style page_button is gui_button: -# background None -# padding (9, 4, 9, 4) - -# style page_button_text is gui_button_text: -# size 20 -# xalign 0.5 - -# style slot_button is gui_button: -# # background gui.muted_color -# xsize gui.slot_width -# ysize gui.slot_height+4 -# padding (2, 2, 2, 2) - -# style dark_slot_button: -# take dark_gui_frame -# insensitive_background Fixed(Transform(Frame("gui/dark_frame.png", 8, 8)), "#00000040") - -# style light_slot_button: -# take light_gui_frame -# insensitive_background Fixed(Transform(Frame("gui/light_frame.png", 8, 8)), "#00000040") - -# style slot_button_text is gui_button_text: -# size 14 -# xalign 0.5 -# text_align 0.5 -# idle_color gui.idle_small_color -# selected_idle_color gui.selected_color -# selected_hover_color gui.hover_color - -# style slot_delete_button is gui_button: -# background None -# idle_background None -# xsize gui.slot_height -# ysize gui.slot_height -# xalign 1.0 - -# style slot_delete_button_text is slot_button_text: -# size 24 diff --git a/game/scripts/gui/saves.rpy b/game/scripts/gui/saves.rpy new file mode 100644 index 00000000..65225d9f --- /dev/null +++ b/game/scripts/gui/saves.rpy @@ -0,0 +1,142 @@ +init offset = -1 + +screen save(): + use navigation + use file_slots(_("Save")) + +screen load(): + use navigation + use file_slots(_("Load")) + +screen file_slots(title): + default page_name = FilePageNameInputValue(pattern=_("Page {}"), auto=_("Auto Saves"), quick=_("Quick Saves")) + default time_format = "{#file_time}%#d %B, %Y, %#H:%M" if renpy.windows else "{#file_time}%-d %B, %Y, %-H:%M" + default slot_rotations = [renpy.random.randint(-5, 5) for i in range(1, 14)] + + frame style "navigation_page_left": + vbox: + button: + style "navigation_label" + action page_name.Toggle() + input: + style "navigation_label_text" + value page_name + + # Grid breaks as soon as we rotate displaybles, so we have to use our own calculations. /shrugs + # grid 2 3: + + frame style "empty": + for i in range(1, 7): + button: + style "navigation_note" + at note_hover(slot_rotations[i]) + xysize (150, 140) + xpos ((i-1) % 2) * 160 + ypos ((i-1) // 2) * 140 + + if FileLoadable(i): + add At(FileScreenshot(i), file_hover) xysize (135, 75) xalign 0.5 ypos 16 + else: + add "#C69D65" xysize (135, 75) xalign 0.5 ypos 16 + + if not FileCompatible(i) and title == "Load": + action Confirm(gui.SAVE_INCOMPATIBLE_WARNING, FileLoad(i)) + elif title == "Load": + action FileLoad(i) + else: + action FileSave(i) + + # FileSaveName sometimes returns an empty string regardless of 'empty' parameter. /shrugs + $ file_name = (FileSaveName(i) or f"Slot {i}") + text "[file_name]" style "file_description_text" ypos 2 + + vbox style "file_vbox": + ypos 100 + xalign 0.5 + text FileTime(i, format=time_format) style "file_description_text" + if FileLoadable(i): + $ playtime = FileJson(i, "playtime", missing=0) + $ minutes, seconds = divmod(int(playtime), 60) + $ hours, minutes = divmod(minutes, 60) + text f"Playtime: {hours}H {minutes}M {seconds}S" style "file_description_text" + + + frame style "navigation_page_right": + vbox: + null height 38 + # button: + # style "navigation_label" + # action page_name.Toggle() + # input: + # style "navigation_label_text" + # value page_name + + frame style "empty": + for i in range(7, 13): + button: + style "navigation_note" + at note_hover(slot_rotations[i]) + xysize (150, 140) + xpos ((i-7) % 2) * 160 + ypos ((i-7) // 2) * 140 + + if FileLoadable(i): + add At(FileScreenshot(i), file_hover) xysize (135, 75) xalign 0.5 ypos 16 + else: + add "#C69D65" xysize (135, 75) xalign 0.5 ypos 16 + + if not FileCompatible(i) and title == "Load": + action Confirm(gui.SAVE_INCOMPATIBLE_WARNING, FileLoad(i)) + elif title == "Load": + action FileLoad(i) + else: + action FileSave(i) + + # FileSaveName sometimes returns an empty string regardless of 'empty' parameter. /shrugs + $ file_name = (FileSaveName(i) or f"Slot {i}") + text "[file_name]" style "file_description_text" ypos 2 + + vbox style "file_vbox": + ypos 100 + xalign 0.5 + text FileTime(i, format=time_format) style "file_description_text" + if FileLoadable(i): + $ playtime = FileJson(i, "playtime", missing=0) + $ minutes, seconds = divmod(int(playtime), 60) + $ hours, minutes = divmod(minutes, 60) + text f"Playtime: {hours}H {minutes}M {seconds}S" style "file_description_text" + +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: + color "#ffffff" + +style file_description_text: + color "#000000" + size 10 + font gui.bold_font + xalign 0.5 + +style file_vbox is empty: + fit_first True + xfill False + yfill False + xsize 150 + spacing 0 diff --git a/game/scripts/gui/preferences.rpy b/game/scripts/gui/settings.rpy similarity index 69% rename from game/scripts/gui/preferences.rpy rename to game/scripts/gui/settings.rpy index 6be28a59..553fffda 100644 --- a/game/scripts/gui/preferences.rpy +++ b/game/scripts/gui/settings.rpy @@ -1,54 +1,6 @@ -# -# Preferences screen -# -# The preferences screen allows the player to configure the game to better suit -# themselves. -# -# https://www.renpy.org/doc/html/screen_special.html#preferences - init offset = -1 -screen preferences(page="general"): - tag menu - - use game_menu(_("Preferences"), scroll="viewport"): - style_prefix gui.theme("pref") - - vbox: - spacing gui.pref_spacing - null # Tab margin - - if page == "general": - use preferences_general - elif page == "visuals": - use preferences_visuals - elif page == "sound": - use preferences_sound - elif page == "accessibility": - use preferences_accessibility - - hbox: - style_prefix gui.theme("tab") - pos (25 + 15, 100) - yanchor 0.5 - - textbutton "General": - selected (page == "general") - action Show("preferences", config.intra_transition, "general") - - textbutton "Visuals": - selected (page == "visuals") - action Show("preferences", config.intra_transition, "visuals") - - textbutton "Sound": - selected (page == "sound") - action Show("preferences", config.intra_transition, "sound") - - textbutton "Accessibility": - selected (page == "accessibility") - action Show("preferences", config.intra_transition, "accessibility") - -screen preferences_general(): +screen settings_general(): frame style "navigation_page_left": vbox: label _("General") @@ -82,7 +34,7 @@ screen preferences_general(): else: add "doodle_hermione2" align (0.5, 0.5) -screen preferences_visuals(): +screen settings_display(): frame style "navigation_page_left": vbox: label _("Display") @@ -129,7 +81,7 @@ screen preferences_visuals(): add "doodle_snitch" align (0.5, 0.1) add "doodle_panties" align (0.5, 0.7) -screen preferences_sound(): +screen settings_audio(): frame style "navigation_page_left": vbox: label _("Audio") @@ -161,7 +113,7 @@ screen preferences_sound(): frame style "navigation_page_right": add "doodle_letter" align (0.5, 0.5) -screen preferences_accessibility(): +screen settings_other(): frame style "navigation_page_left": vbox: label _("Other") @@ -255,115 +207,8 @@ init python: preferences.renderer = s if s in ("gl2", "angle2") else "auto" renpy.quit(relaunch=True) -# style mute_all_button is check_button -# style mute_all_button_text is check_button_text - -# # Preference - -# style pref_label is gui_label: -# top_margin gui.pref_spacing -# bottom_margin 2 - -# style pref_label_text is gui_label_text: -# yalign 1.0 - -# style dark_pref_label_text is dark_label_text -# style light_pref_label_text is light_label_text - -# style pref_button is gui_button: -# padding (18, 4, 4, 4) - -# style pref_button_text is gui_button_text - -# style pref_vbox is vbox: -# xminimum (245 - 30 - 60) / 2 - -# style pref_hbox: -# spacing 30 -# box_wrap_spacing 2 * gui.pref_spacing - -# # Radio button - -# style radio_label is pref_label -# style radio_label_text is pref_label_text -# style dark_radio_label_text is dark_pref_label_text -# style light_radio_label_text is light_pref_label_text - -# style radio_vbox is pref_vbox: -# spacing gui.pref_button_spacing - -# style radio_button is gui_button: -# background None -# padding (18, 4, 4, 4) - -# style dark_radio_button is dark_gui_button: -# take radio_button -# foreground "dark_radio_false" -# selected_foreground "dark_radio_true" -# insensitive_foreground "dark_radio_none" - -# style light_radio_button is light_gui_button: -# take radio_button -# foreground "light_radio_false" -# selected_foreground "light_radio_true" -# insensitive_foreground "light_radio_none" - -# style radio_button_text is gui_button_text: -# first_indent 6 - -# # Check button - -# style check_label is pref_label -# style check_label_text is pref_label_text -# style dark_check_label_text is dark_pref_label_text -# style light_check_label_text is light_pref_label_text - -# style check_vbox is pref_vbox: -# spacing gui.pref_button_spacing - -# style check_button is gui_button: -# background None -# padding (18, 4, 4, 4) - -# style dark_check_button is dark_gui_button: -# take check_button -# foreground "dark_check_false" -# selected_foreground "dark_check_true" -# insensitive_foreground "dark_check_none" - -# style light_check_button is light_gui_button: -# take check_button -# foreground "light_check_false" -# selected_foreground "light_check_true" -# insensitive_foreground "light_check_none" - -# style check_button_text is gui_button_text: -# first_indent 6 - -# # Slider - -# style slider_label is pref_label -# style slider_label_text is pref_label_text -# style dark_slider_label_text is dark_pref_label_text -# style light_slider_label_text is light_pref_label_text - -# style slider_slider is gui_slider: -# xsize 320 - -# style dark_slider_slider is dark_slider -# style light_slider_slider is light_slider - -# style slider_button is gui_button: -# background None -# yalign 0.5 -# left_margin 9 - -# style slider_button_text is gui_button_text - -# style slider_vbox is pref_vbox: -# xsize 320 - screen _self_voicing(): + layer "interface" zorder 1500 if _preferences.self_voicing == "clipboard": diff --git a/game/scripts/utility/updater.rpy b/game/scripts/utility/updater.rpy index 6196d493..0b79c59d 100644 --- a/game/scripts/utility/updater.rpy +++ b/game/scripts/utility/updater.rpy @@ -346,64 +346,64 @@ screen updater: default msg = renpy.random.choice(update_message_list) default logo = version_logo() - use game_menu(_("Updater"), scroll="viewport"): + # use game_menu(_("Updater"), scroll="viewport"): - style_prefix "updater" + # style_prefix "updater" - vbox: - spacing gui.pref_spacing - xfill True + # vbox: + # spacing gui.pref_spacing + # xfill True - button: - xalign 0.5 - action OpenURL("https://www.silverstudiogames.org/") - add logo xysize(570, 324) + # button: + # xalign 0.5 + # action OpenURL("https://www.silverstudiogames.org/") + # add logo xysize(570, 324) - if u.state == u.ERROR: - text _("An error has occured:") - elif u.state == u.CHECKING: - text _("Fetching for updates.") - elif u.state == u.UPDATE_NOT_AVAILABLE: - text _("This program is up to date.") - elif u.state == u.UPDATE_AVAILABLE: - text _("[u.version] is available. Do you want to install it?") - hbox: - xalign 0.5 + # if u.state == u.ERROR: + # text _("An error has occured:") + # elif u.state == u.CHECKING: + # text _("Fetching for updates.") + # elif u.state == u.UPDATE_NOT_AVAILABLE: + # text _("This program is up to date.") + # elif u.state == u.UPDATE_AVAILABLE: + # text _("[u.version] is available. Do you want to install it?") + # hbox: + # xalign 0.5 - textbutton "Changelog" action OpenURL("https://www.silverstudiogames.org/p/changelog.html") - textbutton "Patreon" action OpenURL("https://patreon.com/silverstudiogames") - textbutton "Discord" action OpenURL("https://discord.gg/UbQeTCJ5RW") - elif u.state == u.PREPARING: - text _("Preparing to download the updates.") - elif u.state == u.DOWNLOADING: - text _("Downloading the updates.") - elif u.state == u.UNPACKING: - text _("Unpacking the updates.") - elif u.state == u.FINISHING: - text _("Finishing up.") - elif u.state == u.DONE: - text _("The updates have been installed. The program will restart.") - elif u.state == u.DONE_NO_RESTART: - text _("The updates have been installed.") - elif u.state == u.CANCELLED: - text _("The updates were cancelled.") + # textbutton "Changelog" action OpenURL("https://www.silverstudiogames.org/p/changelog.html") + # textbutton "Patreon" action OpenURL("https://patreon.com/silverstudiogames") + # textbutton "Discord" action OpenURL("https://discord.gg/UbQeTCJ5RW") + # elif u.state == u.PREPARING: + # text _("Preparing to download the updates.") + # elif u.state == u.DOWNLOADING: + # text _("Downloading the updates.") + # elif u.state == u.UNPACKING: + # text _("Unpacking the updates.") + # elif u.state == u.FINISHING: + # text _("Finishing up.") + # elif u.state == u.DONE: + # text _("The updates have been installed. The program will restart.") + # elif u.state == u.DONE_NO_RESTART: + # text _("The updates have been installed.") + # elif u.state == u.CANCELLED: + # text _("The updates were cancelled.") - if u.message is not None: - text "[u.message!q]" + # if u.message is not None: + # text "[u.message!q]" - if u.progress is not None: - fixed: - bar value (u.progress or 0.0) range 1.0 style "updater_bar" - text "[msg]" color "#fff" size 10 yoffset 5 + # if u.progress is not None: + # fixed: + # bar value (u.progress or 0.0) range 1.0 style "updater_bar" + # text "[msg]" color "#fff" size 10 yoffset 5 - hbox: - xalign 0.5 + # hbox: + # xalign 0.5 - if u.can_proceed: - textbutton _("Proceed") action u.proceed keysym "K_RETURN" + # if u.can_proceed: + # textbutton _("Proceed") action u.proceed keysym "K_RETURN" - if u.can_cancel: - textbutton _("Cancel") action u.cancel keysym "K_ESCAPE" + # if u.can_cancel: + # textbutton _("Cancel") action u.cancel keysym "K_ESCAPE" timer 2.0 action SetScreenVariable("msg", renpy.random.choice(update_message_list)) repeat True