Commit c068b7f 1 parent 1711ac2 commit c068b7f Copy full SHA for c068b7f
File tree 1 file changed +33
-8
lines changed
1 file changed +33
-8
lines changed Original file line number Diff line number Diff line change 2
2
using System . Collections ;
3
3
using System . Collections . Generic ;
4
4
using HarmonyLib ;
5
+ using Nautilus . Extensions ;
6
+ using UnityEngine ;
5
7
6
8
namespace Nautilus . Patchers ;
7
9
@@ -64,17 +66,40 @@ internal static IEnumerator InvokeLoadEvents(IEnumerator enumerator)
64
66
{
65
67
yield return enumerator . Current ;
66
68
}
67
-
68
- OnFinishLoadingEvents ? . Invoke ( ) ;
69
-
70
- if ( oneTimeUseOnLoadEvents . Count > 0 )
69
+
70
+ #if SUBNAUTICA
71
+ OnLoad ( ) ;
72
+ #elif BELOWZERO
73
+ uGUI_MainMenu . main . StartCoroutine ( WaitUntilLoaded ( ) ) ;
74
+
75
+ IEnumerator WaitUntilLoaded ( )
71
76
{
72
- foreach ( Action action in oneTimeUseOnLoadEvents )
77
+ if ( uGUI . main . loading . isLoading )
73
78
{
74
- action . Invoke ( ) ;
79
+ yield return new WaitWhile ( ( ) => uGUI . main . loading . isLoading ) ;
80
+ }
81
+
82
+ if ( WaitScreen . main . Exists ( ) ? . isShown is true )
83
+ {
84
+ yield return new WaitWhile ( ( ) => WaitScreen . main . isShown ) ;
85
+ }
86
+
87
+ OnLoad ( ) ;
88
+ }
89
+ #endif
90
+ void OnLoad ( )
91
+ {
92
+ OnFinishLoadingEvents ? . Invoke ( ) ;
93
+
94
+ if ( oneTimeUseOnLoadEvents . Count > 0 )
95
+ {
96
+ foreach ( Action action in oneTimeUseOnLoadEvents )
97
+ {
98
+ action . Invoke ( ) ;
99
+ }
100
+
101
+ oneTimeUseOnLoadEvents . Clear ( ) ;
75
102
}
76
-
77
- oneTimeUseOnLoadEvents . Clear ( ) ;
78
103
}
79
104
}
80
105
You can’t perform that action at this time.
0 commit comments