/// <summary> /// 初始化记载全部场景 /// </summary> public void getAllSence() { ScriptDAL scrDAL = new ScriptDAL(); this.allScene = scrDAL.getAllSence(); foreach (script scr in this.allScene) { this.creatScript(scr); } }
private void AddScript_Load(object sender, EventArgs e) { // 1、加载全部角色 ScriptDAL scrDAL = new ScriptDAL(); List <VR_Role> scrs = scrDAL.getRolesWith(); // 2、如果是修改,则记载对应场景的全部角色 if (this.Tg == 1) { this.BoxName.Text = this.Scenc.Scencname; this.ScRoles = scrDAL.getAllScencRoleWithScencid(this.scenc.Id); } else { this.ScRoles = new List <script>(); } // 3、根据数据 布局Role_UI loadRolesWithRoleList(scrs); }
/// <summary> /// 删除一个场景 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void 除ToolStripMenuItem_Click(object sender, EventArgs e) { //ToolStripMenuItem btn = (ToolStripMenuItem)sender; //int id = (int)btn.GetCurrentParent().Tag; script sc = (script)this.contextMenuStrip1.Tag; ScriptDAL scrDAL = new ScriptDAL(); // 检查当前场景是否可以被删除,有则警告用户 if (scrDAL.checkSenceIsDelectWithSenceid(sc.Id)) { DialogResult result = MessageBox.Show("检测到当前脚本下面有任务,删除后不可恢复!确认删除点击是", "重要提示:", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { if (scrDAL.delectSenceWithID(sc.Id)) { // 刷新 this.panel2.Controls.Clear(); this.Tg = 2;//删除标记 this.getAllSence(); MessageBox.Show("删除成功"); } } } else //没有则直接删除 { if (scrDAL.delectSenceWithID(sc.Id)) { // 刷新 this.panel2.Controls.Clear(); this.Tg = 2;//删除标记 this.getAllSence(); MessageBox.Show("删除成功"); } } }