private static IEnumerable <TemplateDeck> InternalGetTemplateDecks() { var templateDecks = Mirror.Root?["GameDbf"]?["DeckTemplate"]?["m_records"]; if (templateDecks == null) { yield break; } foreach (var template in templateDecks["_items"]) { if (template == null) { continue; } TemplateDeck deck = GetTemplateDeck(template); if (deck != null && string.IsNullOrEmpty(deck.Event)) { yield return(deck); } } }
private static TemplateDeck GetTemplateDeck(dynamic deckObj) { if (deckObj == null) { return(null); } var deck = new TemplateDeck { DeckId = deckObj["m_id"], Class = deckObj["m_class"], SortOrder = deckObj["m_sortOrder"], Title = deckObj["m_title"], }; var cards = deckObj["m_cardIds"]; for (var i = 0; i < cards["count"]; i++) { var cardId = cards["keySlots"][i]; int count = cards["valueSlots"][i]; deck.Cards.Add(new Card(cardId, count, false)); } return(deck); }