|
| 1 | +default persistent._gsm_use_talk_choice = False |
| 2 | + |
1 | 3 | init -990 python in mas_submod_utils: |
2 | 4 | Submod( |
3 | 5 | author="multimokia", |
4 | 6 | name="All Gen Scrollable Menus", |
5 | 7 | description="A submod which converts all menus to gen-scrollable-menus so Monika's face is never hidden.", |
6 | | - version="1.0.0", |
7 | | - version_updates={} |
| 8 | + version="1.0.1", |
| 9 | + version_updates=dict(), |
| 10 | + settings_pane="gsm_settings" |
8 | 11 | ) |
9 | 12 |
|
| 13 | +#START: Settings Pane |
| 14 | +screen gsm_settings(): |
| 15 | + vbox: |
| 16 | + box_wrap False |
| 17 | + xfill True |
| 18 | + xmaximum 1000 |
| 19 | + |
| 20 | + hbox: |
| 21 | + style_prefix "check" |
| 22 | + box_wrap False |
| 23 | + |
| 24 | + textbutton "Use Talk Choice Screen": |
| 25 | + action ToggleField(persistent, "_gsm_use_talk_choice") |
| 26 | + selected persistent._gsm_use_talk_choice |
| 27 | + |
| 28 | + |
10 | 29 | init 900 python: |
11 | 30 | def menu_override(items, set_expr): |
12 | 31 | """ |
@@ -47,38 +66,82 @@ init 900 python: |
47 | 66 | else: |
48 | 67 | set = None |
49 | 68 |
|
50 | | - #Convert items |
51 | | - formatted_menuitems = [ |
52 | | - (x[0], x[1], False, False) |
53 | | - for x in items |
54 | | - ] |
55 | | - |
56 | 69 | #Prep before showing the menu |
57 | 70 | renpy.show("monika", at_list=[t21]) |
58 | 71 |
|
59 | 72 | #Get last line |
60 | 73 | last_line = _history_list[-1].what |
61 | 74 |
|
| 75 | + #Handle the textbox show to keep the question up during the menu |
62 | 76 | if last_line.endswith("{nw}"): |
63 | 77 | renpy.say(m, last_line.replace("{nw}", "{fast}"), interact=False) |
64 | | - _history_list.pop() |
65 | 78 |
|
| 79 | + elif last_line.endswith("{fast}"): |
| 80 | + renpy.say(m, last_line, interact=False) |
| 81 | + |
| 82 | + #Otherwise no text, and we should hide the textbox instead |
66 | 83 | else: |
67 | 84 | _window_hide() |
68 | 85 |
|
69 | | - picked = renpy.call_screen( |
70 | | - "mas_gen_scrollable_menu", |
71 | | - items=formatted_menuitems, |
72 | | - display_area=store.mas_ui.SCROLLABLE_MENU_TXT_AREA, |
73 | | - scroll_align=store.mas_ui.SCROLLABLE_MENU_XALIGN |
74 | | - ) |
| 86 | + #If the user wishes to use the talk-choice menu, we'll need to parse the input accordingly |
| 87 | + if persistent._gsm_use_talk_choice: |
| 88 | + menu_items = list() |
| 89 | + |
| 90 | + #Get the location of the menu as MenuEntries need it |
| 91 | + location=renpy.game.context().current |
| 92 | + |
| 93 | + #And now make a formatted list of menu_items |
| 94 | + for (label, value) in items: |
| 95 | + if value is not None: |
| 96 | + action = renpy.ui.ChoiceReturn(label, value, location) |
| 97 | + chosen = action.get_chosen() |
| 98 | + |
| 99 | + else: |
| 100 | + action = None |
| 101 | + chosen = False |
| 102 | + |
| 103 | + if renpy.config.choice_screen_chosen: |
| 104 | + me = renpy.MenuEntry((label, action, chosen)) |
| 105 | + else: |
| 106 | + me = renpy.MenuEntry((label, action)) |
| 107 | + |
| 108 | + me.caption = label |
| 109 | + me.action = action |
| 110 | + me.chosen = chosen |
| 111 | + menu_items.append(me) |
| 112 | + |
| 113 | + #Then call the screen for it |
| 114 | + picked = renpy.call_screen( |
| 115 | + "talk_choice", |
| 116 | + items=menu_items |
| 117 | + ) |
| 118 | + |
| 119 | + #Otherwise, we use the gen scrollable menu |
| 120 | + else: |
| 121 | + #Convert items to the 4 part tuple |
| 122 | + formatted_menuitems = [ |
| 123 | + (x[0], x[1], False, False) |
| 124 | + for x in items |
| 125 | + ] |
| 126 | + |
| 127 | + #And show the screen |
| 128 | + picked = renpy.call_screen( |
| 129 | + "mas_gen_scrollable_menu", |
| 130 | + items=formatted_menuitems, |
| 131 | + display_area=store.mas_ui.SCROLLABLE_MENU_TXT_AREA, |
| 132 | + scroll_align=store.mas_ui.SCROLLABLE_MENU_XALIGN |
| 133 | + ) |
75 | 134 |
|
76 | 135 | #Reset Monika's position |
77 | 136 | renpy.show("monika", at_list=[t11]) |
78 | 137 |
|
79 | | - #And reset the window |
| 138 | + #Reset the window |
80 | 139 | _window_auto = True |
81 | 140 |
|
| 141 | + #And pop from hist |
| 142 | + if last_line.endswith("{fast}"): |
| 143 | + _history_list.pop() |
| 144 | + |
82 | 145 | #If we have a set, fill it in with the label of the chosen item. |
83 | 146 | if set is not None and picked is not None: |
84 | 147 | for label, value in items: |
|
0 commit comments