private void LoadObjectInfos(ContentReader input, Entity entity, int count) { for (int i = 0; i < count; i++) { string name = input.ReadString(); string type = input.ReadString(); int w = input.ReadInt32(); int h = input.ReadInt32(); Entity.ObjectInfo info = new Entity.ObjectInfo(name, SpriterUtils.GetObjectInfoFor(type), new Dimension(w, h), new List <FileReference>()); entity.AddInfo(info); // todo frameja? ei näy dokkarissa } }
private void LoadTimelines(ContentReader input, SpriterAnimation anim, Entity entity, int count) { for (int id = 0; id < count; id++) { string name = input.ReadString(); string objtype = input.ReadString(); int keyCount = input.ReadInt32(); Entity.ObjectType type = SpriterUtils.GetObjectInfoFor(objtype); Entity.ObjectInfo info = entity.GetInfo(name); if (info == null) { info = new Entity.ObjectInfo(name, type, new Dimension(0f, 0f), new List <FileReference>()); } Timeline timeline = new Timeline(id, name, info, keyCount); anim.AddTimeline(timeline); LoadTimelineKeys(input, timeline, keyCount); } }
private void LoadTimelineKeys(ContentReader input, Timeline timeline, int count) { for (int id = 0; id < count; id++) { int spin = input.ReadInt32(); int time = input.ReadInt32(); string curveType = input.ReadString(); float[] c = new[] { input.ReadSingle(), input.ReadSingle(), input.ReadSingle(), input.ReadSingle() }; Curve curve = new Curve(); curve.Type = SpriterUtils.GetType(curveType); curve.Constraints.Set(c[0], c[1], c[2], c[3]); TimelineKey key = new TimelineKey(id, time, spin, curve); LoadObjectOrBone(input, key, timeline); } }
private void LoadMainlineKeys(ContentReader input, Mainline mainline, int count) { for (int id = 0; id < count; id++) { int time = input.ReadInt32(); int objectRefCount = input.ReadInt32(); int boneRefCount = input.ReadInt32(); string curveType = input.ReadString(); float[] cs = new[] { input.ReadSingle(), input.ReadSingle(), input.ReadSingle(), input.ReadSingle(), }; Curve curve = new Curve(); curve.Type = SpriterUtils.GetType(curveType); curve.Constraints.Set(cs[0], cs[1], cs[2], cs[3]); Mainline.Key key = new Mainline.Key(id, time, curve, boneRefCount, objectRefCount); mainline.AddKey(key); LoadRefs(input, objectRefCount, boneRefCount, key); } }