private void 添加ToolStripMenuItem_Click(object sender, EventArgs e) { if (treeViewRoot.SelectedNode.Level == 1) { scriptRoot[m_cur_index].addScene((ScriptScene)treeViewRoot.SelectedNode.Tag); } else if (treeViewRoot.SelectedNode.Level == 2) { ScriptScene scene = (ScriptScene)treeViewRoot.SelectedNode.Parent.Tag; scene.addSection((ScriptSection)treeViewRoot.SelectedNode.Tag); } else if (treeViewRoot.SelectedNode.Level == 3) { MessageBox.Show("不能在此处添加", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (treeViewRoot.SelectedNode.Level > 3) { FormAddCode addform = new FormAddCode(0, selectIndex); if (addform.ShowDialog() == DialogResult.OK) { selectIndex = addform.m_select + 1; if (addform.m_select < 4) { MessageBox.Show("code 0,1,2,3不能被手动添加", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ScriptSection sec = (ScriptSection)getLeve2Nodes(treeViewRoot.SelectedNode).Tag; sec.addCode(addform.m_select, (ScriptCommand)treeViewRoot.SelectedNode.Parent.Tag); } } buildTreeView(scriptRoot[m_cur_index]); }
private void 除ToolStripMenuItem_Click(object sender, EventArgs e) { ScriptSection sec = null; ScriptCommand n_cmd = null; var node = treeViewRoot.SelectedNode; DialogResult dr; if (node.Level <= 2) { if (node.PrevNode == null && node.NextNode == null) { MessageBox.Show("唯一的Scetion或Scene不能删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { dr = MessageBox.Show("确定要删除这条数据吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { if (node.Level == 1) { scriptRoot[m_cur_index].removeScene((ScriptScene)node.Tag); } else { ScriptScene scene = (ScriptScene)node.Parent.Tag; scene.removeSection((ScriptSection)node.Tag); } treeViewRoot.Nodes.Remove(node); } return; } } else if (node.Level == 3) { MessageBox.Show("不能被删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { sec = (ScriptSection)getLeve2Nodes(node).Tag; n_cmd = (ScriptCommand)node.Tag; } dr = MessageBox.Show("确定要删除这条数据吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dr == DialogResult.OK) { if (node.Nodes.Count < 1) { sec.removeCode(n_cmd); } else { RemoveCode(sec, node); } node.Remove(); } }
public void StartScenario(bool Scripted = false) {//called from Game to progress the game state, episode control/random scene type control is done here if ((Scripted) && (StoryCounter <= Data.MAX_EPISODE)) { ScriptScene.GenerateScenario(StoryCounter); CurrentOptions = ScriptScene.GetOptions(index, StoryCounter, ScriptScene.LocationType); StoryCounter += 1; //keeps track of which story mission we are on } else { //1 - City, 2 - Forest, 3 - Space RandScene.GenerateScenario(Data.Rand.Next(1, 4)); CurrentOptions = RandScene.GetOptions(index, RandScene.Type, RandScene.LocationType); } this.isScripted = Scripted; }
private void 剪切ToolStripMenuItem_Click(object sender, EventArgs e) { ScriptSection sec = null; ScriptCommand n_cmd = null; var node = treeViewRoot.SelectedNode; if (node.Level <= 2) { if (node.PrevNode == null && node.NextNode == null) { MessageBox.Show("唯一的Scetion或Scene不能删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (node.Level == 1) { scriptRoot[m_cur_index].removeScene((ScriptScene)node.Tag); } else { ScriptScene scene = (ScriptScene)node.Parent.Tag; scene.removeSection((ScriptSection)node.Tag); } } } else if (node.Level == 3) { MessageBox.Show("不能被删除", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { sec = (ScriptSection)node.Parent.Parent.Tag; n_cmd = (ScriptCommand)node.Tag; sec.removeCode(n_cmd); } copyNode = new TreeNode(); copyNode.Text = node.Text; copyNode.Tag = node.Tag; copyNode = CopyTreeNode(copyNode, node); cutNodeParent = node.Parent; 粘帖ToolStripMenuItem.Enabled = true; node.Remove(); isCut = true; }
public KSPHook(ScriptScene scriptScene, ScriptEvent scriptEvent) { ScriptScene = scriptScene; ScriptEvent = scriptEvent; }
private void 粘帖ToolStripMenuItem_Click(object sender, EventArgs e) { if (copyNode != null && treeViewRoot.SelectedNode != null) { if (copyNode.Level != treeViewRoot.SelectedNode.Level) { if (cutNodeParent != null && cutNodeParent.Level != treeViewRoot.SelectedNode.Parent.Level) { MessageBox.Show("粘贴目录不匹配", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (isCut) { cutNodeParent.Nodes.Add(copyNode); } if (treeViewRoot.SelectedNode.Level == 1) { ScriptScene scene = scriptRoot[m_cur_index].addScene((ScriptScene)copyNode.Tag); scene.SectionList = ((ScriptScene)copyNode.Tag).SectionList; } else if (treeViewRoot.SelectedNode.Level == 2) { ScriptScene scene = (ScriptScene)(copyNode.Parent != null ? copyNode.Parent.Tag : cutNodeParent.Tag); ScriptSection section = scene.addSection((ScriptSection)copyNode.Tag); section.CommandList = ((ScriptSection)copyNode.Tag).CommandList; } else if (treeViewRoot.SelectedNode.Level == 3) { MessageBox.Show("不能在此处复制", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (treeViewRoot.SelectedNode.Level > 3) { ScriptCommand copy_cmd = (ScriptCommand)copyNode.Tag; if (copy_cmd.id != 0) { ScriptSection sec = (ScriptSection)getLeve2Nodes(copyNode).Tag; if (copyNode.Nodes.Count > 0) { //sec.addCode(copy_cmd.id, (ScriptCommand)copyNode.Parent.Tag, true); CopyNode(sec, copyNode); } else { sec.addCode(copy_cmd.id, (ScriptCommand)copyNode.Tag); } //int copy_index = sec.FindCommand((ScriptCommand)copyNode.Parent.Tag); //int index = sec.addCode(copy_cmd.id, (ScriptCommand)copyNode.Parent.Tag, copy_cmd.isExtValueAvailable()); //sec.CommandList[index] = sec.CommandList[copy_index]; } else { MessageBox.Show("code 0,1,2,3不能被手动添加", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } buildTreeView(scriptRoot[m_cur_index]); } }