com.puzzlescapegames.services 1.2.8 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
using Cysharp.Threading.Tasks;
|
|
2
2
|
using System;
|
|
3
3
|
using System.Linq;
|
|
4
|
+
using System.Threading;
|
|
4
5
|
using Object = UnityEngine.Object;
|
|
5
6
|
|
|
6
7
|
namespace PuzzlescapeGames.Services.UITransitionService
|
|
@@ -16,13 +17,39 @@ namespace PuzzlescapeGames.Services.UITransitionService
|
|
|
16
17
|
_settings = settings ?? throw new ArgumentNullException( nameof(settings) );
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
public async UniTask LoadThroughBlank(
|
|
20
|
+
public async UniTask LoadThroughBlank(
|
|
21
|
+
int index = 0,
|
|
22
|
+
Action onShowed = null,
|
|
23
|
+
Action onLoaded = null,
|
|
24
|
+
Action onHided = null,
|
|
25
|
+
CancellationToken cancellationToken = default,
|
|
26
|
+
params UniTask[] tasks
|
|
27
|
+
)
|
|
28
|
+
{
|
|
29
|
+
await LoadThroughBlank( _settings.LoadingSettings[ index ], onShowed, onLoaded, onHided, cancellationToken, tasks );
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
public async UniTask LoadThroughBlank(
|
|
33
|
+
string uid,
|
|
34
|
+
Action onShowed = null,
|
|
35
|
+
Action onLoaded = null,
|
|
36
|
+
Action onHided = null,
|
|
37
|
+
CancellationToken cancellationToken = default,
|
|
38
|
+
params UniTask[] tasks
|
|
39
|
+
)
|
|
20
40
|
{
|
|
21
41
|
var loading = _settings.LoadingSettings.FirstOrDefault( ( x ) => string.Equals( x.UID, uid, StringComparison.InvariantCultureIgnoreCase ) );
|
|
22
|
-
await LoadThroughBlank( loading, onShowed, onLoaded, onHided );
|
|
42
|
+
await LoadThroughBlank( loading, onShowed, onLoaded, onHided, cancellationToken, tasks );
|
|
23
43
|
}
|
|
24
44
|
|
|
25
|
-
public async UniTask LoadThroughBlank(
|
|
45
|
+
public async UniTask LoadThroughBlank(
|
|
46
|
+
LoadingSettings loading,
|
|
47
|
+
Action onShowed = null,
|
|
48
|
+
Action onLoaded = null,
|
|
49
|
+
Action onHided = null,
|
|
50
|
+
CancellationToken cancellationToken = default,
|
|
51
|
+
params UniTask[] tasks
|
|
52
|
+
)
|
|
26
53
|
{
|
|
27
54
|
if ( _blank == null )
|
|
28
55
|
{
|
|
@@ -31,7 +58,14 @@ namespace PuzzlescapeGames.Services.UITransitionService
|
|
|
31
58
|
}
|
|
32
59
|
|
|
33
60
|
await _blank.ShowAsync( loading.InDuration, loading.InCurve, onShowed );
|
|
34
|
-
|
|
61
|
+
if ( tasks.Length > 0 )
|
|
62
|
+
{
|
|
63
|
+
await UniTask.WhenAll( tasks );
|
|
64
|
+
}
|
|
65
|
+
else
|
|
66
|
+
{
|
|
67
|
+
await UniTask.WaitForSeconds( loading.LoadingTime, cancellationToken: cancellationToken );
|
|
68
|
+
}
|
|
35
69
|
onLoaded?.Invoke();
|
|
36
70
|
await _blank.HideAsync( loading.OutDuration, loading.OutCurve, onHided );
|
|
37
71
|
}
|