//(角色文件夹列表)删除单元 public void deleteActorFolder() { if (currentActorFolder == null) { return; } if (!MessageBox.Show("确定删除角色文件夹 [" + currentActorFolder.name + "]?", "删除角色文件夹", MessageBoxButtons.YesNo, MessageBoxIcon.Warning).Equals(DialogResult.Yes)) { return; } form_MA.historyManager.ReadyHistory(HistoryType.Actor); //先删除文件夹中的内容 while (currentActorFolder.Count() > 0) { currentActorFolder.RemoveAt(0); } int index = currentActorFolder.GetID(); if (actorsManager.RemoveAt(index)) { updateTreeView_Animation(); int newIndex = index - 1; if (newIndex < 0 && actorsManager.Count() > 0) { newIndex = 0; } setCurrentActorFolder(newIndex, true, 0); } form_MA.historyManager.AddHistory(HistoryType.Actor); }
//在treeView中初始化当前结构 public void updateTreeView_Animation() { treeView_Animation.Nodes.Clear(); for (int i = 0; i < actorsManager.Count(); i++) { TreeNode actorFolderNode = new TreeNode(); MActorFolder actorFolder = actorsManager[i]; currentActorFolder = actorFolder; actorFolderNode.Text = actorFolder.name; actorFolderNode.ImageIndex = 0; actorFolderNode.SelectedImageIndex = 0; for (int j = 0; j < actorFolder.Count(); j++) { TreeNode actorNode = new TreeNode(); MActor actor = actorFolder[j]; currentActorElement = actor; actorNode.Text = actor.name; actorNode.ImageIndex = 1; actorNode.SelectedImageIndex = 1; for (int k = 0; k < actor.Count(); k++) { TreeNode actionNode = new TreeNode(); MAction action = actor[k]; currentActionElement = action; actionNode.Text = action.name; actionNode.ImageIndex = 2; actionNode.SelectedImageIndex = 2; actorNode.Nodes.Add(actionNode); } actorFolderNode.Nodes.Add(actorNode); } treeView_Animation.Nodes.Add(actorFolderNode); } treeView_Animation.ExpandAll(); }
//刷新记录 private void refreshMemory() { actors.Clear(); MActorFolder folder = actorsManager[comboBox_folder.SelectedIndex]; for (int i = 0; i < folder.Count(); i++) { if (listBox_Actors.GetItemChecked(i)) { MActor actor = folder[i]; actors.Add(new ActorAndFolder(folder, actor)); } } }
//(角色列表)向下移动单元 public void moveDownActorElement() { if (currentActorElement == null || currentActorFolder == null) { return; } form_MA.historyManager.ReadyHistory(HistoryType.Actor); MActor actor = currentActorElement; MActorFolder actorFolder = currentActorFolder; int index = actorFolder.GetSonID(actor); if (!actorFolder.MoveDownElement(index)) { return; } updateTreeNode_ActorFolder(); index++; if (index > actorFolder.Count() - 1) { index = actorFolder.Count() - 1; } setCurrentActor(index, true, 1); form_MA.historyManager.AddHistory(HistoryType.Actor); }
//刷新可选角色列表 private void refreshActorList() { AntetypesManager antetypesManager = (AntetypesManager)antetype.GetTopParent(); MActorFolder actorsFolder = antetypesManager.actorsManager[comboBox_folder.SelectedIndex]; comboBox_Actor.Items.Clear(); if (actorsFolder != null) { for (int i = 0; i < actorsFolder.Count(); i++) { MActor actor = actorsFolder[i]; comboBox_Actor.Items.Add(actor.name); } } }
private void refreshActorList() { if (actorsManager == null) { return; } if (comboBox_folder.Items.Count <= 0) { return; } MActorFolder folder = actorsManager[comboBox_folder.SelectedIndex]; listBox_Actors.Items.Clear(); for (int i = 0; i < folder.Count(); i++) { MActor actor = folder[i]; listBox_Actors.Items.Add(actor.name); } }
//(角色文件夹列表)设置当前文件夹(foxID代表将要设置焦点的层级) public void setCurrentActorFolder(int index, bool updateUI, int foxID) { //if (index < 0 || index >= actorsManager.Size()) //{ // return; //} currentActorFolder = actorsManager[index]; if (currentActorFolder != null && foxID == 0) { Form_MAnimation.noNodeEvent = true; treeView_Animation.SelectedNode = treeView_Animation.Nodes[currentActorFolder.GetID()]; Form_MAnimation.noNodeEvent = false; } if (updateUI) { int id = -1; if (currentActorFolder!=null && currentActorFolder.Count() > 0) { id = 0; } setCurrentActor(id, true, foxID); } }
//(角色文件夹列表)设置当前文件夹(foxID代表将要设置焦点的层级) public void setCurrentActorFolder(int index, bool updateUI, int foxID) { //if (index < 0 || index >= actorsManager.Size()) //{ // return; //} currentActorFolder = actorsManager[index]; if (currentActorFolder != null && foxID == 0) { Form_MAnimation.noNodeEvent = true; treeView_Animation.SelectedNode = treeView_Animation.Nodes[currentActorFolder.GetID()]; Form_MAnimation.noNodeEvent = false; } if (updateUI) { int id = -1; if (currentActorFolder != null && currentActorFolder.Count() > 0) { id = 0; } setCurrentActor(id, true, foxID); } }
//刷新数据显示======================================================== public void updateRes() { //载入地图 listBox_Maps.Items.Clear(); for (int i = 0; i < srcForm.mapsManager.getElementCount(); i++) { String text = "" + srcForm.mapsManager.getElement(i).getName(); listBox_Maps.Items.Add(text); } listBox_Maps.Refresh(); //载入角色原型 ListBox_AnteType.Items.Clear(); for (int i = 0; i < srcForm.mapsManager.antetypesManager.Count(); i++) { AntetypeFolder folder = srcForm.mapsManager.antetypesManager[i]; for (int j = 0; j < folder.Count(); j++) { Antetype anteType = folder[i]; String text = ""; if (anteType != null) { text = "[" + anteType.getFolderName() + "]" + anteType.name; if (anteType.Actor == null) { MessageBox.Show("角色原型“" + anteType.name + "”指向的角色为空!", "警告", MessageBoxButtons.OK); } } else { text = "错误的角色原型"; } ListBox_AnteType.Items.Add(text); } } ListBox_AnteType.Refresh(); //载入动画 listBox_Anims.Items.Clear(); MActorsManager actorsManager = srcForm.form_MAnimation.form_MActorList.actorsManager; for (int i = 0; i < actorsManager.Count(); i++) { MActorFolder folder = actorsManager[i]; for (int j = 0; j < folder.Count(); j++) { MActor actor = folder[j]; String text = folder.name + "_" + actor.name; listBox_Anims.Items.Add(text); } } listBox_Anims.Refresh(); //载入触发器 listBox_Triggers.Items.Clear(); listBox_Triggers.Refresh(); //载入属性表 listBox_Props.Items.Clear(); for (int i = 0; i < srcForm.propertyTypesManager.getElementCount(); i++) { String text = "" + ((PropertyTypeElement)srcForm.propertyTypesManager.getElement(i)).name; listBox_Props.Items.Add(text); } listBox_Props.Refresh(); }