Ejemplo n.º 1
0
        //获取所有用到此图片的切块列表
        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 MClipElement Clone(MClipsManager p_baseClipsManagerT)
 {
     MClipElement newClip = new MClipElement(p_baseClipsManagerT);
     newClip.imageElement = imageElement;
     newClip.clipRect = clipRect;
     newClip.imgClip = imgClip;
     return newClip;
 }
Ejemplo n.º 3
0
 //更新列表中的图片单元中的图片
 public void reloadImageElements()
 {
     foreach (MImgElement imgElem in m_sonList)
     {
         imgElem.loadImage();
     }
     if (this.Equals(form_Main.mapImagesManager))//地图图片
     {
         TileGfxManager tileGfxManager = form_Main.mapsManager.tileGfxManager;
         tileGfxManager.resetImgClips();
     }
     else if (this.Equals(form_Main.form_MAnimation.form_MImgsList.mImgsManager))//动画图片
     {
         MClipsManager mClipsManager = form_Main.form_MAnimation.form_MImgsList.MClipsManager;
         mClipsManager.resetImgClips();
     }
 }
Ejemplo n.º 4
0
 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 setBaseClipsManager(MClipsManager baseClipsManager)
 {
     this.baseClipsManager = baseClipsManager;
 }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
 public void setBaseClipsManager(MClipsManager baseClipsManager)
 {
     this.baseClipsManager = baseClipsManager;
 }
Ejemplo n.º 8
0
        //合并图片资源
        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;
                        }
                    }
                }
            }
        }
 public MClipElement(MClipsManager clipManagerT)
 {
     clipsManager = clipManagerT;
 }
Ejemplo n.º 10
0
 public void SetParent(MParentNode parent)
 {
     clipsManager = (MClipsManager)parent;
 }