/// <summary> /// 关联 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button4_Click(object sender, EventArgs e) { List <Command> Command = new List <Command>(); for (int j = 0; j < Form1.OneCommandList.Count; j++) { if (Form1.OneCommandList[j].CommandNum == Form1.form1.treeView1.SelectedNode.Name) { List <Command> OldCommand = Form1.OneCommandList[j].command; for (int i = 0; i < checkedListBox1.Items.Count; i++) { if (checkedListBox1.GetItemChecked(i)) { if (OldCommand.Count > 0) { for (int s = 0; s < OldCommand.Count; s++) { if (OldCommand[s].Carname == checkedListBox1.Items[i].ToString() && OldCommand[s].Carname != "") { Command command = new Command(); command.Carname = OldCommand[s].Carname; command.CommandFx = OldCommand[s].CommandFx; command.CommandRange = OldCommand[s].CommandRange; command.CommandSpeed = OldCommand[s].CommandSpeed; command.Angle = OldCommand[s].Angle; Command.Add(command); break; } if (s == OldCommand.Count - 1) { Command command = new Command(); command.Carname = checkedListBox1.Items[i].ToString(); command.CommandFx = "前进"; command.CommandRange = "0"; command.CommandSpeed = "0"; command.Angle = "0"; Command.Add(command); } } } else { Command command = new Command(); command.Carname = checkedListBox1.Items[i].ToString(); command.CommandFx = "前进"; command.CommandRange = "0"; command.CommandSpeed = "0"; command.Angle = "0"; Command.Add(command); } } } Form1.OneCommandList[j].command = Command; Form1.SaveOneCommand(); Form1.form1.treeView1.Nodes.Clear(); break; } } OneCommand oneCommand = new OneCommand(); oneCommand.CommandNum = ""; Form1.form1.treeview(oneCommand); foreach (TreeNode tr in Form1.form1.treeView1.Nodes) { TreeNode temp = Form1.form1.FindNode(tr, ID); if (temp != null) { Form1.form1.treeView1.SelectedNode = temp; temp.Expand(); } } //Form1.form1.treeView1.ExpandAll(); this.Hide(); }
void Start_Ball() => GM = GameObject.FindWithTag("GameManager").GetComponent <OneCommand>();
/// <summary> /// 逻辑嵌套 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { try { TreeNode trNode = Form1.form1.treeView1.SelectedNode; if (comboBox1.Text != "" || radioButton4.Checked) { if (radioButton1.Checked) //普通嵌套 { foreach (OneCommand oneCommand in Form1.OneCommandList) { if (oneCommand.CommandNum == Form1.form1.treeView1.SelectedNode.Name) { oneCommand.FatherPoint = comboBox1.Text; oneCommand.Finish = ""; oneCommand.WaitTime = ""; oneCommand.WaitCar = ""; Form1.SaveOneCommand(); break; } } } else if (radioButton2.Checked) //完成度嵌套 { foreach (OneCommand oneCommand in Form1.OneCommandList) { if (oneCommand.CommandNum == Form1.form1.treeView1.SelectedNode.Name) { if (Convert.ToInt32(textBox1.Text) >= 0 && Convert.ToInt32(textBox1.Text) <= 100 && comboBox2.Text != "") { oneCommand.FatherPoint = comboBox1.Text; oneCommand.Finish = textBox1.Text; oneCommand.WaitTime = ""; oneCommand.WaitCar = comboBox2.Text; Form1.SaveOneCommand(); break; } } } } else if (radioButton3.Checked) //延时嵌套 { foreach (OneCommand oneCommand in Form1.OneCommandList) { if (oneCommand.CommandNum == Form1.form1.treeView1.SelectedNode.Name) { if (Convert.ToInt32(textBox2.Text) >= 0) { oneCommand.FatherPoint = comboBox1.Text; oneCommand.Finish = ""; oneCommand.WaitCar = ""; oneCommand.WaitTime = textBox2.Text; Form1.SaveOneCommand(); break; } } } } else if (radioButton4.Checked) //设为根指令 { foreach (OneCommand oneCommand in Form1.OneCommandList) { if (oneCommand.CommandNum == Form1.form1.treeView1.SelectedNode.Name) { oneCommand.FatherPoint = ""; oneCommand.Finish = ""; oneCommand.WaitTime = ""; oneCommand.WaitCar = ""; Form1.SaveOneCommand(); break; } } } else if (radioButton5.Checked) { foreach (OneCommand oneCommand in Form1.OneCommandList) { if (oneCommand.CommandNum == Form1.form1.treeView1.SelectedNode.Name) { oneCommand.FatherPoint = comboBox1.Text; oneCommand.Finish = ""; oneCommand.WaitTime = ""; oneCommand.WaitCar = "0"; Form1.SaveOneCommand(); break; } } } Form1.form1.treeView1.Nodes.Clear(); OneCommand Command = new OneCommand(); Command.CommandNum = ""; Form1.form1.treeview(Command); // Form1.form1.treeView1.SelectedNode = trNode; foreach (TreeNode treenode in Form1.form1.treeView1.Nodes) { TreeNode temp = Form1.form1.FindNode(treenode, label2.Text); if (temp != null) { if (temp.Name == label2.Text) { Form1.form1.treeView1.SelectedNode = temp; } } } this.Hide(); } else { MessageBox.Show("请选择父指令!"); } } catch { } }