Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix spine cache mode event type bug #209

Conversation

sunnylanwanjun
Copy link
Contributor

@sunnylanwanjun sunnylanwanjun commented Nov 19, 2019

https://forum.cocos.org/t/cocos-creator-v2-2-1/85555/369?u=sunnylanwanjun
修复spine原生平台 在 cache 模式下的事件回调与web参数不一至的问题。

this._nativeSkeleton.setCompleteListener(function (animationName) {
let self = this._comp;
self._endEntry.animation.name = animationName;
self._completeListener && self._completeListener(self._endEntry);
Copy link
Collaborator

@holycanvas holycanvas Nov 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

complete事件使用的是endEntry么

Copy link
Contributor Author

@sunnylanwanjun sunnylanwanjun Nov 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

是,complete和end是同一个事件,在cache模式下。

this._nativeSkeleton.setStartListener(listener);
if (this.isAnimationCached()) {
this._nativeSkeleton.setStartListener(function (animationName) {
let self = this._comp;
Copy link
Collaborator

@holycanvas holycanvas Nov 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self 需要放在外面定义么,这几个 this 都是指向调用者哦

Copy link
Contributor Author

@sunnylanwanjun sunnylanwanjun Nov 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个this是指向 _nativeSkeleton,_comp在初始化 _nativeSkeleton的时候,把Skeleton组件赋值给了_nativeSkeleton

@holycanvas holycanvas merged commit e77cfaa into cocos-creator-packages:v2.2.1-release Nov 20, 2019
linguitang added a commit to linguitang/jsb-adapter that referenced this issue Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants