public override object Clone() { ChestData data = new ChestData(); data.Name = chestData.Name; data.IsLocked = chestData.IsLocked; data.IsTrapped = chestData.IsTrapped; data.TextureName = chestData.TextureName; data.TrapName = chestData.TrapName; data.KeyName = chestData.KeyName; data.MinGold = chestData.MinGold; data.MaxGold = chestData.MaxGold; foreach (KeyValuePair<string, string> pair in chestData.ItemCollection) data.ItemCollection.Add(pair.Key, pair.Value); Chest chest = new Chest(data); return chest; }
public override object Clone() { ChestData data = new ChestData(); data.Name = chestData.Name; data.DifficultyLevel = chestData.DifficultyLevel; data.IsLocked = chestData.IsLocked; data.IsTrapped = chestData.IsTrapped; data.TrapName = chestData.TrapName; data.KeyName = chestData.KeyName; data.KeyType = chestData.KeyType; data.KeysRequired = chestData.KeysRequired; data.MinGold = chestData.MinGold; data.MaxGold = chestData.MaxGold; foreach (KeyValuePair<string, string> item in chestData.ItemCollection) data.ItemCollection.Add(item.Key, item.Value); Chest chest = new Chest(data); return chest; }
public override object Clone() { ChestData data = new ChestData(); data.Name = chestData.Name; data.IsLocked = chestData.IsLocked; data.IsTrapped = chestData.IsTrapped; data.TextureName = chestData.TextureName; data.TrapName = chestData.TrapName; data.KeyName = chestData.KeyName; data.MinGold = chestData.MinGold; data.MaxGold = chestData.MaxGold; foreach (KeyValuePair <string, string> pair in chestData.ItemCollection) { data.ItemCollection.Add(pair.Key, pair.Value); } Chest chest = new Chest(data); return(chest); }
public override object Clone() { ChestData data = new ChestData(); data.Name = chestData.Name; data.DifficultyLevel = chestData.DifficultyLevel; data.IsLocked = chestData.IsLocked; data.IsTrapped = chestData.IsTrapped; data.TrapName = chestData.TrapName; data.KeyName = chestData.KeyName; data.KeyType = chestData.KeyType; data.KeysRequired = chestData.KeysRequired; data.MinGold = chestData.MinGold; data.MaxGold = chestData.MaxGold; foreach (KeyValuePair <string, string> item in chestData.ItemCollection) { data.ItemCollection.Add(item.Key, item.Value); } Chest chest = new Chest(data); return(chest); }
public Chest(ChestData data) : base(data.Name, "", 0, 0) { this.chestData = data; }
public Chest(ChestData data) : base(data.Name, "", 0, 0) { chestData = data; }
void btnCancel_Click(object sender, EventArgs e) { chest = null; this.FormClosing -= FormChestDetails_FormClosing; this.Close(); }
void btnOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(tbName.Text)) { MessageBox.Show("You must enter a name for the chest."); return; } if (cbTrap.Checked && string.IsNullOrEmpty(tbTrap.Text)) { MessageBox.Show("You must supply a name for the trap on the chest."); return; } if (nudMaxGold.Value < nudMinGold.Value) { MessageBox.Show("Maximum gold in chest must be greater or equal to minimum gold."); return; } ChestData data = new ChestData(); data.Name = tbName.Text; data.IsLocked = cbLock.Checked; if (cbLock.Checked) { data.DifficultyLevel = (DifficultyLevel)cboDifficulty.SelectedIndex; data.KeyName = tbKeyName.Text; data.KeyType = tbKeyType.Text; data.KeysRequired = (int)nudKeys.Value; } data.IsTrapped = cbTrap.Checked; if (cbTrap.Checked) { data.TrapName = tbTrap.Text; } data.MinGold = (int)nudMinGold.Value; data.MaxGold = (int)nudMaxGold.Value; chest = data; this.FormClosing -= FormChestDetails_FormClosing; this.Close(); }
private void AddChest(ChestData ChestData) { if (FormDetails.ItemManager.ChestData.ContainsKey(ChestData.Name)) { DialogResult result = MessageBox.Show( ChestData.Name + " already exists. Overwrite it?", "Existing Chest", MessageBoxButtons.YesNo); if (result == DialogResult.No) return; itemManager.ChestData[ChestData.Name] = ChestData; FillListBox(); return; } itemManager.ChestData.Add(ChestData.Name, ChestData); lbDetails.Items.Add(ChestData); }