Пример #1
0
    public CardArray clone()
    {
        List<int> intCards = toIntList();

        CardArray cloneObject = new CardArray();
        for (int i = 0; i < intCards.Count; i++)
        {
            cloneObject.addCard(intCards[i]);
        }
        return cloneObject;
    }
        public static void decode(string jsonInfo)
        {
            DeskCardsPromptObject deskCardsPromptObject = ModelManager.shareInstance().getDeskCardsPromptObject();

            Dictionary<string, object> data = Json.Deserialize(jsonInfo) as Dictionary<string, object>;
            List<object> promptCardsList = data["cards"] as List<object>;

            List<CardArray> promptCards = new List<CardArray>();
            for (int i = 0; i < promptCardsList.Count; i++)
            {
                List<object> promptCardsPerRound = promptCardsList[i] as List<object>;
                CardArray cards = new CardArray();
                for (int j = 0; j < promptCardsPerRound.Count; j++)
                {
                    cards.addCard(Convert.ToInt32(promptCardsPerRound[j]));
                }
                promptCards.Add(cards);
            }

            deskCardsPromptObject.setCards(promptCards);
        }