如题,我想在小游戏环境自己合图,web中能正常拿到image.data,但是在微信环境中,spriteFrame.texture.image.data为空,有谁知道原因么?或者怎么才能拿到这个对象呢,合图的接口必须要这个值,现在拿不到,很难受。。。


如题,我想在小游戏环境自己合图,web中能正常拿到image.data,但是在微信环境中,spriteFrame.texture.image.data为空,有谁知道原因么?或者怎么才能拿到这个对象呢,合图的接口必须要这个值,现在拿不到,很难受。。。


试过吗?
macro.CLEANUP_IMAGE_CACHE =false
能,刚看到,我在想能不能只针对部分图搞。。
改一下源码,给图片单独加一个控制标记
可以改这里
cc.ImageAsset.prototype.decRef = ()=>{
//你的逻辑
}
嗯。试试!!
妙啊!!!!!
2.x引擎可以改这里
//@ts-ignore
let AssProto = cc.Assembler2D.prototype;
let ToDynamicAtlas = AssProto['packToDynamicAtlas'];
AssProto['packToDynamicAtlas'] = function (comp, frame) {
if (CC_TEST) return;
let fComp = (() => {
if (comp) {
let mat = comp._materials[0];
if (!mat) return;
if (mat.getProperty('texture') !== frame._texture._texture) {
comp._vertsDirty = true;
comp._updateMaterial();
}
}
});
// 指定XX页面节点下图片进行动态图集
let enterPath = 'gameNode/';
// 替换你的逻辑,指定图片进行动态图集
if (comp && comp.node && comp.node['c_path']) {
let path = comp.node['c_path'];
if (path.indexOf(enterPath) != -1) {
ToDynamicAtlas.bind(this)(comp, frame);
}
else {
fComp();
}
}
else {
fComp();
}
};
666,不过我是3.x哈,有点儿不一样
问题就在于我不太知道ImageAsset怎么拿原始路径或者设置