Spine.Atlas.FindRegion C# (CSharp) Method

FindRegion() public method

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
return AtlasRegion
		public AtlasRegion FindRegion (String name) {
			for (int i = 0, n = regions.Count; i < n; i++)
				if (regions[i].name == name) return regions[i];
			return null;
		}

Usage Example

Ejemplo n.º 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;
		}
All Usage Examples Of Spine.Atlas::FindRegion