示例#1
0
        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);
        }
示例#2
0
        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));
        }
示例#3
0
 public CNetDeckVO AddDeck(CNetDeckVO deck)
 {
     deck.Index = CNetDeckVO.NewIndex();
     lock (Decks)
     {
         Decks.Add(deck);
     }
     return(deck);
 }
示例#4
0
        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;
            }
        }
示例#5
0
        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);
            }
        }
示例#6
0
 public void Set(Player player, CNetDeckVO deck)
 {
     Player = player;
     Deck   = deck;
 }