public void LoadDeckList(String filePath) { if (File.Exists(filePath) == false) { return; } XmlDocument doc = new XmlDocument(); doc.Load(filePath.ToString()); foreach (XmlNode node in doc.DocumentElement.ChildNodes) { String name = node.Attributes["Name"].Value; String expansionStr = node.Attributes["Expansion"].Value; String numStr = node.Attributes["Num"].Value; eExpansion expansion = GetExpansionEnumFromString(expansionStr); DeckCardData cardData = new DeckCardData(); cardData.SetCardNum(Int32.Parse(numStr)); cardData.SetCardData(m_CardList[expansion][name]); m_DeckList.Add(name, cardData); } }
// todo. 휠로 카드 수 증감할 수 있도록 수정 private void ApplyDeckListBtn_Click(object sender, EventArgs e) { if (AddCardNumComboBox.SelectedIndex == 0) { return; } String cardName = m_curSelectedCard.GetCardName(); if (m_DeckList.ContainsKey(cardName) == true) { int cardNum = m_DeckList[cardName].GetCardNum(); if (cardNum + AddCardNumComboBox.SelectedIndex <= MAX_CARD_NUM) { DeckCardData deckCard = m_DeckList[cardName]; deckCard.SetCardNum(cardNum + AddCardNumComboBox.SelectedIndex); m_DeckList[cardName] = deckCard; } else { return; } } else { DeckCardData deckCardData = new DeckCardData(); deckCardData.SetCardData(m_curSelectedCard); deckCardData.SetCardNum(AddCardNumComboBox.SelectedIndex); m_DeckList.Add(cardName, deckCardData); } RefreshDeckList(); }