public static Attachment GetRemappedClone(this Attachment o, AtlasRegion atlasRegion, bool cloneMeshAsLinked = true, bool useOriginalRegionSize = false, float scale = 0.01f)
        {
            RegionAttachment attachment = o as RegionAttachment;

            if (attachment != null)
            {
                RegionAttachment clone = attachment.GetClone();
                clone.SetRegion(atlasRegion, false);
                if (!useOriginalRegionSize)
                {
                    clone.width  = atlasRegion.width * scale;
                    clone.height = atlasRegion.height * scale;
                }
                clone.UpdateOffset();
                return(clone);
            }
            MeshAttachment attachment3 = o as MeshAttachment;

            if (attachment3 != null)
            {
                MeshAttachment attachment4 = !cloneMeshAsLinked?attachment3.GetClone() : attachment3.GetLinkedClone(cloneMeshAsLinked);

                attachment4.SetRegion(atlasRegion, true);
                return(attachment4);
            }
            return(o.GetClone(true));
        }
Esempio n. 2
0
        public static Attachment GetClone(this Attachment o, bool cloneMeshesAsLinked)
        {
            RegionAttachment regionAttachment = o as RegionAttachment;

            if (regionAttachment != null)
            {
                return(regionAttachment.GetClone());
            }
            MeshAttachment meshAttachment = o as MeshAttachment;

            if (meshAttachment != null)
            {
                return((!cloneMeshesAsLinked) ? meshAttachment.GetClone() : meshAttachment.GetLinkedClone());
            }
            BoundingBoxAttachment boundingBoxAttachment = o as BoundingBoxAttachment;

            if (boundingBoxAttachment != null)
            {
                return(boundingBoxAttachment.GetClone());
            }
            PathAttachment pathAttachment = o as PathAttachment;

            if (pathAttachment != null)
            {
                return(pathAttachment.GetClone());
            }
            PointAttachment pointAttachment = o as PointAttachment;

            if (pointAttachment != null)
            {
                return(pointAttachment.GetClone());
            }
            return((o as ClippingAttachment)?.GetClone());
        }
Esempio n. 3
0
        public static Attachment GetRemappedClone(this Attachment o, AtlasRegion atlasRegion, bool cloneMeshAsLinked = true, bool useOriginalRegionSize = false, float scale = 0.01f)
        {
            RegionAttachment regionAttachment = o as RegionAttachment;

            if (regionAttachment != null)
            {
                RegionAttachment clone = regionAttachment.GetClone();
                clone.SetRegion(atlasRegion, updateOffset: false);
                if (!useOriginalRegionSize)
                {
                    clone.width  = (float)atlasRegion.width * scale;
                    clone.height = (float)atlasRegion.height * scale;
                }
                clone.UpdateOffset();
                return(clone);
            }
            MeshAttachment meshAttachment = o as MeshAttachment;

            if (meshAttachment != null)
            {
                MeshAttachment meshAttachment2 = (!cloneMeshAsLinked) ? meshAttachment.GetClone() : meshAttachment.GetLinkedClone(cloneMeshAsLinked);
                meshAttachment2.SetRegion(atlasRegion);
                return(meshAttachment2);
            }
            return(o.GetClone(cloneMeshesAsLinked: true));
        }
        public static Attachment GetClone(this Attachment o, bool cloneMeshesAsLinked)
        {
            RegionAttachment attachment = o as RegionAttachment;

            if (attachment != null)
            {
                return(attachment.GetClone());
            }
            MeshAttachment attachment2 = o as MeshAttachment;

            if (attachment2 != null)
            {
                return(!cloneMeshesAsLinked ? attachment2.GetClone() : attachment2.GetLinkedClone(true));
            }
            BoundingBoxAttachment attachment3 = o as BoundingBoxAttachment;

            if (attachment3 != null)
            {
                return(attachment3.GetClone());
            }
            PathAttachment attachment4 = o as PathAttachment;

            if (attachment4 != null)
            {
                return(attachment4.GetClone());
            }
            PointAttachment attachment5 = o as PointAttachment;

            if (attachment5 != null)
            {
                return(attachment5.GetClone());
            }
            ClippingAttachment attachment6 = o as ClippingAttachment;

            if (attachment6 != null)
            {
                return(attachment6.GetClone());
            }
            return(null);
        }