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

correction action warn code #6176

Merged
merged 2 commits into from Feb 19, 2020
Merged

correction action warn code #6176

merged 2 commits into from Feb 19, 2020

Conversation

zhefengzhang
Copy link
Contributor

RE: https://forum.cocos.org/t/2-3-0-cc-action/88963

现在只会在用户第一次使用 runAvtion 时警告一次。

Now only warn once when the user first uses runAction.

@@ -2490,7 +2490,7 @@ let NodeDefines = {
if (!this.active)
return;
cc.assertID(action, 1618);
cc.warnID(1639);
if (!cc.director.getActionManager().haveWarn) cc.director.getActionManager().haveWarn = new cc.warnID(1639);
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. haveWarn 语法错误,应该是 hasWarning,私有变量最好用下划线 _hasWarning。
    但是表达的含义仍然比较模糊,建议用 _suppressDeprecation
  2. new cc.warnID 是把 cc.warnID 当做构造函数吗?我们好像从来没有这样的用法,建议不要这么玩。而且也不知道这样 V8 会不会对构造函数进行额外的我们用不到的优化。
let am = cc.director.getActionManager();
if (!am._suppressDeprecation) {
  am._suppressDeprecation = true;
  cc.warnID(1639);
}
am.addAction(action, this, false);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

明白,我修改下。

@holycanvas holycanvas merged commit 6f1cb1b into cocos:v2.3.1 Feb 19, 2020
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

4 participants