1
1
using System ;
2
- using System . Collections ;
3
2
using System . Collections . Generic ;
4
3
using System . Linq ;
5
4
using System . Reflection ;
5
+ using System . Threading . Tasks ;
6
6
using BeatSaberMarkupLanguage . Attributes ;
7
7
using BeatSaberMarkupLanguage . Components ;
8
8
using BeatSaberMarkupLanguage . Util ;
@@ -20,9 +20,8 @@ public class GameplaySetup : ZenjectSingleton<GameplaySetup>, TableView.IDataSou
20
20
private readonly MainFlowCoordinator mainFlowCoordinator ;
21
21
private readonly GameplaySetupViewController gameplaySetupViewController ;
22
22
private readonly HierarchyManager hierarchyManager ;
23
- private readonly ICoroutineStarter coroutineStarter ;
24
23
25
- private Coroutine debounceCoroutine ;
24
+ private Task debounceTask ;
26
25
27
26
[ UIObject ( "root-object" ) ]
28
27
private GameObject rootObject ;
@@ -48,12 +47,11 @@ public class GameplaySetup : ZenjectSingleton<GameplaySetup>, TableView.IDataSou
48
47
[ UIValue ( "mod-menus" ) ]
49
48
private SortedList < GameplaySetupMenu > menus = new ( Comparer < GameplaySetupMenu > . Create ( ( a , b ) => a . Name . CompareTo ( b . Name ) ) ) ;
50
49
51
- private GameplaySetup ( MainFlowCoordinator mainFlowCoordinator , GameplaySetupViewController gameplaySetupViewController , HierarchyManager hierarchyManager , ICoroutineStarter coroutineStarter )
50
+ private GameplaySetup ( MainFlowCoordinator mainFlowCoordinator , GameplaySetupViewController gameplaySetupViewController , HierarchyManager hierarchyManager )
52
51
{
53
52
this . mainFlowCoordinator = mainFlowCoordinator ;
54
53
this . gameplaySetupViewController = gameplaySetupViewController ;
55
54
this . hierarchyManager = hierarchyManager ;
56
- this . coroutineStarter = coroutineStarter ;
57
55
}
58
56
59
57
[ UIValue ( "has-menus" ) ]
@@ -143,14 +141,14 @@ public void Dispose()
143
141
144
142
private void QueueRefreshView ( )
145
143
{
146
- debounceCoroutine ??= coroutineStarter . StartCoroutine ( RefreshViewCoroutine ( ) ) ;
144
+ debounceTask ??= RefreshViewCoroutine ( ) ;
147
145
}
148
146
149
- private IEnumerator RefreshViewCoroutine ( )
147
+ private async Task RefreshViewCoroutine ( )
150
148
{
151
- yield return new WaitForEndOfFrame ( ) ;
149
+ await Task . Yield ( ) ; // wait for next frame
152
150
RefreshView ( ) ;
153
- debounceCoroutine = null ;
151
+ debounceTask = null ;
154
152
}
155
153
156
154
private void RefreshView ( )
0 commit comments