File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed
FailButton/HarmonyPatches Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -17,10 +17,11 @@ static class AddButtonToPauseMenu
1717
1818 static void Postfix ( PauseMenuManager __instance )
1919 {
20- __instance . StartCoroutine ( DoTheFunny ( __instance ) ) ;
20+ var gameplayManager = Resources . FindObjectsOfTypeAll < StandardLevelGameplayManager > ( ) . FirstOrDefault ( ) ;
21+ if ( gameplayManager != null ) __instance . StartCoroutine ( DoTheFunny ( __instance , gameplayManager ) ) ;
2122 }
2223
23- static IEnumerator DoTheFunny ( PauseMenuManager __instance )
24+ static IEnumerator DoTheFunny ( PauseMenuManager __instance , StandardLevelGameplayManager gameplayManager )
2425 {
2526 if ( _b != null )
2627 yield break ;
@@ -52,13 +53,8 @@ static IEnumerator DoTheFunny(PauseMenuManager __instance)
5253
5354 b . onClick . AddListener ( ( ) =>
5455 {
55- var s = Resources . FindObjectsOfTypeAll < StandardLevelGameplayManager > ( ) . FirstOrDefault ( ) ;
56-
57- if ( s == null )
58- return ;
59-
60- s . _initData . SetField ( nameof ( s . _initData . continueGameplayWith0Energy ) , false ) ;
61- s . HandleGameEnergyDidReach0 ( ) ;
56+ gameplayManager . _initData . SetField ( nameof ( gameplayManager . _initData . continueGameplayWith0Energy ) , false ) ;
57+ gameplayManager . HandleGameEnergyDidReach0 ( ) ;
6258 } ) ;
6359
6460 yield return null ;
You can’t perform that action at this time.
0 commit comments