public void OnLevelChanged() { LayerList.BeginUpdate(); LayerList.Clear(); string active_layer = Program.engine.MainLevel.GetActiveLayer(); for (int i = 0; i < Program.engine.MainLevel.GetLayerCount(); ++i) { string text = Program.engine.MainLevel.GetLayerName(i); EXListViewItem item = new EXImageListViewItem(NexusEditor.Properties.Resources.layer); EXListViewSubItem name = new EXListViewSubItem(text); name.OnItemValueChanged = this.OnLayerNameChanged; name.UserData = item; item.AddSubItem(name); EXBoolListViewSubItem active = new EXBoolListViewSubItem(active_layer == text); active.OnItemValueChanged = this.OnActiveLayer; active.UserData = item; item.AddSubItem(active); EXBoolListViewSubItem show = new EXBoolListViewSubItem(Program.engine.MainLevel.IsLayerVisible(text)); show.OnItemValueChanged = this.OnShowLayer; show.UserData = item; item.AddSubItem(show); EXBoolListViewSubItem islock = new EXBoolListViewSubItem(Program.engine.MainLevel.IsLayerLocked(text)); islock.OnItemValueChanged = this.OnLockLayer; islock.UserData = item; item.AddSubItem(islock); LayerList.AddItem(item); } LayerList.EndUpdate(); //在右侧的列表中显示当前激活层中的所有actor UpdateActorList(Program.engine.MainLevel.GetActiveLayer()); OperationTooltip.Text = "就绪"; }
private void toolStripButton1_Click(object sender, EventArgs e) { //添加新层 //确定可用的默认层名称 string text; for (int i = 1;; ++i) { text = "新作业层" + i.ToString(); if (!Program.engine.MainLevel.IsLayerExist(text)) { break; } } EXListViewItem item = new EXImageListViewItem(NexusEditor.Properties.Resources.layer); EXListViewSubItem name = new EXListViewSubItem(text); name.OnItemValueChanged = this.OnLayerNameChanged; name.UserData = item; item.AddSubItem(name); EXBoolListViewSubItem active = new EXBoolListViewSubItem(false); active.OnItemValueChanged = this.OnActiveLayer; active.UserData = item; item.AddSubItem(active); EXBoolListViewSubItem show = new EXBoolListViewSubItem(true); show.OnItemValueChanged = this.OnShowLayer; show.UserData = item; item.AddSubItem(show); EXBoolListViewSubItem islock = new EXBoolListViewSubItem(true); islock.OnItemValueChanged = this.OnLockLayer; islock.UserData = item; item.AddSubItem(islock); LayerList.AddItem(item); // 在编辑器中对应的增加一层 Program.engine.MainLevel.CreateNewLayer(text); OperationTooltip.Text = "就绪"; }