FindRegion() публичный Метод

Returns the first region found with the specified name. This method uses string comparison to find the region, so the result should be cached rather than calling this method multiple times.
public FindRegion ( String name ) : AtlasRegion
name String
Результат AtlasRegion
Пример #1
0
		public RegionAttachment NewRegionAttachment (Skin skin, String name, String path) {
			AtlasRegion region = atlas.FindRegion(path);
			if (region == null) throw new Exception("Region not found in atlas: " + path + " (region attachment: " + name + ")");
			RegionAttachment attachment = new RegionAttachment(name);
			attachment.RendererObject = region;
			attachment.SetUVs(region.u, region.v, region.u2, region.v2, region.rotate);
			attachment.regionOffsetX = region.offsetX;
			attachment.regionOffsetY = region.offsetY;
			attachment.regionWidth = region.width;
			attachment.regionHeight = region.height;
			attachment.regionOriginalWidth = region.originalWidth;
			attachment.regionOriginalHeight = region.originalHeight;
			return attachment;
		}
Пример #2
0
        public Attachment NewAttachment(Skin skin, AttachmentType type, String name)
        {
            switch (type)
            {
            case AttachmentType.region:
                AtlasRegion region = atlas.FindRegion(name);
                if (region == null)
                {
                    throw new Exception("Region not found in atlas: " + name + " (" + type + ")");
                }
                RegionAttachment attachment = new RegionAttachment(name);
                attachment.RendererObject = region;
                attachment.SetUVs(region.u, region.v, region.u2, region.v2, region.rotate);
                attachment.regionOffsetX        = region.offsetX;
                attachment.regionOffsetY        = region.offsetY;
                attachment.regionWidth          = region.width;
                attachment.regionHeight         = region.height;
                attachment.regionOriginalWidth  = region.originalWidth;
                attachment.regionOriginalHeight = region.originalHeight;
                return(attachment);

            case AttachmentType.boundingbox:
                return(new BoundingBoxAttachment(name));
            }
            throw new Exception("Unknown attachment type: " + type);
        }
Пример #3
0
        /// <return>May be null to not load any attachment.</return>
        public RegionAttachment NewRegionAttachment(Skin skin, string name, string path)
        {
            var attachment = new RegionAttachment(name);
            var region     = mAtlas.FindRegion(name);

            // if (region == null) throw new Error("Region not found in atlas: " + name);
            attachment.RendererObject = region;
            return(attachment);
        }
		void Apply (SkeletonRenderer skeletonRenderer) {
			atlas = atlasAsset.GetAtlas();
			float scale = skeletonRenderer.skeletonDataAsset.scale;

			var enumerator = attachments.GetEnumerator();
			while (enumerator.MoveNext()) {
				var entry = (SlotRegionPair)enumerator.Current;

				var slot = skeletonRenderer.skeleton.FindSlot(entry.slot);
				var region = atlas.FindRegion(entry.region);
				slot.Attachment = region.ToRegionAttachment(entry.region, scale);
			}
		}
Пример #5
0
 public Attachment NewAttachment(AttachmentType type, String name)
 {
     switch (type)
     {
     case AttachmentType.region:
         AtlasRegion region = atlas.FindRegion(name);
         if (region == null)
         {
             throw new Exception("Region not found in atlas: " + name + " (" + type + ")");
         }
         RegionAttachment attachment = new RegionAttachment(name);
         attachment.Region = region;
         return(attachment);
     }
     throw new Exception("Unknown attachment type: " + type);
 }