@@ -283,16 +283,55 @@ private IEnumerator PlayAudioClip(string p_File)
283283 ////////////////////////////////////////////////////////////////////////////
284284
285285 public class Misc_WaitMenuScene
286- : Interfaces . IAction < Misc_WaitMenuScene , Models . Action >
286+ : Interfaces . IAction < Misc_WaitMenuScene , Models . Actions . WaitMenuScene >
287287 {
288+ private XUIToggle m_PreventNextActionsFailure = null ;
289+
290+ ////////////////////////////////////////////////////////////////////////////
291+ ////////////////////////////////////////////////////////////////////////////
292+
288293 public override string Description => "Wait for menu scene" ;
289- public override string UIPlaceHolder => "Wait for menu scene" ;
294+
295+ ////////////////////////////////////////////////////////////////////////////
296+ ////////////////////////////////////////////////////////////////////////////
297+
298+ public override void BuildUI ( Transform p_Parent )
299+ {
300+ XUIElements = new IXUIElement [ ]
301+ {
302+ Templates . SettingsHGroup ( "Prevent next actions failure" ,
303+ XUIToggle . Make ( )
304+ . SetValue ( Model . PreventNextActionFailure )
305+ . OnValueChanged ( ( _ ) => OnSettingChanged ( ) )
306+ . Bind ( ref m_PreventNextActionsFailure )
307+ ) ,
308+
309+ XUIVLayout . Make (
310+ XUIText . Make ( "This actions will delay next actions execution" ) ,
311+ XUIText . Make ( "until we reach the menu scene" )
312+ )
313+ . SetBackground ( true ) ,
314+ } ;
315+
316+ BuildUIAuto ( p_Parent ) ;
317+ }
318+
319+ ////////////////////////////////////////////////////////////////////////////
320+ ////////////////////////////////////////////////////////////////////////////
321+
322+ private void OnSettingChanged ( )
323+ {
324+ Model . PreventNextActionFailure = m_PreventNextActionsFailure . Element . GetValue ( ) ;
325+ }
290326
291327 ////////////////////////////////////////////////////////////////////////////
292328 ////////////////////////////////////////////////////////////////////////////
293329
294330 public override IEnumerator Eval ( EventContext p_Context )
295331 {
332+ if ( Model . PreventNextActionFailure )
333+ p_Context . PreventNextActionFailure = true ;
334+
296335 yield return new WaitUntil ( ( ) => CP_SDK . ChatPlexSDK . ActiveGenericScene == CP_SDK . ChatPlexSDK . EGenericScene . Menu ) ;
297336 }
298337 }
@@ -301,16 +340,56 @@ public override IEnumerator Eval(EventContext p_Context)
301340 ////////////////////////////////////////////////////////////////////////////
302341
303342 public class Misc_WaitPlayingScene
304- : Interfaces . IAction < Misc_WaitPlayingScene , Models . Action >
343+ : Interfaces . IAction < Misc_WaitPlayingScene , Models . Actions . WaitPlayingScene >
305344 {
345+ private XUIToggle m_PreventNextActionsFailure = null ;
346+
347+ ////////////////////////////////////////////////////////////////////////////
348+ ////////////////////////////////////////////////////////////////////////////
349+
306350 public override string Description => "Wait for playing scene" ;
307351 public override string UIPlaceHolder => "Wait for playing scene" ;
308352
309353 ////////////////////////////////////////////////////////////////////////////
310354 ////////////////////////////////////////////////////////////////////////////
311355
356+ public override void BuildUI ( Transform p_Parent )
357+ {
358+ XUIElements = new IXUIElement [ ]
359+ {
360+ Templates . SettingsHGroup ( "Prevent next actions failure" ,
361+ XUIToggle . Make ( )
362+ . SetValue ( Model . PreventNextActionFailure )
363+ . OnValueChanged ( ( _ ) => OnSettingChanged ( ) )
364+ . Bind ( ref m_PreventNextActionsFailure )
365+ ) ,
366+
367+ XUIVLayout . Make (
368+ XUIText . Make ( "This actions will delay next actions execution" ) ,
369+ XUIText . Make ( "until we reach the playing scene" )
370+ )
371+ . SetBackground ( true ) ,
372+ } ;
373+
374+ BuildUIAuto ( p_Parent ) ;
375+ }
376+
377+ ////////////////////////////////////////////////////////////////////////////
378+ ////////////////////////////////////////////////////////////////////////////
379+
380+ private void OnSettingChanged ( )
381+ {
382+ Model . PreventNextActionFailure = m_PreventNextActionsFailure . Element . GetValue ( ) ;
383+ }
384+
385+ ////////////////////////////////////////////////////////////////////////////
386+ ////////////////////////////////////////////////////////////////////////////
387+
312388 public override IEnumerator Eval ( EventContext p_Context )
313389 {
390+ if ( Model . PreventNextActionFailure )
391+ p_Context . PreventNextActionFailure = true ;
392+
314393 yield return new WaitUntil ( ( ) => CP_SDK . ChatPlexSDK . ActiveGenericScene == CP_SDK . ChatPlexSDK . EGenericScene . Playing ) ;
315394 }
316395 }
0 commit comments