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
17
17
18
18
static void Postfix ( PauseMenuManager __instance )
19
19
{
20
- __instance . StartCoroutine ( DoTheFunny ( __instance ) ) ;
20
+ var gameplayManager = Resources . FindObjectsOfTypeAll < StandardLevelGameplayManager > ( ) . FirstOrDefault ( ) ;
21
+ if ( gameplayManager != null ) __instance . StartCoroutine ( DoTheFunny ( __instance , gameplayManager ) ) ;
21
22
}
22
23
23
- static IEnumerator DoTheFunny ( PauseMenuManager __instance )
24
+ static IEnumerator DoTheFunny ( PauseMenuManager __instance , StandardLevelGameplayManager gameplayManager )
24
25
{
25
26
if ( _b != null )
26
27
yield break ;
@@ -52,13 +53,8 @@ static IEnumerator DoTheFunny(PauseMenuManager __instance)
52
53
53
54
b . onClick . AddListener ( ( ) =>
54
55
{
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 ( ) ;
62
58
} ) ;
63
59
64
60
yield return null ;
You can’t perform that action at this time.
0 commit comments