protected override async Task OnInitializedAsync() { if (SaveService == null) { throw new ArgumentException($"Save {nameof(SaveService)} cannot be null"); } if (await SaveService.CheckPlayerHasSaveAsync()) { WelcomeText = "Welcome back commander"; } await SaveService.TryLoadAsync(); await SaveService.SaveAsync(new Game.GlobalGameState { CommanderName = "Commander", HasCompletedIntroduction = false }); var loadingWork = Task.Delay(6000); // TODO actual initialization job for (int i = 0; !loadingWork.IsCompleted; i++) { if (i < _mandatoryLoadingText.Length) { LoadingText = _mandatoryLoadingText[i]; } else { LoadingText = _loadingTextOptions[_rand.Next(_loadingTextOptions.Length)]; } StateHasChanged(); await Task.Delay(2000); } LoadingText = _finalLoadingMessage; await Task.Delay(2000); isLoaded = true; }