public SkeletonSpatial(GraphicsDevice device, string contentPath, string skin) { if (!_registered.TryGetValue(contentPath, out _record)) _record = Load(device, contentPath); _skeleton = new Skeleton(_record.Data); _skeleton.SetSkin(skin); _skeleton.SetSlotsToBindPose(); }
public AnimatedSpriteSpatial(String contentPath, ContentManager contentManager) { if (!_registered.TryGetValue(contentPath, out _record)) _record = Load(contentPath, contentManager); _sprite = _record.Definition.CreateSprite(); _sprite.Scale = _record.InstanceDefaults.Transform.Scale; _sprite.Rotation = _record.InstanceDefaults.Transform.Rotation; _sprite.Opacity = _record.InstanceDefaults.Transform.Opacity; _sprite.Start(); }
public CounterSpatial(string contentPath, ContentManager contentManager) { if (!_registered.TryGetValue(contentPath, out _record)) _record = Load(contentPath, contentManager); _counter = _record.Definition.CreateCounter(); if (_record.InstanceDefaults != null && _record.InstanceDefaults.Transform != null) { _counter.BlendColor = _record.InstanceDefaults.Transform.BlendColor; _counter.Scale = _record.InstanceDefaults.Transform.Scale; _counter.Rotation = _record.InstanceDefaults.Transform.Rotation; _counter.Opacity = _record.InstanceDefaults.Transform.Opacity; } }
public DirectionalAniamtedSpriteSpatial(String contentPath, ContentManager contentManager) { if (!_registered.TryGetValue(contentPath, out _record)) _record = Load(contentPath, contentManager); _sprite = _record.Definition.CreateSprite(); _sprite.Scale = _record.InstanceDefaults.Transform.Scale; _sprite.Rotation = _record.InstanceDefaults.Transform.Rotation; _sprite.Opacity = _record.InstanceDefaults.Transform.Opacity; _sprite.CurrentDirection = (Direction)Enum.Parse(typeof(Direction), _record.InstanceDefaults.InitialDirection, false); _sprite.CurrentSequence.Start(); }
private SpatialTypeRecord Load(String contentPath, ContentManager contentManager) { SpatialTypeRecord record = new SpatialTypeRecord(); using (Stream contentStream = TitleContainer.OpenStream(contentPath)) { using (XmlReader reader = XmlReader.Create(contentStream)) { XmlAnimatedSpriteElement xmldef = new XmlAnimatedSpriteElement(); xmldef.ReadXml(reader); record.Definition = xmldef.BuildDefinition(contentManager); record.InstanceDefaults = xmldef.Instance; } } _registered[contentPath] = record; return record; }
private SpatialTypeRecord Load(GraphicsDevice device, string contentPath) { SpatialTypeRecord record = new SpatialTypeRecord(); using (Stream contentStream = TitleContainer.OpenStream(contentPath)) { using (XmlReader reader = XmlReader.Create(contentStream)) { XmlSkeletonDefElement xmldef = new XmlSkeletonDefElement(); xmldef.ReadXml(reader); Atlas atlas = new Atlas(xmldef.Atlas.Source, new XnaTextureLoader(device)); SkeletonJson json = new SkeletonJson(atlas); record.Data = json.ReadSkeletonData(xmldef.Skeleton.Source); record.DefaultAnimationMap = xmldef.BuildDefaultAnimationMap(); record.DirectedAnimationMap = xmldef.BuildDirectedAnimationMap(); record.ActivityMap = xmldef.BuildActivityMap(); record.DefaultAnimation = xmldef.ActivityMap.DefaultAnimation; } } _registered[contentPath] = record; return record; }