Пример #1
0
        private CardCollection DataToCollection(DeckData data)
        {
            CardCollection deck = Instantiate(deckPrefab);

            deck.m_Warrior = AllUnitReference.Instance.GetCardById(data.warriorID, true);

            for (int i = 0; i < data.spiritsID.Length; i++)
            {
                int id = data.spiritsID[i];
                deck.m_CardList[i] = AllUnitReference.Instance.GetCardById(id);
            }

            return(deck);
        }
Пример #2
0
        private DeckData CollectionToData(CardCollection collection)
        {
            DeckData deckData = new DeckData();

            if (collection.m_Warrior != null)
            {
                deckData.warriorID = collection.m_Warrior.ID;
            }

            for (int i = 0; i < deckData.spiritsID.Length; i++)
            {
                if (collection.m_CardList[i] != null)
                {
                    deckData.spiritsID[i] = collection.m_CardList[i].ID;
                }
            }

            return(deckData);
        }