//获取所有用到此图片的切块列表 public List <MClipElement> getAllClipsUsingMe() { List <MClipElement> list = new List <MClipElement>(); if (parent.Equals(parent.form_Main.mapImagesManager))//地图图片 { TileGfxManager tileGfxManager = parent.form_Main.mapsManager.tileGfxManager; for (int i = 0; i < tileGfxManager.Count(); i++) { for (int j = 0; j < tileGfxManager[i].Count(); j++) { MClipElement clip = tileGfxManager[i][j]; if (clip.imageElement != null && clip.imageElement.Equals(this)) { list.Add(clip); } } } } else if (parent.Equals(parent.form_Main.form_MAnimation.form_MImgsList.mImgsManager))//动画图片 { MClipsManager mClipsManager = parent.form_Main.form_MAnimation.form_MImgsList.MClipsManager; for (int i = 0; i < mClipsManager.Count(); i++) { MClipElement clip = mClipsManager[i]; if (clip.imageElement != null && clip.imageElement.Equals(this)) { list.Add(clip); } } } else if (parent.Equals(parent.form_Main.animImgsManagerForExport))//导出用动画图片 { MClipsManager mClipsManager = parent.form_Main.animClipsManagerForExport; for (int i = 0; i < mClipsManager.Count(); i++) { MClipElement clip = mClipsManager[i]; if (clip.imageElement != null && clip.imageElement.Equals(this)) { list.Add(clip); } } } else if (parent.Equals(parent.form_Main.mapImgsManagerForExport))//导出用地图图片 { TileGfxManager tileGfxManager = parent.form_Main.mapsManagerForExport.tileGfxManager; for (int i = 0; i < tileGfxManager.Count(); i++) { for (int j = 0; j < tileGfxManager[i].Count(); j++) { MClipElement clip = tileGfxManager[i][j]; if (clip.imageElement != null && clip.imageElement.Equals(this)) { list.Add(clip); } } } } return(list); }
public SmallDialog_NewMap(String text, TileGfxManager tileGfxManagerT,bool create) { InitializeComponent(); tileGfxManager=tileGfxManagerT; comboBox_Style.Items.Clear(); for (int i = 0; i < tileGfxManager.Count(); i++) { comboBox_Style.Items.Add(tileGfxManager[i].name); } byte expFlag = 55; if (!create) { textBox_mapName.Text = element.getName(); numericUpDown_TileW.Value = element.getTileW(); numericUpDown_TileH.Value = element.getTileH(); numericUpDown_MapW.Value = element.getMapW(); numericUpDown_MapH.Value = element.getMapH(); comboBox_mapType.SelectedIndex = element.getMapType() - MapElement.TYPE_COMMON; comboBox_Style.SelectedIndex = element.tileGfxContainer.GetID(); comboBox_Style.Enabled = false; panel_MapColor.BackColor = GraphicsUtil.getColor(element.getColor()); //地图类型 if (element.getMapType() == MapElement.TYPE_COMMON) { comboBox_mapType.SelectedIndex = 0; } else if (element.getMapType() == MapElement.TYPE_45) { comboBox_mapType.SelectedIndex = 1; } //地图导出标记 expFlag = element.getMapExpFlag(); } else { comboBox_Style.Enabled = true; comboBox_mapType.SelectedIndex = 0; comboBox_Style.SelectedIndex = 0; } //地图导出标记 for (int i = 0; i < checkedListBox_Level.Items.Count; i++) { if ((expFlag & (1 << i)) != 0) { checkedListBox_Level.SetItemChecked(i, true); } else { checkedListBox_Level.SetItemChecked(i, false); } } this.Text = text; }
public int getUsedTime(bool includeMapping) { int usedTime = 0; if (parent.Equals(parent.form_Main.mapImagesManager))//地图图片 { TileGfxManager tileGfxManager = parent.form_Main.mapsManager.tileGfxManager; for (int i = 0; i < tileGfxManager.Count(); i++) { for (int j = 0; j < tileGfxManager[i].Count(); j++) { MClipElement clip = tileGfxManager[i][j]; if (clip.imageElement != null && clip.imageElement.Equals(this)) { usedTime++; } } } } else if (parent.Equals(parent.form_Main.form_MAnimation.form_MImgsList.mImgsManager))//动画图片 { MClipsManager mClipsManager = parent.form_Main.form_MAnimation.form_MImgsList.MClipsManager; for (int i = 0; i < mClipsManager.Count(); i++) { MClipElement clip = mClipsManager[i]; if (clip.imageElement != null && clip.imageElement.Equals(this)) { usedTime++; } } } else if (parent.Equals(parent.form_Main.animImgsManagerForExport))//导出用动画图片 { MClipsManager mClipsManager = parent.form_Main.animClipsManagerForExport; for (int i = 0; i < mClipsManager.Count(); i++) { MClipElement clip = mClipsManager[i]; if (clip.imageElement != null && clip.imageElement.Equals(this)) { usedTime++; } } } else if (parent.Equals(parent.form_Main.mapImgsManagerForExport))//导出用地图图片 { TileGfxManager tileGfxManager = parent.form_Main.mapsManagerForExport.tileGfxManager; for (int i = 0; i < tileGfxManager.Count(); i++) { for (int j = 0; j < tileGfxManager[i].Count(); j++) { MClipElement clip = tileGfxManager[i][j]; if (clip.imageElement != null && clip.imageElement.Equals(this)) { usedTime++; } } } } //...其它映射表检查 return(usedTime); }
//合并图片资源 public void combine(MImgsManager src_ImgsManager) { //检查子文件夹 if (!Directory.Exists(Consts.PATH_PROJECT_FOLDER + Consts.SUBPARH_IMG)) { Directory.CreateDirectory(Consts.PATH_PROJECT_FOLDER + Consts.SUBPARH_IMG); } int res = 0; //合并 for (int i = 0; i < src_ImgsManager.Count(); i++) { MImgElement srcElement = src_ImgsManager[i]; String nameSrc = srcElement.name; MImgElement newElement = null; bool findSameName = false; MImgElement localElement = null; //同名检查 for (int j = 0; j < this.Count(); j++) { localElement = this[j]; if (localElement.equalsOnName(srcElement))//发现相同的文件名 { findSameName = true; break; } } //同名处理 if (findSameName) { if (res < 2) { res = SmallDialog_MessageBox.getResult("覆盖", "忽略", "全部覆盖", "全部忽略", "发现相同的图片资源“" + localElement.name + "”"); } if (res == 0 || res == 2)//覆盖 { if (!srcElement.getFullName().Equals(localElement.getFullName())) { IOUtil.Copy(srcElement.getFullName(), localElement.getFullName(), true); if (!srcElement.strAlphaImage.Equals("")) { IOUtil.Copy(srcElement.getFullAlphaName(), localElement.getFullAlphaName(srcElement.strAlphaImage), true); } if (!srcElement.strPmt.Equals("")) { IOUtil.Copy(srcElement.getFullPmtName(), localElement.getFullPmtName(srcElement.strPmt), true); } } localElement.loadImage(); newElement = localElement; } else if (res == 1 || res == 3)//忽略新资源 { newElement = localElement; } } else { newElement = srcElement;//.Clone(this); this.Add(newElement); IOUtil.Copy(srcElement.getFullName(), newElement.getFullName(srcElement.name), true); if (!srcElement.strAlphaImage.Equals("")) { IOUtil.Copy(srcElement.getFullAlphaName(), localElement.getFullAlphaName(srcElement.strAlphaImage), true); } if (!srcElement.strPmt.Equals("")) { IOUtil.Copy(srcElement.getFullPmtName(), localElement.getFullPmtName(srcElement.strPmt), true); } newElement.loadImage(); } if (this.Equals(form_Main.mapImagesManager))//地图图片 { TileGfxManager tileGfxManager = form_Main.mapsManager.tileGfxManager; for (int iCM = 0; iCM < tileGfxManager.Count(); iCM++) { MClipsManager clipsManagerElement = tileGfxManager[iCM]; for (int k = 0; k < clipsManagerElement.Count(); k++) { MClipElement element = clipsManagerElement[k]; if (element.imageElement != null && element.imageElement.Equals(srcElement)) { element.imageElement = newElement; } } } } else if (this.Equals(form_Main.form_MAnimation.form_MImgsList.mImgsManager))//动画图片 { MClipsManager mClipsManager = form_Main.form_MAnimation.form_MImgsList.MClipsManager; MClipsManager clipsManagerElement = mClipsManager; for (int k = 0; k < clipsManagerElement.Count(); k++) { MClipElement element = clipsManagerElement[k]; if (element.imageElement != null && element.imageElement.Equals(srcElement)) { element.imageElement = newElement; } } } } }