File tree Expand file tree Collapse file tree 4 files changed +36
-36
lines changed
Expand file tree Collapse file tree 4 files changed +36
-36
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ internal override void InternalClose(bool destroy)
6565 /// </remarks>
6666 /// <typeparam name="T">The type of data held by the presenter.</typeparam>
6767 [ RequireComponent ( typeof ( PresenterDelayerBase ) ) ]
68- public abstract class DelayUiPresenterData < T > : UiPresenter , IUiPresenterData where T : struct
68+ public abstract class DelayUiPresenterData < T > : UiPresenter < T > where T : struct
6969 {
7070 [ SerializeField ] private PresenterDelayerBase _delayer ;
7171
Original file line number Diff line number Diff line change @@ -11,15 +11,15 @@ namespace GameLovers.UiService
1111 [ RequireComponent ( typeof ( Animation ) ) ]
1212 public class AnimationDelayer : PresenterDelayerBase
1313 {
14- [ SerializeField ] protected Animation _animation ;
15- [ SerializeField ] protected AnimationClip _introAnimationClip ;
16- [ SerializeField ] protected AnimationClip _outroAnimationClip ;
14+ [ SerializeField ] protected Animation _animation ;
15+ [ SerializeField ] protected AnimationClip _introAnimationClip ;
16+ [ SerializeField ] protected AnimationClip _outroAnimationClip ;
1717
18- /// <inheritdoc />
19- public override float OpenDelayInSeconds => _introAnimationClip . length * 1000 ;
18+ /// <inheritdoc />
19+ public override float OpenDelayInSeconds => _introAnimationClip . length ;
2020
21- /// <inheritdoc />
22- public override float CloseDelayInSeconds => _outroAnimationClip . length * 1000 ;
21+ /// <inheritdoc />
22+ public override float CloseDelayInSeconds => _outroAnimationClip . length ;
2323
2424 private void OnValidate ( )
2525 {
Original file line number Diff line number Diff line change @@ -45,33 +45,33 @@ protected virtual void OnOpenStarted() { }
4545 /// </summary>
4646 protected virtual void OnCloseStarted ( ) { }
4747
48- internal async Task OpenWithDelay ( Action onOpenedCompleted )
49- {
50- OnOpenStarted ( ) ;
48+ internal async Task OpenWithDelay ( Action onOpenedCompleted )
49+ {
50+ OnOpenStarted ( ) ;
5151
52- CurrentDelayTask = Task . Delay ( Mathf . RoundToInt ( OpenDelayInSeconds ) ) ;
52+ CurrentDelayTask = Task . Delay ( Mathf . RoundToInt ( OpenDelayInSeconds * 1000 ) ) ;
5353
54- await CurrentDelayTask ;
54+ await CurrentDelayTask ;
5555
56- if ( gameObject != null )
57- {
58- onOpenedCompleted ( ) ;
59- }
56+ if ( gameObject != null )
57+ {
58+ onOpenedCompleted ( ) ;
6059 }
60+ }
6161
62- internal async Task CloseWithDelay ( Action onCloseCompleted )
63- {
64- OnCloseStarted ( ) ;
62+ internal async Task CloseWithDelay ( Action onCloseCompleted )
63+ {
64+ OnCloseStarted ( ) ;
6565
66- CurrentDelayTask = Task . Delay ( Mathf . RoundToInt ( OpenDelayInSeconds ) ) ;
66+ CurrentDelayTask = Task . Delay ( Mathf . RoundToInt ( CloseDelayInSeconds * 1000 ) ) ;
6767
68- await CurrentDelayTask ;
68+ await CurrentDelayTask ;
6969
70- if ( gameObject != null )
71- {
72- gameObject . SetActive ( false ) ;
73- onCloseCompleted ( ) ;
74- }
70+ if ( gameObject != null )
71+ {
72+ gameObject . SetActive ( false ) ;
73+ onCloseCompleted ( ) ;
7574 }
7675 }
76+ }
7777}
Original file line number Diff line number Diff line change @@ -354,18 +354,18 @@ private void OpenUi(Type type)
354354 _visibleUiList . Add ( type ) ;
355355 }
356356
357- private async UniTask < UiPresenter > GetOrLoadUiAsync ( Type type )
357+ private async UniTask < UiPresenter > GetOrLoadUiAsync ( Type type )
358+ {
359+ if ( ! _uiPresenters . TryGetValue ( type , out var ui ) )
358360 {
359- if ( ! _uiPresenters . TryGetValue ( type , out var ui ) )
360- {
361- OpenLoadingSpinner ( ) ;
362- await LoadUiAsync ( type ) ;
363- CloseLoadingSpinner ( ) ;
364- }
365-
366- return ui ;
361+ OpenLoadingSpinner ( ) ;
362+ ui = await LoadUiAsync ( type ) ;
363+ CloseLoadingSpinner ( ) ;
367364 }
368365
366+ return ui ;
367+ }
368+
369369 private void OpenLoadingSpinner ( )
370370 {
371371 if ( _loadingSpinnerType == null )
You can’t perform that action at this time.
0 commit comments