示例#1
0
        //串行化输入与输出===================================================================

        #region SerializeAble Members

        public void ReadObject(System.IO.Stream s)
        {
            short            actorFolderIndex = IOUtil.readShort(s);
            short            actorIndex       = IOUtil.readShort(s);
            AntetypesManager antetypesManager = (AntetypesManager)GetTopParent();

            if (actorFolderIndex >= 0 && actorIndex >= 0)
            {
                if (antetypesManager.actorsManager[actorFolderIndex] == null || antetypesManager.actorsManager[actorFolderIndex][actorIndex] == null)
                {
                    MessageBox.Show("角色原型中动画索引丢失,需重新指定。", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    this.Actor = antetypesManager.actorsManager[actorFolderIndex][actorIndex];
                }
            }
            name = IOUtil.readString(s);
            int imgMappingLen = IOUtil.readInt(s);

            for (int i = 0; i < imgMappingLen; i++)
            {
                ImageMappingElement imgMapElement = new ImageMappingElement(antetypesManager.mapsManager.form_Main.form_MAnimation.form_MImgsList.mImgsManager);
                imgMapElement.ReadObject(s);
                imgMappingList.addElement(imgMapElement);
            }
        }
示例#2
0
 public bool equalsAnteType(Antetype antetype)
 {
     if (!equalsNameAndFolder(antetype))
     {
         return(false);
     }
     if (imgMappingList.getElementCount() != antetype.imgMappingList.getElementCount())
     {
         return(false);
     }
     for (int i = 0; i < imgMappingList.getElementCount(); i++)
     {
         ImageMappingElement imgMapElementLocal   = (ImageMappingElement)imgMappingList.getElement(i);
         ImageMappingElement imgMapElementCompare = (ImageMappingElement)antetype.imgMappingList.getElement(i);
         if (!imgMapElementLocal.ImgFrom.Equals(imgMapElementCompare.ImgFrom))
         {
             return(false);
         }
         if (!imgMapElementLocal.ImgTo.Equals(imgMapElementCompare.ImgTo))
         {
             return(false);
         }
     }
     return(true);
 }
 //图片映射界面刷新
 private void refreshImgMapList()
 {
     for (int i = 0; i < antetype.imgMappingList.getElementCount(); i++)
     {
         ImageMappingElement imgMapElent = (ImageMappingElement)antetype.imgMappingList.getElement(i);
         addImgMapElement(imgMapElent);
     }
 }
示例#4
0
        public ImageMappingElement clone()
        {
            ImageMappingElement newInstance = new ImageMappingElement(imagesManager);

            newInstance.imgFrom = imgFrom;
            newInstance.imgTo   = imgTo;
            return(newInstance);
        }
示例#5
0
        public Antetype clone(AntetypeFolder folder)
        {
            Antetype newInstance = new Antetype(folder, Actor);

            newInstance.name = name;
            for (int i = 0; i < imgMappingList.getElementCount(); i++)
            {
                ImageMappingElement imgMapElement    = (ImageMappingElement)imgMappingList.getElement(i);
                ImageMappingElement newImgMapElement = imgMapElement.clone();
                newInstance.imgMappingList.addElement(newImgMapElement);
            }
            return(newInstance);
        }
 private SmallDialog_Stage(String text, bool create)
 {
     InitializeComponent();
     textBox_mapName.Text = element.name;
     this.Text            = text;
     if (!create)
     {
         //图片映射表
         for (int i = 0; i < element.imgMappingList.getElementCount(); i++)
         {
             ImageMappingElement imgMapElement = (ImageMappingElement)element.imgMappingList.getElement(i);
             addImgMapElement(imgMapElement);
         }
     }
 }
        //向图片映射列表中添加一条数据
        private void addImgMapElement(ImageMappingElement imgMapElement)
        {
            CheckBox checkBox = new CheckBox();

            checkBox.Width = 24;

            ComboBox boxMapFrom = new ComboBox();

            boxMapFrom.Width            = (panel_ImgMap.Width - 60) / 2;
            boxMapFrom.DropDownStyle    = ComboBoxStyle.DropDownList;
            boxMapFrom.MaxDropDownItems = 20;
            addItemsToComboBox(boxMapFrom);
            boxMapFrom.SelectedIndexChanged += new EventHandler(ComboBox_SelectIndexChanged);

            ComboBox boxMapTo = new ComboBox();

            boxMapTo.Width            = (panel_ImgMap.Width - 60) / 2;
            boxMapTo.DropDownStyle    = ComboBoxStyle.DropDownList;
            boxMapTo.MaxDropDownItems = 20;
            addItemsToComboBox(boxMapTo);
            boxMapTo.SelectedIndexChanged += new EventHandler(ComboBox_SelectIndexChanged);


            panel_ImgMap.Controls.Add(checkBox);
            panel_ImgMap.Controls.Add(boxMapFrom);
            panel_ImgMap.Controls.Add(boxMapTo);

            if (imgMapElement != null)
            {
                noEvent = true;
                if (imgMapElement.ImgFrom != null)
                {
                    boxMapFrom.SelectedIndex = imgMapElement.ImgFrom.GetID();
                }
                if (imgMapElement.ImgTo != null)
                {
                    boxMapTo.SelectedIndex = imgMapElement.ImgTo.GetID();
                }
                if (imgMapElement.ImgFrom.image != null && imgMapElement.ImgTo.image != null && (!imgMapElement.ImgFrom.image.Size.Equals(imgMapElement.ImgTo.image.Size)))
                {
                    checkBox.Text = "!";
                }
                noEvent = false;
            }
        }
 private void button_OK_Click(object sender, EventArgs e)
 {
     if (element != null)
     {
         element.name = (textBox_mapName.Text.Trim());
     }
     //图片映射表
     element.imgMappingList.removeAll();
     for (int i = 0; i < panel_ImgMap.Controls.Count / 3; i++)
     {
         ComboBox            comboBoxFrom  = (ComboBox)panel_ImgMap.Controls[i * 3 + 1];
         ComboBox            comboBoxTo    = (ComboBox)panel_ImgMap.Controls[i * 3 + 2];
         ImageMappingElement imgMapElement = new ImageMappingElement(form_Main.mapImagesManager);
         imgMapElement.ImgFrom = form_Main.mapImagesManager[comboBoxFrom.SelectedIndex];
         imgMapElement.ImgTo   = form_Main.mapImagesManager[comboBoxTo.SelectedIndex];
         element.imgMappingList.addElement(imgMapElement);
     }
     this.Close();
 }
示例#9
0
        public void WriteObject(System.IO.Stream s)
        {
            if (Actor == null)
            {
                IOUtil.writeShort(s, -1);
                IOUtil.writeShort(s, -1);
            }
            else
            {
                IOUtil.writeShort(s, (short)((MActorFolder)Actor.GetParent()).GetID());
                IOUtil.writeShort(s, (short)Actor.GetID());
            }
            IOUtil.writeString(s, name);
            int imgMappingLen = imgMappingList.getElementCount();

            IOUtil.writeInt(s, imgMappingLen);
            for (int i = 0; i < imgMappingLen; i++)
            {
                ImageMappingElement imgMapElement = (ImageMappingElement)imgMappingList.getElement(i);
                imgMapElement.WriteObject(s);
            }
        }
        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;
     }
 }