@@ -23,19 +23,13 @@ class ERewardPopup(IntEnum):
2323
2424__all__ : tuple [str , ...] = (
2525 "ERewardPopup" ,
26- "blocking_message_hide" ,
27- "blocking_message_show" ,
28- "contextual_prompt_hide" ,
29- "contextual_prompt_show" ,
30- "display_blocking_message" ,
31- "display_contextual_prompt" ,
32- "display_message" ,
33- "message_hide" ,
34- "message_show" ,
35- "show_big_notification" ,
26+ "display_button_prompt" ,
27+ "hide_button_prompt" ,
28+ "show_button_prompt" ,
29+ "show_discovery_message" ,
3630 "show_hud_message" ,
3731 "show_reward_popup" ,
38- "show_top_center_message " ,
32+ "show_second_wind_notification " ,
3933)
4034
4135
@@ -75,7 +69,7 @@ def show_hud_message(title: str, msg: str, duration: float = 2.5) -> None:
7569 )
7670
7771
78- def show_big_notification (
72+ def show_second_wind_notification (
7973 msg : str ,
8074 ui_sound : unreal .UObject | None | EllipsisType = ...,
8175) -> None :
@@ -84,24 +78,22 @@ def show_big_notification(
8478
8579 Uses the message style of the Second Wind notification.
8680
87- Note this message can only display up to 33 characters .
81+ Note this should not be used for critical messages, it may silently fail at any point .
8882
8983 Args:
9084 msg: The message to display.
9185 ui_sound: An optional AkEvent to play when the message is displayed.
92- If Ellipsis, default sound will be used.
86+ If Ellipsis, default sound will be used.
9387 """
9488 if (hud_movie := get_pc ().GetHUDMovie ()) is None :
9589 return
9690
9791 sound_backup = None
9892 sw_interaction = None
99- for gfx_movie in unrealsdk .find_all ("GearboxGFxMovie" , exact = False ):
100- for interaction in gfx_movie .InteractionOverrideSounds :
101- if interaction .Interaction == "SecondWind" :
102- sound_backup = interaction .AkEvent
103- sw_interaction = interaction
104- break
93+ for interaction in hud_movie .InteractionOverrideSounds :
94+ if interaction .Interaction == "SecondWind" :
95+ sound_backup = interaction .AkEvent
96+ sw_interaction = interaction
10597
10698 if ui_sound is not Ellipsis and sw_interaction :
10799 sw_interaction .AkEvent = ui_sound
@@ -114,21 +106,21 @@ def show_big_notification(
114106 sw_interaction .AkEvent = sound_backup
115107
116108
117- def show_top_center_message (msg : str , show_discovered_message : bool = False ) -> None :
109+ def show_discovery_message (msg : str , show_discovered_message : bool = False ) -> None :
118110 """
119111 Displays a message in the top center of the screen.
120112
121113 Uses the style of the new area discovered message.
122114
123- Note this message can only display up to 41 characters .
115+ Note this should not be used for critical messages, it may silently fail at any point .
124116
125117 Args:
126118 msg: The message to display.
127119 show_discovered_message: If True, the message 'You have discovered' header will show.
128120 """
129121 if (hud_movie := get_pc ().GetHUDMovie ()) is None :
130122 return
131- hud_movie .ShowWorldDiscovery ("" , " msg" , show_discovered_message , False )
123+ hud_movie .ShowWorldDiscovery ("" , msg , show_discovered_message , False )
132124
133125
134126def show_reward_popup (
@@ -138,7 +130,7 @@ def show_reward_popup(
138130 """
139131 Displays a reward popup with the given message and reward type.
140132
141- Note this message can only display up to 33 characters .
133+ Note this should not be used for critical messages, it may silently fail at any point .
142134
143135 Args:
144136 msg: The message to display in the popup.
@@ -160,136 +152,47 @@ def show_reward_popup(
160152 hud_movie .SetVariableString ("p1.badassToken.inner.dispText.text" , msg )
161153
162154
163- def contextual_prompt_show ( text : str , button_string : str ) -> None :
155+ def show_button_prompt ( reason : str , button : str ) -> None :
164156 """
165157 Displays a contextual prompt with the given text and button string.
166158
167- Note both text and button_string can each display up to 16 characters.
159+ This will stay visible until it is explicitly hidden, see `hide_contextual_prompt`.
160+
161+ Note this should not be used for critical messages, it may silently fail at any point.
168162
169163 Args:
170- text : The text top to display in the prompt.
171- button_string : The button string to display in the prompt.
164+ reason : The text top to display in the prompt.
165+ button : The button string to display in the prompt.
172166 """
173167
174168 if (hud_movie := get_pc ().GetHUDMovie ()) is None :
175169 return
176170 contextual_prompt = hud_movie .ContextualPromptButtonString
177- hud_movie .ContextualPromptButtonString = button_string
178- hud_movie .ToggleContextualPrompt (text , True )
171+ hud_movie .ContextualPromptButtonString = button
172+ hud_movie .ToggleContextualPrompt (reason , True )
179173 hud_movie .ContextualPromptButtonString = contextual_prompt
180174
181175
182- def contextual_prompt_hide () -> None :
176+ def hide_button_prompt () -> None :
183177 """Hides the currently displayed contextual prompt, if any."""
184178 if (hud_movie := get_pc ().GetHUDMovie ()) is None :
185179 return
186180 hud_movie .ToggleContextualPrompt ("" , False )
187181
188182
189183@contextmanager
190- def display_contextual_prompt ( text : str , button_string : str ) -> Iterator [None ]:
184+ def display_button_prompt ( reason : str , button : str ) -> Iterator [None ]:
191185 """
192186 Context manager to display and hide a contextual prompt.
193187
194188 This will display the prompt when entering the context and hide it when exiting.
195189
196190 Args:
197- text: The text to display in the prompt.
198- button_string: The button string to display in the prompt.
199- """
200- contextual_prompt_show (text , button_string )
201- try :
202- yield
203- finally :
204- contextual_prompt_hide ()
205-
206-
207- def blocking_message_show (msg : str , reason : str | None = None ) -> None :
208- """
209- Displays a blocking message with the given text.
210-
211- This message will block any input until it is hidden.
212-
213- Note this message has no character limit, but only scales horizontally.
214- Multiple lines will not be displayed correctly.
215-
216- Args:
217- msg: The message to display.
218- reason: An optional reason for the blocking message, which will be displayed as a subtitle.
219- If None, the default text will show.
220- """
221- if (msg_movie := get_pc ().GetOnlineMessageMovie ()) is None :
222- return
223-
224- backup = msg_movie .BlockingSubtitle
225- msg_movie .BlockingSubtitle = reason if reason is not None else backup
226- msg_movie .DisplayBlockingMessage (msg )
227- msg_movie .BlockingSubtitle = backup
228-
229-
230- def blocking_message_hide () -> None :
231- """Hides the currently displayed blocking message, if any."""
232- if (msg_movie := get_pc ().GetOnlineMessageMovie ()) is None :
233- return
234-
235- msg_movie .HideBlocking ()
236-
237-
238- @contextmanager
239- def display_blocking_message (msg : str , reason : str | None = None ) -> Iterator [None ]:
240- """
241- Context manager to display and hide a blocking message.
242-
243- This will display the message when entering the context and hide it when exiting.
244-
245- Args:
246- msg: The message to display.
247- reason: An optional reason for the blocking message, which will be displayed as a subtitle.
248- If None, the default text will show.
249- """
250- blocking_message_show (msg , reason )
251- try :
252- yield
253- finally :
254- blocking_message_hide ()
255-
256-
257- def message_show (msg : str ) -> None :
258- """
259- Displays a message on the left side of the screen.
260-
261- Note this message has no character limit, but only scales horizontally.
262- Multiple lines will not be displayed correctly.
263-
264- Args:
265- msg: The message to display.
266- """
267- if (msg_movie := get_pc ().GetOnlineMessageMovie ()) is None :
268- return
269-
270- msg_movie .DisplayMessage (msg )
271-
272-
273- def message_hide () -> None :
274- """Hides the currently displayed message in the online message movie."""
275- if (msg_movie := get_pc ().GetOnlineMessageMovie ()) is None :
276- return
277-
278- msg_movie .Hide ()
279-
280-
281- @contextmanager
282- def display_message (msg : str ) -> Iterator [None ]:
283- """
284- Context manager to display and hide a message.
285-
286- This will display the message when entering the context and hide it when exiting.
287-
288- Args:
289- msg: The message to display.
191+ reason: The text to display in the prompt.
192+ button: The button string to display in the prompt.
290193 """
291- message_show ( msg )
194+ show_button_prompt ( reason , button )
292195 try :
293196 yield
294197 finally :
295- message_hide ()
198+ hide_button_prompt ()
0 commit comments