Пример #1
0
        public ActorInfo Add(SpriteInfo info)
        {
            if (info == null)
                return null;

            ActorInfo newActor = new ActorInfo();
            newActor.Name = info.Name;
            newActor.SpriteInfo = info;

            newActor.Anchors.Add(new AnchorInfo(0));

            m_actorlist.Add(newActor);

            m_bModify = true;

            return newActor;
        }
Пример #2
0
        public SpriteInfo Add( int cate, string name, string path)
        {
            if (cate < 0) return null;

            if ( IsExist( cate, name ) )
            {
                MessageBox.Show("동일한 이름이 이미 존재 합니다.");
                return null;
            }
            SpriteInfo newUnit = new SpriteInfo();

            newUnit.Name = name;
            newUnit.Path = ((E_Entity)cate).ToString() +"/"+ path;

            m_spriteCate[cate].Add(newUnit);

            return newUnit;
        }
Пример #3
0
        public TPoint GetSpritePos( SpriteInfo info, AnchorInfo anchor)
        {
            if (anchor.Bmp == null)
                return new TPoint(0, 0);

            int index = anchor.Index;
            ImgData imgData = info.ImgList[index];
            TPoint offset = imgData.Pivot;

            if (anchor.XFlip)
            {
                offset.X = anchor.Bmp.Width - imgData.Pivot.X;
            }
            if (anchor.YFlip)
            {
                offset.Y = anchor.Bmp.Height - imgData.Pivot.Y;
            }
            return new TPoint(m_center.X - offset.X, m_center.Y - offset.Y);
        }
Пример #4
0
        public bool FindSpriteUnit(string name,out SpriteInfo sprite ,int cate = -1 )
        {
            sprite = null;

            if (cate == -1)
                cate = m_selectCate;

            if (cate < 0)
                return false;

            foreach (SpriteInfo unit in m_spriteCate[cate])
            {
                if (unit.Name == name)
                {
                    sprite = unit;
                    return true;
                }
            }

            return false;
        }
Пример #5
0
        public void Delete(SpriteInfo unit)
        {
            if (m_selectCate < 0) return;

            m_spriteCate[m_selectCate].Remove(unit);
        }
Пример #6
0
        public void Read(Stream stream)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(stream);
            XmlNode rootNode = doc.SelectSingleNode("SpriteList");
            _version = GenericXmlReader.ReadIntAttribute(rootNode, "version");

            XmlNodeList cateNode = rootNode.SelectNodes("Cate");
            foreach (XmlNode node in cateNode)
            {
                string name = GenericXmlReader.ReadStringAttribute(node, "name");
                int cate = GenericXmlReader.ReadIntAttribute(node, "index");

                XmlNodeList spriteNode = node.SelectNodes("sprite");

                foreach (XmlNode snode in spriteNode)
                {
                    SpriteInfo sprite = new SpriteInfo();
                    sprite.Read(snode);
                    sprite.Cate = (E_Entity)cate;
                    //sprite.Path = ((E_Entity)cate).ToString() + "/" + sprite.Path;
                    m_spriteCate[cate].Add(sprite);
                }
            }
        }
Пример #7
0
        public void LoadSpriteUnit(SpriteInfo unit)
        {
            if (unit == null) return;
            if (m_spritePath != unit.Path)
            {
                LoadPath(unit.Path);
            }

            UpdateSprite();
        }
Пример #8
0
        public void LoadBmp( Main main , SpriteInfo sprite )
        {
            string path = main.Browser.GetFileFullPath(IODataType.Image, sprite.Path);

            if ( main.DevImage.Load(path))
            {
                ImgData img = sprite.ImgList[m_index];
                Bmp = main.DevImage.Crop(img.Region.Left, img.Region.Top, img.Region.Width, img.Region.Height);

                if (m_XFlip)
                {
                    Bmp.RotateFlip(RotateFlipType.RotateNoneFlipX);
                }
                if (m_YFlip)
                {
                    Bmp.RotateFlip(RotateFlipType.RotateNoneFlipY);
                }
            }
        }
Пример #9
0
 public void Init(SpriteInfo info, int _index)
 {
     m_sprite = info;
     m_anchor = new AnchorInfo(_index);
 }