internal DragonBones(ITextureSupplier texturer, GraphicsDevice graphics, DbData data) { Name = data.Name; Version = data.Version; IsGlobal = data.IsGlobal; FrameRate = data.FrameRate; _armatures = new List <DbArmature>(); foreach (var armatureData in data.Armatures) { var armature = new DbArmature(armatureData.Name, texturer, graphics, this); armature.Initialize(armatureData); _armatures.Add(armature); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); _demonAtlas = TextureAtlas.FromJson("Content/DemonTexture.json"); _demonAtlas.LoadContent(Content); _demonArmature = DragonBones.FromJson("Content/Demon.json", _demonAtlas, GraphicsDevice).Armature; _dragonAtlas = TextureAtlas.FromJson("Content/texture.json"); _dragonAtlas.LoadContent(Content); _dragonArmature = DragonBones.FromJson("Content/Dragon.json", _dragonAtlas, GraphicsDevice).Armature; //_dragonArmature.PlaySound += (s, e) => Debug.WriteLine("Got sound event: " + e.Name); //_dragonArmature.DoAction += (s, e) => Debug.WriteLine("Got action event: " + e.Name); _meshAtlas = TextureAtlas.FromJson("Content/Culling.json"); _meshAtlas.LoadContent(Content); _meshArmature = DragonBones.FromJson("Content/Meshes.json", _meshAtlas, GraphicsDevice).Armature; }
internal DbAnimation(DbArmature armature, AnimationData data) { _armature = armature; Name = data.Name; Duration = data.Duration; PlayTimes = data.PlayTimes; Loop = PlayTimes != 0; // setup timelines _transformTimeline = new TransformTimeline(data.BoneTimelines); _displayTimeline = new DisplayTimeline(data.SlotTimelines); _ffdTimeline = new FFDTimeline(data.MeshTimelines); EventFrames = new EventFrame[data.EventFrames.Length]; var startFrame = 0; for (var i = 0; i < data.EventFrames.Length; i++) { var frame = data.EventFrames[i]; EventFrames[i] = new EventFrame(startFrame, frame); startFrame += frame.Duration; } }
public DbObject(string name, DbArmature armature, string parent) : this(name, armature, parent == null ? null : armature.GetBone(parent)) { }
public DbObject(string name, DbArmature armature, DbBone parent) { Name = name; Armature = armature; Parent = parent; }