Esempio n. 1
0
    void ParseDecksList(string content, bool isLocal)
    {
        var json = JSONNode.Parse(content);

        if (json == null)
        {
            return;
        }
        JSONArray jsonDecks = json["decks"] as JSONArray;

        if (isLocal)
        {
            deckList.ClearLocal();
            for (int i = 0; i < jsonDecks.Count; i++)
            {
                string name = jsonDecks[i]["name"];
                if (name == "cake" && !cakeUnlocked)
                {
                    continue;
                }
                deckList.AddLocalDeck(name, jsonDecks[i]["filename"], jsonDecks[i]["starred"]);
            }
        }
        else
        {
            deckList.ClearHosted();
            for (int i = 0; i < jsonDecks.Count; i++)
            {
                string name = jsonDecks[i]["name"];
                if (name == "cake" && !cakeUnlocked)
                {
                    continue;
                }
                deckList.AddHostedDeck(name, jsonDecks[i]["filename"], jsonDecks[i]["starred"]);
            }
        }
        deckList.Updated();
    }