private void UpdateActorList(string layerName) { NLevel lv = NLevelEditorEngine.Instance.MainLevel; NActor edAct = NLevelEditorEngine.Instance.ActorEd.SelectedActor; this.m_ActorList.BeginUpdate(); this.m_ActorList.Items.Clear(); int i = 0; NActor act = lv.FirstActor(); while (act != null) { if (act.Layer != layerName) { act = lv.NextActor(); continue; } ListViewItem listItem = new ListViewItem(act.Name); listItem.Tag = act; this.m_ActorList.Items.Add(listItem); if (edAct == act) { this.m_ActorList.SelectedIndices.Add(i); } act = lv.NextActor(); ++i; } this.m_ActorList.EndUpdate(); }
private void AdapterTerrain_Click(object sender, EventArgs e) { NLevel host = NLevelEditorEngine.Instance.MainLevel; if (host != null) { // 找到地形的大小和位置 using (NexusEngineExtension.NWaitCursor waitCursor = new NexusEngineExtension.NWaitCursor(this)) { NActor actor = host.FirstActor(); while (actor != null) { NTerrainActor terrain = actor as NTerrainActor; if (terrain != null) { levelDesc.Location = terrain.Location; levelDesc.Scale = terrain.Scale; levelDesc.Width = Math.Max(levelDesc.Width, terrain.HeightMapWidth); levelDesc.Height = Math.Max(levelDesc.Height, terrain.HeightMapHeight); this.propertyGridNavMapDesc.SelectedObject = levelDesc; break; } actor = host.NextActor(); } } } }
/// <summary> /// 更新Actor列表 /// </summary> /// <param name="lv">需要显示的Level</param> void UpdateActorList(NLevel lv) { NActor edAct = NLevelEditorEngine.Instance.ActorEd.SelectedActor; this.listViewActors.BeginUpdate(); this.listViewActors.Items.Clear(); int i = 0; string filterSearch = this.textBoxSearch.Text.Trim(); bool needFilter = !string.IsNullOrEmpty(filterSearch); StringComparison comparison = this.checkBoxCase.Checked ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; NActor act = lv.FirstActor(); while (act != null) { if (!IsLayerVisible(act.Layer)) { act = lv.NextActor(); continue; } if (needFilter && act.Name.IndexOf(filterSearch, comparison) == -1) { act = lv.NextActor(); continue; } ListViewItem listItem = new ListViewItem(act.Name); listItem.Tag = act; this.listViewActors.Items.Add(listItem); if (edAct == act) { this.listViewActors.SelectedIndices.Add(i); } act = lv.NextActor(); i++; } this.listViewActors.EndUpdate(); }