Beispiel #1
0
        public void RefreshName(IYZDbProvider provider, IDbConnection cn)
        {
            AttachmentInfo attachment = AttachmentManager.TryGetAttachmentInfo(provider, cn, this.FileID);

            if (attachment != null)
            {
                this.FileName = attachment.Name;
            }
            else
            {
                this.FileName = "";
            }

            switch (this.LinkType)
            {
            case ReferenceType.SpriteToSprite:
            case ReferenceType.ProcessToSprite:
                SpriteIdentity identity = BPAManager.TryGetSpriteIdentity(provider, cn, this.FileID, this.SpriteID);
                this.SpriteName = identity != null ? identity.Name : "";
                break;

            default:
                this.SpriteName = "";
                break;
            }
        }
Beispiel #2
0
        public SpriteCollection GetUsedBySprites(IYZDbProvider provider, IDbConnection cn, string property)
        {
            SpriteCollection sprites = new SpriteCollection();

            SpriteLinkCollection links = BPAManager.GetSpriteUsedByLinks(provider, cn, this.File.FileID, this.Id, property);

            foreach (SpriteLink link in links)
            {
                if (link.LinkType != ReferenceType.SpriteToSprite)
                {
                    continue;
                }

                File file = File.TryLoad(provider, cn, link.FileID);

                if (file == null)
                {
                    continue;
                }

                Sprite sprite = file.Sprites.TryGetItem(link.SpriteID);
                if (sprite != null && !sprites.Contains(sprite.File.FileID, sprite.Id))
                {
                    sprites.Add(sprite);
                }
            }

            return(sprites);
        }
Beispiel #3
0
        public FileCollection GetUsedByFiles(IYZDbProvider provider, IDbConnection cn, string property)
        {
            FileCollection files = new FileCollection();

            SpriteLinkCollection links = BPAManager.GetFileUsedByLinks(provider, cn, this.FileID, property);

            foreach (SpriteLink link in links)
            {
                File file = File.TryLoad(provider, cn, link.FileID);

                if (file == null)
                {
                    continue;
                }

                if (files.Contains(file.FileID))
                {
                    continue;
                }

                files.Add(file);
            }

            return(files);
        }
Beispiel #4
0
        public void UpdateSpritesIdentityAndLink(IYZDbProvider provider, IDbConnection cn)
        {
            SpriteIdentityCollection spriteIdentitys = this.Sprites.SortByOrder().Identities;
            SpriteLinkCollection     links           = this.AllSpriteLinks;

            BPAManager.ClearSpriteIdentityOfFile(provider, cn, this.FileID);
            BPAManager.ClearLinkOfFile(provider, cn, this.FileID);

            foreach (SpriteIdentity spriteIdentity in spriteIdentitys)
            {
                BPAManager.Insert(provider, cn, spriteIdentity);
            }

            foreach (SpriteLink link in links)
            {
                BPAManager.Insert(provider, cn, link);
            }
        }
Beispiel #5
0
 static BPAManager()
 {
     BPAManager._instance = new BPAManager();
 }