public CNetDeckVO CreateOrSave(CNetDeckVO deckToSave, List <CNetCardVO> playerCards) { CNetDeckVO deck; lock (Decks) { deck = Decks.FirstOrDefault(d => deckToSave.Index == d.Index); } if (deck == null) { deck = AddDeck(deckToSave); } else { deck.Cards = deckToSave.Cards; deck.DeckName = deckToSave.DeckName; deck.IdCardPool = deckToSave.IdCardPool; deck.IdLimitedPool = deckToSave.IdLimitedPool; } deck.DeckLevel = deck.CalculateDeckLevel(Cards); deck.CoverCard = Cards.FirstOrDefault(c => c.Index == deckToSave.CoverCard.Index) ?? new CNetCardVO(); deck.SetCardInfo(playerCards); return(deck); }
public static PlayerData CreateDefault() { var cardIndices = new int[] { 288, 253, 354, 700, 673, 379, 287 }; var cards = new List <CNetCardVO>(); var decks = new List <CNetDeckVO>(); foreach (var cardIndex in cardIndices) { var cardTemplate = CardTemplate.CardTemplates.First(c => c.CardIndex == cardIndex); cards.Add(new CNetCardVO(true) { CardIndex = (ulong)cardIndex, CardName = cardTemplate.Name, ChargeAmount = 0, UpgradeLevel = 0, IsTradeable = false, IsPromoCard = cardTemplate.IsPromo, IsMasterCard = true, IdCardPool = (ulong)CardPool.Tutorial, IdLimitedPool = (ulong)CardPool.Tutorial, }); } foreach (var cardTemplate in CardTemplate.CardTemplates) { cards.Add(CNetCardVO.FromTemplate(cardTemplate)); } decks.Add(CNetDeckVO.CreateTutorialDeck(cards)); return(new PlayerData(cards, decks)); }
public CNetDeckVO AddDeck(CNetDeckVO deck) { deck.Index = CNetDeckVO.NewIndex(); lock (Decks) { Decks.Add(deck); } return(deck); }
public void ChangeSlot(Player player, CNetDeckVO deck, int slot) { var isReady = false; var oldTeamPlayer = GetTeamPlayer(player); if (oldTeamPlayer != null) { isReady = oldTeamPlayer.IsReady; oldTeamPlayer.Clear(); } if (slot >= 0) { var newTeamPlayer = GetTeamPlayer(slot); newTeamPlayer.Set(player, deck); newTeamPlayer.IsReady = isReady; } }
public void ChangeSlot(Player player, CNetDeckVO deck, int slot) { foreach (var tp in GetPlayers()) { if (tp.Player != player) { continue; } tp.Clear(); } if (slot < Team1.Length) { Team1[slot].Set(player, deck); } else { Team2[slot - Team1.Length].Set(player, deck); } }
public void Set(Player player, CNetDeckVO deck) { Player = player; Deck = deck; }