private void btnAddPlayerClass_Click(object sender, EventArgs e) { PlayerClass newPlayerClass = new PlayerClass(); newPlayerClass.name = "newPlayerClass"; newPlayerClass.tag = "newPlayerClassTag_" + prntForm.mod.nextIdNumber.ToString(); //newPlayerClass.setupXpTable(); //newPlayerClass.setupSavingThrowTables(); //newPlayerClass.setupTables(); prntForm.playerClassesList.Add(newPlayerClass); selectedLbxIndex = prntForm.playerClassesList.Count - 1; fillAllowedSkillList(); fillAllowedSpellList(); fillAllowedTraitList(); //lbxPlayerClasses.SelectedIndex = selectedLbxIndex; refreshListBox(); }
private void btnAddPlayerClass_Click(object sender, EventArgs e) { PlayerClass newPlayerClass = new PlayerClass(); newPlayerClass.name = "newPlayerClass"; newPlayerClass.tag = "newPlayerClassTag_" + prntForm.mod.nextIdNumber.ToString(); //newPlayerClass.setupXpTable(); //newPlayerClass.setupSavingThrowTables(); //newPlayerClass.setupTables(); prntForm.playerClassesList.Add(newPlayerClass); selectedLbxIndex = prntForm.playerClassesList.Count - 1; fillAllowedSkillList(); fillAllowedSpellList(); fillAllowedTraitList(); //lbxPlayerClasses.SelectedIndex = selectedLbxIndex; refreshListBox(); }
private void RacesEditor_FormClosing(object sender, FormClosingEventArgs e) { prntForm.racesList[selectedLbxIndex].classesAllowed.Clear(); foreach (object itemChecked in cbxClassesAllowed.CheckedItems) { PlayerClass chkdItem = (PlayerClass)itemChecked; prntForm.racesList[selectedLbxIndex].classesAllowed.Add(chkdItem.tag); } foreach (Race rc in prntForm.racesList) { for (int i = rc.traitsAllowed.Count - 1; i >= 0; i--) { if (!rc.traitsAllowed[i].allow) { rc.traitsAllowed.RemoveAt(i); } } } }
public PlayerClass DeepCopy() { PlayerClass other = (PlayerClass)this.MemberwiseClone(); other.itemsAllowed = new List <ItemRefs>(); foreach (ItemRefs s in this.itemsAllowed) { other.itemsAllowed.Add(s.DeepCopy()); } other.traitsAllowed = new SortableBindingList <TraitAllowed>(); foreach (TraitAllowed s in this.traitsAllowed) { TraitAllowed sa = s.DeepCopy(); other.traitsAllowed.Add(sa); } other.spellsAllowed = new SortableBindingList <SpellAllowed>(); foreach (SpellAllowed s in this.spellsAllowed) { SpellAllowed sa = s.DeepCopy(); other.spellsAllowed.Add(sa); } return(other); }
private void refreshClassesAllowed() { cbxClassesAllowed.BeginUpdate(); cbxClassesAllowed.DataSource = null; cbxClassesAllowed.DataSource = prntForm.playerClassesList; cbxClassesAllowed.DisplayMember = "name"; cbxClassesAllowed.EndUpdate(); //uncheck all first for (int i = 0; i < cbxClassesAllowed.Items.Count; i++) { cbxClassesAllowed.SetItemChecked(i, false); } //iterate and check ones in list for (int i = 0; i < cbxClassesAllowed.Items.Count; i++) { PlayerClass thisPlayerClass = (PlayerClass)cbxClassesAllowed.Items[i]; if (prntForm.racesList[selectedLbxIndex].classesAllowed.Contains((string)thisPlayerClass.tag)) { cbxClassesAllowed.SetItemChecked(i, true); } } }
private bool classExists(PlayerClass itImp) { foreach (PlayerClass it in prntForm.playerClassesList) { if (it.tag == itImp.tag) { return true; } } return false; }