private void button1_Click(object sender, EventArgs e) { ability = null; action = null; legendary = null; reaction = null; }
private void button1_Click(object sender, EventArgs e) { ability = null; action = null; legendary = null; reaction = null; OGLCreatureAdd = comboBox5.Text; this.Close(); }
// Load a Legendary object. public void LoadLegendary(Legendary target) { LegendaryAbility = target; LegendaryAbilityName.Text = target.Title; foreach (LegendaryTrait trait in target.TraitList()) { Traits.Items.Add(trait.Title + " | " + trait.Ability); } }
// Constructs the Legendary object. public void SerializeTraits() { if (Traits.Items.Count == 0 || String.IsNullOrEmpty(LegendaryAbilityName.Text)) { return; } LegendaryAbility = new Legendary(); LegendaryAbility.Title = LegendaryAbilityName.Text; foreach (string item in Traits.Items) { LegendaryAbility.AddTrait(item.Split('|')[0].Trim(), item.Split('|')[1].Trim()); } }
private void AddSavedTrait_FormClosing(object sender, FormClosingEventArgs e) { try { switch (tabControl1.SelectedIndex) { case 0: foreach (OGL_Ability _ability in OGLContent.OGL_Abilities) { if (_ability.OGL_Creature == comboBox5.Text && _ability.Title == comboBox1.Text) { ability = _ability; } } break; case 1: foreach (OGL_Ability _action in OGLContent.OGL_Actions) { if (_action.OGL_Creature == comboBox5.Text && _action.Title == comboBox2.Text) { action = _action; } } break; case 2: foreach (OGL_Ability _reaction in OGLContent.OGL_Reactions) { if (_reaction.OGL_Creature == comboBox5.Text && _reaction.Title == comboBox3.Text) { reaction = _reaction; } } break; case 3: foreach (OGL_Legendary _legendary in OGLContent.OGL_Legendary) { if (_legendary.OGL_Creature == comboBox5.Text && _legendary.Title == comboBox4.Text) { legendary = _legendary; } } break; } } catch { ability = null; action = null; reaction = null; legendary = null; } }
public static void AddLegendary(Legendary target) { _Legendaries.Add(target); }
private void deleteTrait(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { if (TraitsList.Items.Count < 1 || TraitsList.SelectedItem == null) { return; } if (TraitsList.SelectedItem.ToString().Split(':')[0].Trim() == "Ability") { Ability temp = null; foreach (Ability item in Monster._Abilities) { if (item.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim()) { temp = item; } } if (temp != null) { Monster._Abilities.Remove(temp); TraitsList.Items.Remove(TraitsList.SelectedItem); } } if (TraitsList.Items.Count < 1 || TraitsList.SelectedItem == null) { return; } if (TraitsList.SelectedItem.ToString().Split(':')[0].Trim() == "Attack") { Ability temp = null; foreach (Ability item in Monster._Attacks) { if (item.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim()) { temp = item; } } if (temp != null) { Monster._Attacks.Remove(temp); TraitsList.Items.Remove(TraitsList.SelectedItem); } } if (TraitsList.Items.Count < 1 || TraitsList.SelectedItem == null) { return; } if (TraitsList.SelectedItem.ToString().Split(':')[0].Trim() == "Legendary") { Legendary temp = null; foreach (Legendary item in Monster._Legendaries) { if (item.Title == TraitsList.SelectedItem.ToString().Split(':')[1].Trim()) { temp = item; } } if (temp != null) { Monster._Legendaries.Remove(temp); TraitsList.Items.Remove(TraitsList.SelectedItem); } } if (TraitsList.Items.Count < 1 || TraitsList.SelectedItem == null) { return; } if (TraitsList.Items.Contains(TraitsList.SelectedItem)) { TraitsList.Items.Remove(TraitsList.SelectedItem); } } }