File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed
Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 1- namespace Juce . CoreUnity . Loading . Services
1+ using Juce . Core . Loading . Process ;
2+
3+ namespace Juce . CoreUnity . Loading . Services
24{
35 public interface ILoadingService
46 {
57 bool IsLoading { get ; }
68
7- void StartsLoading ( ) ;
8- void StopsLoading ( ) ;
9+ bool TryStartLoading ( out ILoadingProcess loadingProcess ) ;
910 }
1011}
Original file line number Diff line number Diff line change 1- namespace Juce . CoreUnity . Loading . Services
1+ using Juce . Core . Loading . Process ;
2+
3+ namespace Juce . CoreUnity . Loading . Services
24{
35 public class LoadingService : ILoadingService
46 {
57 public bool IsLoading { get ; private set ; }
68
7- public void StartsLoading ( )
9+ public bool TryStartLoading ( out ILoadingProcess loadingProcess )
810 {
11+ if ( IsLoading )
12+ {
13+ loadingProcess = default ;
14+ return false ;
15+ }
16+
917 IsLoading = true ;
18+
19+ loadingProcess = LoadingProcess . New ( ) ;
20+
21+ loadingProcess . OnCompleted += OnLoadingProcessCompleted ;
22+
23+ return true ;
1024 }
1125
12- public void StopsLoading ( )
26+ private void OnLoadingProcessCompleted ( )
1327 {
1428 IsLoading = false ;
1529 }
You can’t perform that action at this time.
0 commit comments