internal override ModelBase Serialize() { return(new GMTileAnimationFrameModel { id = Id, name = Name, frames = Frames.Select(x => tileSet.GetTileIndex(x)).ToList() }); }
internal override ModelBase Serialize() { return(new GMAutoTileSetModel { id = Id, name = Name, closed_edge = ClosedEdge, tiles = Tiles.Select(x => tileSet.GetTileIndex(x)).ToList() }); }
internal override ModelBase Serialize() { int frameCount = 0; foreach (var animation in animations) { frameCount = Math.Max(frameCount, animation.Frames.Length); } uint[] frameData = new uint[tileSet.TileCount * frameCount]; if (frameCount > 0) { for (int i = 0; i < tileSet.TileCount; ++i) { for (int j = 0; j < frameCount; ++j) { frameData[i * frameCount + j] = (uint)i; } } // TODO Handle collisions // NOTE More research is required but it looks like GMS will discard subsequent animations if // the first frame collides with the first frame of any previous animation. Furthermore, // it also appears that it will discard individual frames of any animations that collide // with any frames of a previous animation as well. foreach (var animation in animations) { uint key = tileSet.GetTileIndex(animation.Frames[0]); for (int i = 0; i < frameCount; ++i) { int j = i % animation.Frames.Length; frameData[key + j] = tileSet.GetTileIndex(animation.Frames[j]); } } } return(new GMTileAnimationModel { AnimationCreationOrder = null, // NOTE Deprecated FrameData = frameData, SerialiseFrameCount = frameCount }); }