Exemplo n.º 1
0
 //下拉列表框事件
 private void ComboBox_SelectIndexChanged(object sender, EventArgs e)
 {
     if (noEvent || element == null)
     {
         return;
     }
     if (sender is ComboBox)
     {
         noEvent = true;
         ComboBox    comboBox    = (ComboBox)sender;
         int         ctrID       = panel_ImgMap.Controls.IndexOf(comboBox);
         CheckBox    checkBox    = (CheckBox)panel_ImgMap.Controls[(ctrID / 3) * 3];
         ComboBox    combBoxFrom = (ComboBox)panel_ImgMap.Controls[(ctrID / 3) * 3 + 1];
         ComboBox    combBoxTo   = (ComboBox)panel_ImgMap.Controls[(ctrID / 3) * 3 + 2];
         MImgElement ImgFrom     = form_Main.mapImagesManager[combBoxFrom.SelectedIndex];
         MImgElement ImgTo       = form_Main.mapImagesManager[combBoxTo.SelectedIndex];
         if ((ImgFrom == null || ImgTo == null) || (ImgFrom.image != null && ImgTo.image != null && (!ImgFrom.image.Size.Equals(ImgTo.image.Size))))
         {
             checkBox.Text = "!";
         }
         else
         {
             checkBox.Text = "";
         }
         noEvent = false;
     }
 }
Exemplo n.º 2
0
        //自动添加地图元素
        public int generateTiles(MImgElement imgElment, int tileW, int tileH)
        {
            int  number = 0;
            bool full   = false;

            if (imgElment != null)
            {
                for (int j = 0; j < imgElment.getHeight() / tileH; j++)
                {
                    for (int i = 0; i < imgElment.getWidth() / tileW; i++)
                    {
                        TileGfxElement element = new TileGfxElement(this);
                        element.setImageValue(imgElment, new Rectangle(i * tileW, j * tileH, tileW, tileH));
                        if (Add(element))
                        {
                            number++;
                        }
                        else
                        {
                            full = true;
                            break;
                        }
                    }
                    if (full)
                    {
                        break;
                    }
                }
            }
            return(number);
        }
Exemplo n.º 3
0
        public void ReadObject(Stream s)
        {
            int idFrom = IOUtil.readInt(s);

            imgFrom = imagesManager[idFrom];
            int idTo = IOUtil.readInt(s);

            imgTo = imagesManager[idTo];
        }
Exemplo n.º 4
0
        //获取记录值_图片
        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);
        }
Exemplo n.º 5
0
        public void AddHistory_ImgRename(MImgElement imgelement)
        {
            HistoryValue_ImgRename nextValue_ImgRename = new HistoryValue_ImgRename();

            nextValue_ImgRename.imgElement = imgelement;
            nextValue_ImgRename.destName   = imgelement.name;

            HistoryItem_ImgRename item = new HistoryItem_ImgRename(this);

            item.setValue(preValue_ImgRename, nextValue_ImgRename);
            AddItem(item);
            form_MA.refreshHistoryButtons();
            ReadyHistory_ImgRename(imgelement);
        }
Exemplo n.º 6
0
 public void CastSubClipList(MImgElement imgElementNew)
 {
     foreach (OptmizeClip subClip in subClips)
     {
         //将CLIP根据父剪切区的翻转而翻转------------------------
         subClip.clipElement.clipRect.X = clipElement.clipRect.X + subClip.clipElement.clipRect.X - clipRectOld.X;
         subClip.clipElement.clipRect.Y = clipElement.clipRect.Y + subClip.clipElement.clipRect.Y - clipRectOld.Y;
         if (imgElementNew != null)
         {
             subClip.clipElement.imageElement = imgElementNew;
         }
         subClip.CastSubClipList(imgElementNew);
     }
 }
Exemplo n.º 7
0
        //为下拉列表框添加图片选项
        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());
            }
        }
Exemplo n.º 8
0
        //串行化输入与输出===================================================================

        #region MIO Members

        public virtual void ReadObject(System.IO.Stream s)
        {
            short imgElemIndex, x, y, w, h;

            imgElemIndex = IOUtil.readShort(s);
            x            = IOUtil.readShort(s);
            y            = IOUtil.readShort(s);
            w            = IOUtil.readShort(s);
            h            = IOUtil.readShort(s);
            //初始化
            Rectangle   clipRectT     = new Rectangle(x, y, w, h);
            MImgElement imageElementT = clipsManager.ImgsManager[imgElemIndex];

            setImageValue(imageElementT, clipRectT);
        }
        //为下拉列表框添加图片选项
        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());
            }
        }
Exemplo n.º 10
0
 public void CastBaseClip(MImgElement imgElementNew)
 {
     if (optmizeClip != null)
     {
         optmizeClip.clipElement.clipRect.X      = (int)m_dX;
         optmizeClip.clipElement.clipRect.Y      = (int)m_dY;
         optmizeClip.clipElement.clipRect.Width  = (int)m_dWidth;
         optmizeClip.clipElement.clipRect.Height = (int)m_dHeight;
         if (imgElementNew != null)
         {
             optmizeClip.clipElement.imageElement = imgElementNew;
         }
         //映射到子矩形
         optmizeClip.CastSubClipList(imgElementNew);
     }
 }
Exemplo n.º 11
0
        public override void ReadObject(System.IO.Stream s)
        {
            short imgElemIndex, x, y, w, h;

            //读入
            imgElemIndex = IOUtil.readShort(s);
            x            = IOUtil.readShort(s);
            y            = IOUtil.readShort(s);
            w            = IOUtil.readShort(s);
            h            = IOUtil.readShort(s);
            transFlag    = IOUtil.readByte(s);
            //初始化
            Rectangle   clipRectT     = new Rectangle(x, y, w, h);
            MImgElement imageElementT = this.tileGfxContainer.ImgsManager[imgElemIndex];

            setImageValue(imageElementT, clipRectT);
        }
Exemplo n.º 12
0
        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());
                }
            }
        }
Exemplo n.º 13
0
 //获得映射图片
 public static MImgElement getMappedImage(ObjectVector imgMappingList, MImgElement imgElementFrom)
 {
     if (imgMappingList == null)
     {
         return(null);
     }
     for (int i = 0; i < imgMappingList.getElementCount(); i++)
     {
         Object obj = imgMappingList.getElement(i);
         if (!(obj is ImageMappingElement))
         {
             return(null);
         }
         ImageMappingElement imgMaElement = (ImageMappingElement)obj;
         if (imgMaElement.ImgFrom.Equals(imgElementFrom))
         {
             return(imgMaElement.ImgTo);
         }
     }
     return(null);
 }
Exemplo n.º 14
0
 public ArrayList getAllClipsUsingImg(MImgElement p_imgElement)
 {
     if (usingImgClipsList == null)
     {
         usingImgClipsList = new ArrayList();
     }
     else
     {
         usingImgClipsList.Clear();
     }
     if (this.Count() > 0)
     {
         foreach (MClipElement clip in m_sonList)
         {
             if (clip != null && clip.imageElement != null && clip.imageElement.Equals(p_imgElement))
             {
                 usingImgClipsList.Add(clip);
             }
         }
     }
     return(usingImgClipsList);
 }
Exemplo n.º 15
0
 //带图片映射的绘制
 public void display(Graphics g, float destX, float destY, float zoomLevel, byte transFlag, Rect limitClip, int alpha, ObjectVector imgMapList)
 {
     if (imageElement != null)
     {
         MImgElement imageElementMapped = getMappedImage(imgMapList, imageElement);
         if (imgMapList != null && imageElementMapped != null && imageElementMapped.image != null && imageElement.image != null && (imageElementMapped.image.Size.Equals(imageElement.image.Size)))
         {
             GraphicsUtil.drawClip(g, imageElementMapped.image, (int)(destX), (int)(destY), clipRect.X, clipRect.Y, clipRect.Width, clipRect.Height, transFlag, zoomLevel, limitClip, alpha);
         }
         else
         {
             if (imgClip != null)
             {
                 GraphicsUtil.drawClip(g, imgClip, (int)(destX), (int)(destY), 0, 0, imgClip.Width, imgClip.Height, transFlag, zoomLevel, limitClip, alpha);
             }
             else
             {
                 GraphicsUtil.drawClip(g, imageElement.image, (int)(destX), (int)(destY), clipRect.X, clipRect.Y, clipRect.Width, clipRect.Height, transFlag, zoomLevel, limitClip, alpha);
             }
         }
     }
 }
Exemplo n.º 16
0
        public override void ExportObject(System.IO.Stream fs_bin)
        {
            //导出地形风格单元
            short len = (short)this.Count();

            IOUtil.writeShort(fs_bin, len);
            for (short i = 0; i < len; i++)
            {
                TileGfxElement clipElem = (TileGfxElement)this[i];
                clipElem.ExportObject(fs_bin);
            }
            //导出所使用到的图片ID
            ArrayList array = getUsedImgs();

            len = (short)array.Count;
            IOUtil.writeShort(fs_bin, len);
            for (short i = 0; i < len; i++)
            {
                MImgElement imgElement = (MImgElement)array[i];
                short       id         = (short)imgElement.GetID();
                IOUtil.writeShort(fs_bin, id);
            }
        }
Exemplo n.º 17
0
 //获得映射图片
 public MImgElement getMappedImage(MImgElement imgElementFrom)
 {
     return(MClipElement.getMappedImage(imgMappingList, imgElementFrom));
 }
Exemplo n.º 18
0
 //历史记录--------图片重命名
 public void ReadyHistory_ImgRename(MImgElement imgelement)
 {
     preValue_ImgRename            = new HistoryValue_ImgRename();
     preValue_ImgRename.imgElement = imgelement;
     preValue_ImgRename.destName   = imgelement.name;
 }
Exemplo n.º 19
0
 //设置属性
 public void setImageValue(MImgElement p_ImageElement, Rectangle p_clipRect)
 {
     imageElement = p_ImageElement;
     clipRect     = p_clipRect;
     resetImgClip();
 }