private void LoadDeck(UnityDeck deck) { foreach (Card card in deck.Cards) { foreach (GameBoardCard boardCard in CardGameManager.Current.GameBoardCards.Where(boardCard => card.Id.Equals(boardCard.Card))) { CreateGameBoards(boardCard.Boards); } } Dictionary <string, List <Card> > extraGroups = deck.GetExtraGroups(); List <Card> extraCards = deck.GetExtraCards(); List <UnityCard> deckCards = deck.Cards.Where(card => !extraCards.Contains(card)).Cast <UnityCard>().ToList(); deckCards.Shuffle(); string deckName = !string.IsNullOrEmpty(CardGameManager.Current.GamePlayDeckName) ? CardGameManager.Current.GamePlayDeckName : deck.Name; if (CgsNetManager.Instance.isNetworkActive && CgsNetManager.Instance.LocalPlayer != null) { CgsNetManager.Instance.LocalPlayer.RequestNewDeck(deckName, deckCards); var i = 1; foreach (KeyValuePair <string, List <Card> > cardGroup in extraGroups) { Vector2 position = NextDeckPosition + Vector2.right * CardGameManager.PixelsPerInch * i * CardGameManager.Current.CardSize.X; CgsNetManager.Instance.LocalPlayer.RequestNewCardStack(cardGroup.Key, cardGroup.Value.Cast <UnityCard>(), position); i++; } } else { _soloDeckStack = CreateCardStack(deckName, deckCards, NextDeckPosition); var i = 1; foreach (KeyValuePair <string, List <Card> > cardGroup in extraGroups) { Vector2 position = NextDeckPosition + Vector2.right * CardGameManager.PixelsPerInch * i * CardGameManager.Current.CardSize.X; CreateCardStack(cardGroup.Key, (List <UnityCard>)cardGroup.Value.Cast <UnityCard>(), position); i++; } } NextDeckPosition += Vector2.down * CardGameManager.PixelsPerInch * CardGameManager.Current.CardSize.Y; PromptForHand(); }
private void LoadDeck(UnityDeck deck) { foreach (var card in deck.Cards) { foreach (var gameBoardCard in CardGameManager.Current.GameBoardCards.Where(boardCard => card.Id.Equals(boardCard.Card))) { CreateGameBoards(gameBoardCard.Boards); } } var extraGroups = deck.GetExtraGroups(); var extraCards = deck.GetExtraCards(); var deckCards = deck.Cards.Where(card => !extraCards.Contains(card)).Cast <UnityCard>().ToList(); deckCards.Shuffle(); var deckName = !string.IsNullOrEmpty(CardGameManager.Current.GamePlayDeckName) ? CardGameManager.Current.GamePlayDeckName : deck.Name; var newDeckPosition = NewDeckPosition; if (CgsNetManager.Instance.isNetworkActive && CgsNetManager.Instance.LocalPlayer != null) { CgsNetManager.Instance.LocalPlayer.RequestNewDeck(deckName, deckCards); var i = 1; foreach (var cardGroup in extraGroups) { var position = newDeckPosition + Vector2.right * (CardGameManager.PixelsPerInch * i * CardGameManager.Current.CardSize.X + DeckPositionBuffer); CgsNetManager.Instance.LocalPlayer.RequestNewCardStack(cardGroup.Key, cardGroup.Value.Cast <UnityCard>(), position); i++; } } else { _soloDeckStack = CreateCardStack(deckName, deckCards, newDeckPosition); var i = 1; foreach (var cardGroup in extraGroups) { var position = newDeckPosition + Vector2.right * (CardGameManager.PixelsPerInch * i * CardGameManager.Current.CardSize.X); CreateCardStack(cardGroup.Key, cardGroup.Value.Cast <UnityCard>().ToList(), position); i++; } } PromptForHand(); }