private SmallDialog_NewTiles_Gfx(MImgsManager imgManagerT, TileGfxContainer tileGfxManagerT) { InitializeComponent(); imgManager = imgManagerT; tileGfxManager = tileGfxManagerT; initParams(); }
//自动生成图片方格 public static int generateTiles(MImgsManager imgManagerT, TileGfxContainer tileGfxManagerT) { number = 0; SmallDialog_NewTiles_Gfx dialog = new SmallDialog_NewTiles_Gfx(imgManagerT, tileGfxManagerT); dialog.ShowDialog(); return number; }
//自动生成图片方格 public static int generateTiles(MImgsManager imgManagerT, TileGfxContainer tileGfxManagerT) { number = 0; SmallDialog_NewTiles_Gfx dialog = new SmallDialog_NewTiles_Gfx(imgManagerT, tileGfxManagerT); dialog.ShowDialog(); return(number); }
public TileGfxManager(MapsManager mapsManagerT, MImgsManager imagesManagerT) { mapsManager = mapsManagerT; imagesManager = imagesManagerT; //加入默认文件夹 TileGfxContainer gfxContainer = new TileGfxContainer(this); this.Add(gfxContainer); }
protected override void updateTo(HistoryValue valueT) { HistoryValue_ImgRename value = (HistoryValue_ImgRename)valueT; value.imgElement.renameImage(value.destName); MImgsManager imgsManager = (MImgsManager)value.imgElement.GetParent(); if (imgsManager != null && imgsManager.MNodeUI != null) { imgsManager.MNodeUI.UpdateItem(value.imgElement.GetID()); } }
public MImgElement Clone(MImgsManager parentT) { MImgElement newElement = new MImgElement(parentT); newElement.name = name + ""; newElement.image = image; newElement.imageTextured = imageTextured; newElement.forbidOptimize = forbidOptimize; newElement.strAlphaImage = strAlphaImage; newElement.strPmt = strPmt; newElement.alpha = alpha; newElement.linkID = linkID; return newElement; }
//复制自己 public TileGfxManager cloneForExport(MapsManager mapsManagerT, MImgsManager imagesManagerT) { TileGfxManager newInstance = new TileGfxManager(mapsManagerT, imagesManagerT); newInstance.RemoveAt(0); for (short i = 0; i < this.Count(); i++) { TileGfxContainer gfxContainer = this[i]; TileGfxContainer newGfxContainer = gfxContainer.cloneForExceport(mapsManagerT, imagesManagerT); newInstance.Add(newGfxContainer); } return(newInstance); }
public TileGfxContainer cloneForExceport(MapsManager mapsManager, MImgsManager imagesManager) { TileGfxContainer newInstance = new TileGfxContainer((TileGfxManager)parent, name); for (int i = 0; i < Count(); i++) { TileGfxElement baseClip = (TileGfxElement)this[i]; TileGfxElement newBaseClip = baseClip.Clone(newInstance); newBaseClip.imageElement = imagesManager[newBaseClip.imageElement.GetID()]; newInstance.Add(newBaseClip); } return(newInstance); }
//获取记录值_图片 private HistoryValue_Imgs getHistoryValue_Imgs() { HistoryValue_Imgs HV_Imgs = new HistoryValue_Imgs(); MImgsManager manager = form_MA.form_MImgsList.mImgsManager; HV_Imgs.imgsManager = manager.CloneReference(); for (int i = 0; i < manager.Count(); i++) { MImgElement img = manager[i]; HV_Imgs.imgsData.Add(img.getMImgData()); } HV_Imgs.imgListIndex = form_MA.form_MImgsList.listBox_Images.SelectedIndex; return(HV_Imgs); }
public int imgListIndex; //图片列表ID public void setDataToImg(MImgsManager mImgsManager) { foreach (MImgData img in imgsData) { img.imgElement.name = img.name; img.imgElement.image = img.image; img.imgElement.imageTextured = img.imageTextured; img.imgElement.imageTextured = img.imageTextured; img.imgElement.strAlphaImage = img.strAlphaImage; img.imgElement.strPmt = img.strPmt; img.imgElement.alpha = img.alpha; img.imgElement.setParent(mImgsManager); } }
//为下拉列表框添加图片选项 private void addItemsToComboBox(ComboBox comboBox) { if (element == null || comboBox == null) { return; } MImgsManager imgsManager = form_Main.mapImagesManager; for (int i = 0; i < imgsManager.Count(); i++) { MImgElement imgElement = imgsManager[i]; comboBox.Items.Add(imgElement.getShowName()); } }
//为下拉列表框添加图片选项 private void addItemsToComboBox(ComboBox comboBox) { if (antetype == null || comboBox == null) { return; } AntetypesManager antetypesManager = (AntetypesManager)antetype.GetTopParent(); MImgsManager imgsManager = antetypesManager.mapsManager.form_Main.form_MAnimation.form_MImgsList.mImgsManager; for (int i = 0; i < imgsManager.Count(); i++) { MImgElement imgElement = imgsManager[i]; comboBox.Items.Add(imgElement.getShowName()); } }
protected override void updateTo(HistoryValue valueT) { HistoryValue_ImgProp value = (HistoryValue_ImgProp)valueT; foreach (ImgProp imgProp in value.imgProps) { MImgElement imgElement = imgProp.imgElement; imgElement.forbidOptimize = imgProp.forbidOptimize; imgElement.strAlphaImage = imgProp.strAlphaImage; imgElement.strPmt = imgProp.strPmt; imgElement.alpha = imgProp.alpha; imgElement.linkID = imgProp.linkID; MImgsManager imgsManager = (MImgsManager)imgElement.GetParent(); if (imgsManager != null && imgsManager.MNodeUI != null) { imgsManager.MNodeUI.UpdateItem(imgElement.GetID()); } } }
private void button_AddMap_Click(object sender, EventArgs e) { if (noEvent || antetype == null) { return; } AntetypesManager antetypesManager = (AntetypesManager)antetype.GetTopParent(); MImgsManager imgsManager = antetypesManager.mapsManager.form_Main.form_MAnimation.form_MImgsList.mImgsManager; if (imgsManager.Count() > 0) { ImageMappingElement element = new ImageMappingElement(imgsManager); element.ImgFrom = imgsManager[0]; element.ImgTo = imgsManager[0]; //添加到数据 antetype.imgMappingList.addElement(element); //添加到UI addImgMapElement(element); //刷新显示 refreshActor(); } }
//下拉列表框事件 private void ComboBox_SelectIndexChanged(object sender, EventArgs e) { if (noEvent || antetype == null) { return; } if (sender is ComboBox) { noEvent = true; ComboBox comboBox = (ComboBox)sender; int ctrID = panel_ImgMap.Controls.IndexOf(comboBox); ImageMappingElement imgMapElement = (ImageMappingElement)antetype.imgMappingList.getElement(ctrID / 3); AntetypesManager antetypesManager = (AntetypesManager)antetype.GetTopParent(); MImgsManager imgsManager = antetypesManager.mapsManager.form_Main.form_MAnimation.form_MImgsList.mImgsManager; if (ctrID % 3 == 1) { imgMapElement.ImgFrom = imgsManager[comboBox.SelectedIndex]; } else if (ctrID % 3 == 2) { imgMapElement.ImgTo = imgsManager[comboBox.SelectedIndex]; } CheckBox checkBox = (CheckBox)panel_ImgMap.Controls[(ctrID / 3) * 3]; if (imgMapElement.ImgFrom.image != null && imgMapElement.ImgTo.image != null && (!imgMapElement.ImgFrom.image.Size.Equals(imgMapElement.ImgTo.image.Size))) { checkBox.Text = "!"; } else { checkBox.Text = ""; } checkBox.Refresh(); //刷新显示 refreshActor(); noEvent = false; } }
public void setParent(MImgsManager parentT) { parent = parentT; }
public MImgElement(String nameT, MImgsManager parentT) { this.parent = parentT; name = nameT; loadImage(); }
//设置管理器 public void setImagesManager(MImgsManager imgManagerT) { imgManager = imgManagerT; }
public MImgElement(MImgsManager parentT) { this.parent = parentT; }
//释放资源 public void releaseRes() { imgManager = null; }
public void resExport_Animation(String subFolderName, String strFormat, SmallDialog_ExportConfig dialogRes) { //克隆会改变的文档数据 animClipsManagerForExport = form_MAnimation.form_MImgsList.MClipsManager.CloneForExport(); animImgsManagerForExport = form_MAnimation.form_MImgsList.mImgsManager.Clone(); animActorsManagerExport = form_MAnimation.form_MActorList.actorsManager.Clone(); //关联引用(动画->切块) MActorsManager MAM = animActorsManagerExport; for (int i1 = 0; i1 < MAM.Count(); i1++) { for (int i2 = 0; i2 < MAM[i1].Count(); i2++) { for (int i3 = 0; i3 < MAM[i1][i2].Count(); i3++) { for (int i4 = 0; i4 < MAM[i1][i2][i3].Count(); i4++) { for (int i5 = 0; i5 < MAM[i1][i2][i3][i4].Count(); i5++) { for (int i6 = 0; i6 < MAM[i1][i2][i3][i4][i5].Count(); i6++) { MFrameUnit unit = MAM[i1][i2][i3][i4][i5][i6]; if (unit is MFrameUnit_Bitmap) { MFrameUnit_Bitmap unitBitmap = (MFrameUnit_Bitmap)unit; unitBitmap.clipElement = animClipsManagerForExport[unitBitmap.clipElement.GetID()]; } } } } } } } //关联引用(切块->图片) for (int i=0;i<animClipsManagerForExport.Count();i++) { MClipElement clip = animClipsManagerForExport[i]; clip.imageElement = animImgsManagerForExport[clip.imageElement.GetID()]; } //清除冗余 animClipsManagerForExport.ClearSpilth(false); //新生成的图片组 MImgsManager mImgsManagerGenerated = new MImgsManager(); //获取链接分组列表 List<List<MImgElement>> allGroups = animImgsManagerForExport.getAllUsedGroups(); //处理优化分组 for (int i = 0; i < allGroups.Count - 1; i++) { List<MImgElement> group = allGroups[i]; Size needSize; int usedSpace; Image imgExort; MImgElement imgElement = MImgsManager.optimizeClips(group, out needSize, out usedSpace, out imgExort, true); mImgsManagerGenerated.Add(imgElement); SaveGenImage(strFormat, subFolderName, imgElement); } //处理禁止优化分组 List<MImgElement> groupForbidOpt = allGroups[allGroups.Count-1]; foreach (MImgElement imgElement in groupForbidOpt) { mImgsManagerGenerated.Add(imgElement); imgElement.image = GraphicsUtil.getMatchImage((Bitmap)imgElement.image); SaveGenImage(strFormat, subFolderName, imgElement); } //变更图片管理器 animImgsManagerForExport = mImgsManagerGenerated; dialogRes.setStep(1, 1); }
//初始化参数=========================================================== public void initData(String path) { path_file = path; path_folder = path_file.Substring(0, path_file.LastIndexOf('\\') + 1); m_HistoryManager = new UndoManager(); m_HistoryManager.MaxUndoLevel = 100; textsManager = new TextsManager(this); mapImagesManager = new MImgsManager(this); mapsManager = new MapsManager(this, mapImagesManager); varIntManager = new VarsManager(this); varStringManager = new VarsManager(this); triggerFunctionManager = new FunctionsManager(this); contextFunctionManager = new FunctionsManager(this); executionFunctionManager = new FunctionsManager(this); iDsManager = new VarsManager(this); propertyTypesManager = new PropertyTypesManager(this); form_MAnimation = new Form_MAnimation(this); mapsManager.initAntetype(form_MAnimation.form_MActorList.actorsManager); if (Consts.PATH_PROJECT_FILEPATH != null) { this.Text = Consts.PATH_PROJECT_FILEPATH; } userDoc.initUserData(path);//读入数据 }
public MParentNode GetTopParent() { MParentNode parent = GetParent(); if (parent != null) { if (!(parent is MSonNode)) { Console.WriteLine("error"); } while (((MSonNode)parent).GetParent() != null) { parent = ((MSonNode)parent).GetParent(); if (!(parent is MSonNode)) { Console.WriteLine("error"); } } } return parent; }
public void releaseRes() { m_HistoryManager=null; textsManager = null; mapImagesManager = null; mapsManager = null; varIntManager = null; varStringManager = null; triggerFunctionManager = null; contextFunctionManager = null; executionFunctionManager = null; //triggersManager = null; propertyTypesManager = null; }
public void resExport_Map(String subFolderName, String strFormat, SmallDialog_ExportConfig dialogRes) { mapImgsManagerForExport = mapImagesManager.Clone(); mapsManagerForExport = mapsManager.cloneForExport(mapImgsManagerForExport); mapsManagerForExport.tileGfxManager.clearSpilth(false); //新生成的图片组 MImgsManager mImgsManagerGenerated = new MImgsManager(); //获取链接分组列表 List<List<MImgElement>> allGroups = mapImgsManagerForExport.getAllUsedGroups(); //处理优化分组 for (int i = 0; i < allGroups.Count - 1; i++) { List<MImgElement> group = allGroups[i]; Size needSize; int usedSpace; Image imgExort; MImgElement imgElement = MImgsManager.optimizeClips(group, out needSize, out usedSpace, out imgExort, true); mImgsManagerGenerated.Add(imgElement); SaveGenImage(strFormat, subFolderName, imgElement); } //处理禁止优化分组 List<MImgElement> groupForbidOpt = allGroups[allGroups.Count - 1]; foreach (MImgElement imgElement in groupForbidOpt) { mImgsManagerGenerated.Add(imgElement); imgElement.image = GraphicsUtil.getMatchImage((Bitmap)imgElement.image); SaveGenImage(strFormat, subFolderName, imgElement); } //变更图片管理器 mapImgsManagerForExport = mImgsManagerGenerated; mapsManagerForExport.tileGfxManager.imagesManager = mapImgsManagerForExport; dialogRes.setStep(1, 1); }
public ImageMappingElement(MImgsManager imagesManagerT) { imagesManager = imagesManagerT; }
public void SetParent(MParentNode parentT) { parent = (MImgsManager)parentT; }