Exemple #1
0
        private async Task MonitorLoadingScreen(CancellationToken cancellationToken)
        {
            try
            {
                while (true)
                {
                    bool isLoadingScreen = _gameValueService.IsGameInLoadingScreen();

                    if (isLoadingScreen && !_previousLoadingScreenState)
                    {
                        OnEnteredLoadingScreen();
                    }

                    if (!isLoadingScreen && _previousLoadingScreenState)
                    {
                        OnExitLoadingScreen();
                    }

                    _previousLoadingScreenState = isLoadingScreen;
                    await Task.Delay(1000, cancellationToken).ConfigureAwait(false);
                }
            }
            catch (TaskCanceledException)
            {
            }
        }