예제 #1
0
 private void OnClickRemoveAction(object sender, EventArgs e)
 {
     if (FileType != 0)
     {
         if (treeView1.SelectedNode.Parent == null)
         {
             DialogResult result =
                 MessageBox.Show(String.Format("Вы уверены что хотите удалить всю анимацию связанную с ID {0} ?", CurrBody),
                                 "Удаление",
                                 MessageBoxButtons.YesNo,
                                 MessageBoxIcon.Question,
                                 MessageBoxDefaultButton.Button2);
             if (result == DialogResult.Yes)
             {
                 treeView1.SelectedNode.ForeColor = Color.Red;
                 for (int i = 0; i < treeView1.SelectedNode.Nodes.Count; ++i)
                 {
                     treeView1.SelectedNode.Nodes[i].ForeColor = Color.Red;
                     for (int d = 0; d < 5; ++d)
                     {
                         AnimIdx edit = Ultima.AnimationEdit.GetAnimation(FileType, CurrBody, i, d);
                         if (edit != null)
                         {
                             edit.ClearFrames();
                         }
                     }
                 }
                 if (ShowOnlyValid)
                 {
                     treeView1.SelectedNode.Remove();
                 }
                 Options.ChangedUltimaClass["Animations"] = true;
                 AfterSelectTreeView(this, null);
             }
         }
         else
         {
             DialogResult result =
                 MessageBox.Show(String.Format("Вы уверены что хотите удалить действие № {0} ?", CurrAction),
                                 "Удаление",
                                 MessageBoxButtons.YesNo,
                                 MessageBoxIcon.Question,
                                 MessageBoxDefaultButton.Button2);
             if (result == DialogResult.Yes)
             {
                 for (int i = 0; i < 5; ++i)
                 {
                     AnimIdx edit = Ultima.AnimationEdit.GetAnimation(FileType, CurrBody, CurrAction, i);
                     if (edit != null)
                     {
                         edit.ClearFrames();
                     }
                 }
                 treeView1.SelectedNode.Parent.Nodes[CurrAction].ForeColor = Color.Red;
                 bool valid = false;
                 foreach (TreeNode node in treeView1.SelectedNode.Parent.Nodes)
                 {
                     if (node.ForeColor != Color.Red)
                     {
                         valid = true;
                         break;
                     }
                 }
                 if (!valid)
                 {
                     if (ShowOnlyValid)
                     {
                         treeView1.SelectedNode.Parent.Remove();
                     }
                     else
                     {
                         treeView1.SelectedNode.Parent.ForeColor = Color.Red;
                     }
                 }
                 Options.ChangedUltimaClass["Animations"] = true;
                 AfterSelectTreeView(this, null);
             }
         }
     }
 }