public IEnumerator UpdateCardGame(CardGame cardGame) { if (cardGame == null) { cardGame = Current; } Progress.Show(cardGame); yield return(cardGame.Download()); Progress.Hide(); // Notify about the failed update, but otherwise ignore errors if (!string.IsNullOrEmpty(cardGame.Error)) { Debug.LogError(DownloadErrorMessage + cardGame.Error); Messenger.Show(DownloadErrorMessage + cardGame.Error); cardGame.ClearError(); } cardGame.Load(UpdateCardGame, LoadCards); if (cardGame == Current) { ResetGameScene(); } }
public IEnumerator DownloadCardGame(string gameUrl) { CardGame newGame = new CardGame(this, CardGame.DefaultName, gameUrl); Progress.Show(newGame); yield return(newGame.Download()); Progress.Hide(); newGame.Load(UpdateCardGame, LoadCards); if (!string.IsNullOrEmpty(newGame.Error)) { Debug.LogError(DownloadErrorMessage + Current.Error); Messenger.Show(DownloadErrorMessage + Current.Error); if (Directory.Exists(newGame.GameDirectoryPath)) { try { Directory.Delete(newGame.GameDirectoryPath, true); } catch (Exception ex) { Debug.LogError(DeleteErrorMessage + ex.Message); } } } else { AllCardGames[newGame.Id] = newGame; Select(newGame.Id); } }
public IEnumerator DownloadCardGame(string gameUrl) { //Messenger.Show("Game download has started"); CardGame newGame = new CardGame(this, Set.DefaultCode, gameUrl) { AutoUpdate = true }; Current = newGame; yield return(newGame.Download()); if (string.IsNullOrEmpty(newGame.Error)) { AllCardGames[newGame.Name] = newGame; } else { Debug.LogError(GameLoadErrorMessage + newGame.Error); } SelectCardGame(newGame.Name); //Messenger.Show("Game download has finished"); }