let slot: sp.spine.Slot = this.ske.findSlot("ORENGE");
let attachment: sp.spine.RegionAttachment = slot.getAttachment() as sp.spine.RegionAttachment;
if (!slot || !attachment) {
cc.error('error...');
return;
}
// let region: sp.spine.TextureAtlasRegion = attachment.region as sp.spine.TextureAtlasRegion;
let texture = await this.loadRes(diningTable.img)
var tex = new sp.SkeletonTexture()
tex.setRealTexture(texture)
let region: sp.spine.TextureAtlasRegion = attachment.region as sp.spine.TextureAtlasRegion;
region.u = 0;
region.v = 0;
region.u2 = 1;
region.v2 = 1;
region.width = texture.width;
region.height = texture.height;
region.originalWidth = texture.width;
region.originalHeight = texture.height;
region.rotate = false;
region.texture = tex;
region.page = null;
attachment.width = region.width;
attachment.height = region.height;
attachment.setRegion(region);
attachment.region.texture = tex
slot.setAttachment(attachment);
// skeleton如果使用了缓存模式则需要刷新缓存
this.ske.invalidAnimationCache();
// 这个没有考虑旋转和大小的问题 但有助于理解
https://forum.cocos.org/t/cocos-creator-spine/67676
//这个实现完全
https://blog.csdn.net/u012338130/article/details/111409597
//论坛的
https://forum.cocos.org/t/topic/138623
网友评论