private void OnActiveLayer(EXListViewSubItemBase _item, string oldText, string newText) { EXBoolListViewSubItem item = (EXBoolListViewSubItem)_item; if (item.BoolValue) { //解除其它层的激活 for (int i = 0; i < LayerList.ItemList.Count; ++i) { EXBoolListViewSubItem iter = (EXBoolListViewSubItem)LayerList.ItemList[i].SubItemList[1]; if (iter != item && iter.BoolValue) { iter.SetValue(false); LayerList.Invalidate(iter.Bounds); } } // 激活编辑器中的对应层 ListView.SelectedListViewItemCollection sel = LayerList.SelectedItems; if (sel.Count > 0) { Program.engine.MainLevel.SetActiveLayer(sel[0].SubItems[1].Text); } //在右侧的列表中显示当前激活层中的所有actor UpdateActorList(sel[0].SubItems[1].Text); } else { //不能直接关闭激活层的激活,只能通过激活其它层来替换当前激活层 item.BoolValue = true; LayerList.Invalidate(item.Bounds); } OperationTooltip.Text = "就绪"; }
private void OnLockLayer(EXListViewSubItemBase _item, string oldText, string newText) { //锁定或者解锁编辑器中对应的层 EXBoolListViewSubItem item = (EXBoolListViewSubItem)_item; ListView.SelectedListViewItemCollection sel = LayerList.SelectedItems; if (sel.Count > 0) { Program.engine.MainLevel.LockLayer(sel[0].SubItems[1].Text, item.BoolValue); } OperationTooltip.Text = "就绪"; }
private void OnLayerNameChanged(EXListViewSubItemBase _item, string oldText, string newText) { if (oldText == newText) { return; } if (Program.engine.MainLevel.IsLayerExist(newText)) { MessageBox.Show("作业层的名字不能重复,请重新设定.", "错误"); _item.ItemValue = oldText; return; } Program.engine.MainLevel.RenameLayer(oldText, newText); OperationTooltip.Text = "就绪"; }
private void toolStripButton2_Click(object sender, EventArgs e) { //删除当前选中的层(问题:当前激活的层是否可以删除?) ListView.SelectedIndexCollection sel = LayerList.SelectedIndices; if (sel.Count > 0) { if (DialogResult.Yes == MessageBox.Show("删除工作层时会删除层中的所有对象,是否确定要删除?", "警告", MessageBoxButtons.YesNo)) { // 删除编辑器中对应的层 EXListViewSubItemBase item = LayerList.ItemList[sel[0]].SubItemList[0]; string name = item.Text; Program.engine.MainLevel.RemoveLayer(name); LayerList.RemoveItem(sel[0]); } } OperationTooltip.Text = "就绪"; }