public static IEnumerator InitializeGame() { //Making query PlayerDao playerDao = new PlayerDao(); StoreDeckDao storeDeckDao = new StoreDeckDao(); MatchDao matchDao = new MatchDao(); List <Dao> daoList = new List <Dao>() { playerDao, storeDeckDao, matchDao }; yield return(makeQuerry(daoList)); if (!succsesfull) { yield break; } //Getting results Player player = playerDao.getQueryResultPlayer(); Player.setInstance(player); List <StoreDeck> storeDeckList = storeDeckDao.getQueryResultStoreDeckList(); bool change = false; DeckBuilder deckBuilder; Deck deck; List <string> playerStoreDecks = player.StoreDeckNameList.getList(); foreach (StoreDeck storeDeck in storeDeckList) { if (!playerStoreDecks.Contains(storeDeck.DeckName)) { if (player.IsPremium) { deckBuilder = new DeckBuilder(storeDeck); deck = deckBuilder.getDeck(); player.addDeck(deck); player.addToStoreDeckNameList(deck.DeckName); change = true; } else { Store.addDeck(storeDeck); } } } if (change) { playerDao.savePlayer(player); } }
public static IEnumerator InitializeGame() { //Making query PlayerDao playerDao = new PlayerDao(); StoreDeckDao storeDeckDao = new StoreDeckDao(); MatchDao matchDao = new MatchDao(); List<Dao> daoList = new List<Dao>() { playerDao, storeDeckDao, matchDao }; yield return makeQuerry(daoList); if (!succsesfull) yield break; //Getting results Player player = playerDao.getQueryResultPlayer(); Player.setInstance(player); List<StoreDeck> storeDeckList = storeDeckDao.getQueryResultStoreDeckList(); bool change = false; DeckBuilder deckBuilder; Deck deck; List<string> playerStoreDecks = player.StoreDeckNameList.getList(); foreach (StoreDeck storeDeck in storeDeckList) { if (!playerStoreDecks.Contains(storeDeck.DeckName)) { if (player.IsPremium) { deckBuilder = new DeckBuilder(storeDeck); deck = deckBuilder.getDeck(); player.addDeck(deck); player.addToStoreDeckNameList(deck.DeckName); change = true; } else { Store.addDeck(storeDeck); } } } if (change) { playerDao.savePlayer(player); } }
private IEnumerator storeDeckDaoTeste() { yield return(makeConnection()); StoreDeckDao stDao = new StoreDeckDao(); //yield return stDao.MakeQueryGetDeckList(); Debug.Log("Escrevendo resultado"); List <StoreDeck> l = stDao.getQueryResultStoreDeckList(); foreach (StoreDeck deck in l) { Debug.Log(deck.DeckName); } }
private IEnumerator storeDeckDaoTeste() { yield return makeConnection(); StoreDeckDao stDao = new StoreDeckDao(); //yield return stDao.MakeQueryGetDeckList(); Debug.Log("Escrevendo resultado"); List<StoreDeck> l = stDao.getQueryResultStoreDeckList(); foreach(StoreDeck deck in l) { Debug.Log(deck.DeckName); } }