private void button3_Click(object sender, EventArgs e) // Duplicate Action { var index = dataGridViewEventTemplates.SelectedRows[0].Index; var eventTemp = LoadedAsset.GetAllActions().ElementAt(index).Item1; //Cant add events with the same name so I have to rework their variables string newActionName = "Duplicate" + eventTemp.GetNTerm(3).ToString(); var newEventTemp = WellFormedNames.Name.BuildName( (Name)AMConsts.EVENT, (Name)"Action-End", eventTemp.GetNTerm(2), (Name)newActionName, eventTemp.GetNTerm(4)); var priority = LoadedAsset.GetAllActions().ElementAt(index).Item2; LoadedAsset.addActionTemplate((Name)newEventTemp, priority); LoadedAsset.AddActionEffects((Name)newEventTemp, LoadedAsset.GetAllEventEffects()[eventTemp].ToList()); SetModified(); RefreshEventList(); }
private void button1_Click(object sender, EventArgs e) // Duplicate Effect { var index = dataGridViewEventTemplates.SelectedRows[0].Index; var eventTemp = LoadedAsset.GetAllActions().ElementAt(index).Item1; var index2 = dataGridViewEffects.SelectedRows[0].Index; var effect = LoadedAsset.GetAllEventEffects()[eventTemp].ElementAt(index2); LoadedAsset.AddActionEffect(eventTemp, effect.ToDTO()); SetModified(); dataGridViewEventTemplates_SelectionChanged(sender, e); }
private void button2_Click(object sender, EventArgs e) // Edit Effect { var index2 = -1; var index = dataGridViewEventTemplates.SelectedRows[0].Index; var actionTemp = LoadedAsset.GetAllActions().ElementAt(index).Item1; index2 = dataGridViewEffects.SelectedRows[0].Index; var effect = LoadedAsset.GetAllEventEffects()[actionTemp].ElementAt(index2); var ef = new AddorEditEffect(LoadedAsset, actionTemp, index2, effect.ToDTO()); ef.ShowDialog(this); SetModified(); dataGridViewEventTemplates_SelectionChanged(sender, e); }
public void RefreshEffects() { var index = 0; if (dataGridViewEventTemplates.SelectedRows.Count > 0) { index = dataGridViewEventTemplates.SelectedRows[0].Index; } dataGridViewEffects.DataSource = null; if (LoadedAsset != null) { if (LoadedAsset.GetAllEventEffects().Count == 0) { return; } var evt = LoadedAsset.GetAllEventEffects().Keys.ElementAt(index); if (LoadedAsset.GetAllEventEffects()[evt].Count > 0) { dataGridViewEffects.DataSource = LoadedAsset.GetAllEventEffects().ElementAt(index).Value; dataGridViewEffects.Columns[0].Visible = false; dataGridViewEffects.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; button1.Enabled = true; button2.Enabled = true; button4.Enabled = true; } else { button1.Enabled = false; button2.Enabled = false; button4.Enabled = false; } addEffectDTO.Enabled = true; } }