public BoneRef(int id, int timeline, int key, BoneRef parent) { this.Id = id; this.Timeline = timeline; this.Key = key; this.Parent = parent; }
private static void loadRefs(List <XmlNode > objectRefs, List <XmlNode > boneRefs, Key key) { for (int i = 0; i < boneRefs.Count; i++) { XmlNode o = boneRefs[i]; BoneRef bone = new BoneRef( ); bone.setId(XmlReader.getInt(o, "id")); bone.setKey(XmlReader.getInt(o, "key")); int par = XmlReader.getInt(o, "parent", -1); bone.setParent(par); bone.setTimeline(XmlReader.getInt(o, "timeline")); key.getBoneRef().Add(bone); } for (int i_1 = 0; i_1 < objectRefs.Count; i_1++) { XmlNode o = objectRefs[i_1]; AnimationObjectRef @object = new AnimationObjectRef (); @object.setId(XmlReader.getInt(o, "id")); @object.setKey(XmlReader.getInt(o, "key")); int par = XmlReader.getInt(o, "parent", -1); @object.setParent(par); @object.setTimeline(XmlReader.getInt(o, "timeline")); @object.setZIndex(XmlReader.getInt(o, "z_index")); key.getObjectRef().Add(@object); } }
// Move the ith bone, so that the bone's base or tip matches pos. public void MoveBone(int i, BoneRef reference, Vector3 pos) { if (reference == BoneRef.Base) { bones[i].Move(pos - bones[i].Base.Position); } else { bones[i].Move(pos - bones[i].Tip.Position); } // At this point the chain may be broken }
public virtual SpriterBone merge(BoneRef @ref, Key key) { Bone obj = key.getBone(); SpriterBone bone = new SpriterBone(); bone.setTimeline(@ref.getTimeline()); bone.setId(@ref.getId()); bone.setParentId(@ref.getParent()); bone.setAngle(obj.getAngle()); bone.setScaleX(obj.getScaleX()); bone.setScaleY(obj.getScaleY()); bone.setX(obj.getX()); bone.setY(obj.getY()); bone.setSpin(key.getSpin()); return(bone); }
/// <summary> /// Adds a bone reference to this key. </summary> /// <param name="ref"> the reference to add </param> public virtual void AddBoneRef(BoneRef @ref) { this.BoneRefs[BonePointer++] = @ref; }
public ObjectRef(int id, int timeline, int key, BoneRef parent, int zIndex) : base(id, timeline, key, parent) { this.ZIndex = zIndex; }
/// <summary> /// Returns a <seealso cref="BoneRef"/> for the given reference. </summary> /// <param name="ref"> the reference to the reference in this key </param> /// <returns> a bone reference with the same time line as the given one </returns> public virtual BoneRef GetBoneRef(BoneRef @ref) { return(GetBoneRefTimeline(@ref.Timeline)); }