private void toolStripButton4_Click(object sender, EventArgs e) { //锁定或者解除锁定所有的层 //只有当前层全部都冻结的时候,才设置为全部不冻结,否则全部冻结 bool s = true; for (int i = 0; i < LayerList.ItemList.Count; ++i) { EXBoolListViewSubItem item = (EXBoolListViewSubItem)LayerList.Items[i].SubItems[4]; if (item != null) { if (!item.BoolValue) { s = false; } } } for (int i = 0; i < LayerList.ItemList.Count; ++i) { EXBoolListViewSubItem item = (EXBoolListViewSubItem)LayerList.Items[i].SubItems[4]; if (item != null) { item.BoolValue = !s; string layer = LayerList.Items[i].SubItems[1].Text; Program.engine.MainLevel.LockLayer(layer, !s); } } LayerList.Invalidate(); OperationTooltip.Text = "就绪"; }
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 = "就绪"; }