mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2024-12-25 11:18:30 +00:00
[jsb-adapter] Spine 组件所有特性原生平台适配
This commit is contained in:
parent
3b1584ee1c
commit
0a9774f6e9
@ -66,6 +66,7 @@ const cacheManager = require('./jsb-cache-manager');
|
|||||||
let skeletonCacheMgr = spine.SkeletonCacheMgr.getInstance();
|
let skeletonCacheMgr = spine.SkeletonCacheMgr.getInstance();
|
||||||
spine.skeletonCacheMgr = skeletonCacheMgr;
|
spine.skeletonCacheMgr = skeletonCacheMgr;
|
||||||
skeletonDataProto.destroy = function () {
|
skeletonDataProto.destroy = function () {
|
||||||
|
this._destroyFromDynamicAtlas();
|
||||||
this.reset();
|
this.reset();
|
||||||
skeletonCacheMgr.removeSkeletonCache(this._uuid);
|
skeletonCacheMgr.removeSkeletonCache(this._uuid);
|
||||||
cc.Asset.prototype.destroy.call(this);
|
cc.Asset.prototype.destroy.call(this);
|
||||||
@ -325,6 +326,15 @@ const cacheManager = require('./jsb-cache-manager');
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
skeleton.setVertsDirty = function () {
|
||||||
|
if (this.skeletonData) {
|
||||||
|
this._dataDirty = true;
|
||||||
|
this.constructor.__assembler__.prototype.handleDynamicAtlasAndSwitchMaterial(this);
|
||||||
|
}
|
||||||
|
this.invalidAnimationCache();
|
||||||
|
cc.RenderComponent.prototype.setVertsDirty.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
skeleton.setSkeletonData = function (skeletonData) {
|
skeleton.setSkeletonData = function (skeletonData) {
|
||||||
if (null != skeletonData.width && null != skeletonData.height && 0 !== skeletonData.width && 0 !== skeletonData.height) {
|
if (null != skeletonData.width && null != skeletonData.height && 0 !== skeletonData.width && 0 !== skeletonData.height) {
|
||||||
this.node.setContentSize(skeletonData.width, skeletonData.height);
|
this.node.setContentSize(skeletonData.width, skeletonData.height);
|
||||||
@ -349,6 +359,9 @@ const cacheManager = require('./jsb-cache-manager');
|
|||||||
this._nativeSkeleton = null;
|
this._nativeSkeleton = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._dataDirty = true;
|
||||||
|
this.constructor.__assembler__.prototype.handleDynamicAtlasAndSwitchMaterial(this);
|
||||||
|
|
||||||
let nativeSkeleton = null;
|
let nativeSkeleton = null;
|
||||||
if (this.isAnimationCached()) {
|
if (this.isAnimationCached()) {
|
||||||
nativeSkeleton = new spine.SkeletonCacheAnimation(uuid, this._cacheMode == AnimationCacheMode.SHARED_CACHE);
|
nativeSkeleton = new spine.SkeletonCacheAnimation(uuid, this._cacheMode == AnimationCacheMode.SHARED_CACHE);
|
||||||
@ -769,6 +782,27 @@ const cacheManager = require('./jsb-cache-manager');
|
|||||||
this._materialCache = null;
|
this._materialCache = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let regionAttachment = sp.spine.RegionAttachment.prototype;
|
||||||
|
|
||||||
|
regionAttachment.getTexture2D = function (skeletonData) {
|
||||||
|
if (!this._texture2D) {
|
||||||
|
this._texture2D = skeletonData.getTextureByIndex(this.textureForJSB.getRealTextureIndex());
|
||||||
|
}
|
||||||
|
return this._texture2D;
|
||||||
|
};
|
||||||
|
|
||||||
|
let meshAttachment = sp.spine.MeshAttachment.prototype;
|
||||||
|
|
||||||
|
meshAttachment.getTexture2D = function (skeletonData) {
|
||||||
|
if (!this._texture2D) {
|
||||||
|
this._texture2D = skeletonData.getTextureByIndex(this.textureForJSB.getRealTextureIndex());
|
||||||
|
}
|
||||||
|
return this._texture2D;
|
||||||
|
};
|
||||||
|
|
||||||
|
renderer.CustomAssembler.prototype.updateRenderDataForSwitchMaterial = function () {
|
||||||
|
// placeholder
|
||||||
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// adapt attach util
|
// adapt attach util
|
||||||
|
Loading…
Reference in New Issue
Block a user