public MainWindow() { InitializeComponent(); typeSelected = cardtypes.Hero; loadExcelIntoList(typeSelected); fillFieldsWithData(typeSelected); }
private void loadExcelIntoList(cardtypes type) { switch (type) { case cardtypes.Hero: { List <heroCard> heroes = new List <heroCard>(); List <string> List = readExcel(Environment.CurrentDirectory.ToString() + "\\HeroCards.xlsx"); int offset = 0; int rows = List.Count / ATT_NUM_BY_TYPE[(int)type]; for (int n = 1; n < rows; n++) { offset = 10 * n; Console.WriteLine("Hello"); heroes.Add(new heroCard((List[offset + 0]), int.Parse((List[offset + 1])), int.Parse((List[2 + offset])), int.Parse((List[3 + offset])), (List[4 + offset]), (List[5 + offset]), (List[6 + offset]), ((List[7 + offset]) == "" || (List[7 + offset]) == " ") ? " " : string.Concat("[", List[7 + offset], "]"), string.Concat("[", returnWithSign((List[8 + offset])) + " ATK]"), string.Concat("[", returnWithSign((List[9 + offset])), " DEF]"))); } CardLists[(int)cardtypes.Hero] = heroes; return; } } ; return; }
private void fillFieldsWithData(cardtypes type) { switch (type) { case cardtypes.Hero: { NameInput.Text = CardLists[(int)type][currentCard].name; SoulInput.Text = CardLists[(int)type][currentCard].soul.ToString(); illustration.Source = null; TypeInput.Text = CardLists[(int)type][currentCard].type; //EffectInput.Text = CardLists[(int)type][currentCard].effect; EffectInput.AppendText(CardLists[(int)type][currentCard].effect); //EffectInput.Document = CardLists[(int)type][currentCard].effect; //FlavorInput.Text = CardLists[(int)type][currentCard].flavor; FlavorInput.AppendText(CardLists[(int)type][currentCard].flavor); AttackInput.Text = CardLists[(int)type][currentCard].atk.ToString(); DefenseInput.Text = CardLists[(int)type][currentCard].def.ToString(); AttackBoostInput.Text = CardLists[(int)type][currentCard].boost2; DefenseBoostInput.Text = CardLists[(int)type][currentCard].boost3; EffectBoostInput.Text = CardLists[(int)type][currentCard].boost1; //PublicationInfo.Text = listOfHeroes[currentCard].; return; } } }
public PlayingCard(cardtypes type, suits suit, bool notfake) { this.type = type; this.suit = suit; this.notfake = notfake; }