//open and read class file private void OpenTalnets(string name) { classFile = new XmlDocument(); classFile.Load(@"Data\" + name + ".xml"); specializations = new Specialization[classFile.ChildNodes[1].ChildNodes.Count]; for (i = 0; i < specializations.Count(); i++) { specializations[i] = new Specialization(classFile.ChildNodes[1].ChildNodes[i], x, y); LoadSpecialization(name, specializations[i], i); } }
//load class' specialization private void LoadSpecialization(string className, Specialization specialization, int index) { panels[index].BackgroundImage = new Bitmap(@"Textures\" + className + "\\" + specialization.Name + ".png"); tabs.TabPages[index].Text = specialization.Name; spent[index].Text = "Points spent in " + specialization.Name + " Talents: "; for (j = 0; j < x; j++) { for (k = 0; k < y; k++) { if (specialization.Talents[k + j + 3 * j].Icon != "") { SetTalnet(specialization, buttons[index, j, k], labels[index, j, k], panels[index], arrows[index], graphics[index], k + j + 3 * j); } } } arrows[index].Refresh(); }
//setup specific talent private void SetTalnet(Specialization specialization, Button button, Label label, Panel panel, PictureBox arrow, Graphics graphic, int index) { button.BackgroundImage = specialization.Talents[index].Gray; button.Show(); label.Text = specialization.Talents[index].Rank.ToString(); if (specialization.Talents[index].Tier == 1) { if (specialization.Talents[index].Dependancy == "") { label.Show(); button.BackgroundImage = specialization.Talents[index].Picture; } } button.FlatAppearance.BorderColor = specialization.Talents[index].BackColor; button.BackColor = specialization.Talents[index].BackColor; label.ForeColor = specialization.Talents[index].BackColor; label.BackColor = Color.Black; if (specialization.Talents[index].Arrow != "") { graphic.DrawImage(specialization.Talents[index].Arrow2, specialization.Talents[index].X, specialization.Talents[index].Y, specialization.Talents[index].Arrow2.Width, specialization.Talents[index].Arrow2.Height); } }
//redraw specific talent private void RedrawTalent(Specialization specialization, Button button, Label label, PictureBox arrow, Graphics graphic, int index) { if (specialization.Talents[index].BackColor == Color.Gray) { label.Hide(); } else { label.Show(); } if (label.Enabled) { label.Text = specialization.Talents[index].Rank.ToString(); label.ForeColor = specialization.Talents[index].BackColor; } if (button.Enabled) { button.FlatAppearance.BorderColor = specialization.Talents[index].BackColor; button.BackColor = specialization.Talents[index].BackColor; if ((specialization.Talents[index].Tier - 1) * 5 <= specialization.Spent.Sum()) { if (!specialization.Dependancy(specialization.Talents[index])) { if (pointsLeft == 0 && specialization.Talents[index].Rank == 0) { button.BackgroundImage = specialization.Talents[index].Gray; } else { button.BackgroundImage = specialization.Talents[index].Picture; } } else { button.BackgroundImage = specialization.Talents[index].Gray; } } else { button.BackgroundImage = specialization.Talents[index].Gray; } if (specialization.Talents[index].Arrow != "") { if ((specialization.Talents[index].Tier - 1) * 5 <= specialization.Spent.Sum()) { if (!specialization.Dependancy(specialization.Talents[index])) { graphic.DrawImage(specialization.Talents[index].Arrow1, specialization.Talents[index].X, specialization.Talents[index].Y, specialization.Talents[index].Arrow2.Width, specialization.Talents[index].Arrow2.Height); } else { graphic.DrawImage(specialization.Talents[index].Arrow2, specialization.Talents[index].X, specialization.Talents[index].Y, specialization.Talents[index].Arrow2.Width, specialization.Talents[index].Arrow2.Height); } } else { graphic.DrawImage(specialization.Talents[index].Arrow2, specialization.Talents[index].X, specialization.Talents[index].Y, specialization.Talents[index].Arrow2.Width, specialization.Talents[index].Arrow2.Height); } } } }