@@ -275,6 +275,47 @@ class Script {
275275 return true ;
276276 }
277277
278+ ShowMessage ( options , ...messages ) {
279+ const popup = new Popup ( {
280+ title : options . title ?? "Counter-Strike 2 Script Message" ,
281+ simpleMode : true ,
282+ popoverMode : true ,
283+ fade : false ,
284+ body : [
285+ CreateElement ( "div" , {
286+ class : "cs2s_action_body" ,
287+ children : [
288+ CreateElement ( "div" , {
289+ class : "cs2s_action_message_tall cs2s_action_multi_message" ,
290+ children : [
291+ ...messages . map ( message =>
292+ CreateElement ( "div" , {
293+ class : "cs2s_action_message" ,
294+ text : message
295+ } )
296+ )
297+ ]
298+ } ) ,
299+ CreateElement ( "div" , {
300+ class : "cs2s_action_buttons" ,
301+ children : [
302+ CreateElement ( "div" , {
303+ class : "cs2s_grey_long_button" ,
304+ text : "Close" ,
305+ onclick : ( ) => {
306+ popup . Hide ( ) ;
307+ }
308+ } )
309+ ]
310+ } )
311+ ]
312+ } )
313+ ]
314+ } ) ;
315+
316+ popup . Show ( ) ;
317+ }
318+
278319 ShowError ( options , ...errors ) {
279320 if ( ! this . #errorTableBody) {
280321 this . #errorTableBody = CreateElement ( "tbody" ) ;
@@ -305,44 +346,7 @@ class Script {
305346 }
306347
307348 if ( options . level === ERROR_LEVEL . HIGH ) {
308- const popup = new Popup ( {
309- title : "Counter-Strike 2 Script Error" ,
310- simpleMode : true ,
311- popoverMode : true ,
312- fade : false ,
313- body : [
314- CreateElement ( "div" , {
315- class : "cs2s_action_body" ,
316- children : [
317- CreateElement ( "div" , {
318- class : "cs2s_action_message_tall cs2s_action_multi_message" ,
319- children : [
320- ...errors . map ( error =>
321- CreateElement ( "div" , {
322- class : "cs2s_action_message" ,
323- text : error . message
324- } )
325- )
326- ]
327- } ) ,
328- CreateElement ( "div" , {
329- class : "cs2s_action_buttons" ,
330- children : [
331- CreateElement ( "div" , {
332- class : "cs2s_grey_long_button" ,
333- text : "Close" ,
334- onclick : ( ) => {
335- popup . Hide ( ) ;
336- }
337- } )
338- ]
339- } )
340- ]
341- } )
342- ]
343- } ) ;
344-
345- popup . Show ( ) ;
349+ this . ShowMessage ( { title : "Counter-Strike 2 Script Error" } , ...errors . map ( error => error . message ) ) ;
346350 } else if ( options . level === ERROR_LEVEL . MEDIUM ) {
347351 const globalNavigationButton = unsafeWindow . document . getElementById ( `account_pulldown` ) ;
348352 this . #navigationButton. classList . add ( "cs2s_navigation_status_error_glow" ) ;
0 commit comments