creator源码查看

哪位牛人知道怎么查看creator的源码吗,就像runAction()方法怎么实现这种类似的源码

1赞

你在Cocos Creator的安装目录下的resources/目录下进行搜索,一般js源码都在resources/engine/目录下,还有一些是C++源码,比如说sqlite的实现代码是c++代码。
你要搜一个函数的功能,就在这些目录下进行全局搜索,比如说我搜索了runAction,可以发现CCNode.js中有关runAction的代码:

// ACTIONS
    /**
     * !#en
     * Executes an action, and returns the action that is executed.<br/>
     * The node becomes the action's target. Refer to cc.Action's getTarget() <br/>
     * Calling runAction while the node is not active won't have any effect. <br/>
     * Note:You shouldn't modify the action after runAction, that won't take any effect.<br/>
     * if you want to modify, when you define action plus.
     * !#zh
     * 执行并返回该执行的动作。该节点将会变成动作的目标。<br/>
     * 调用 runAction 时,节点自身处于不激活状态将不会有任何效果。<br/>
     * 注意:你不应该修改 runAction 后的动作,将无法发挥作用,如果想进行修改,请在定义 action 时加入。
     * @method runAction
     * @param {Action} action
     * @return {Action} An Action pointer
     * @example
     * var action = cc.scaleTo(0.2, 1, 0.6);
     * node.runAction(action);
     * node.runAction(action).repeatForever(); // fail
     * node.runAction(action.repeatForever()); // right
     */
    runAction: function (action) {
        if (!this.active)
            return;
        cc.assertID(action, 1618);

        if (!cc.macro.ENABLE_GC_FOR_NATIVE_OBJECTS) {
            this._retainAction(action);
        }
        if (CC_JSB) {
            this._sgNode._owner = this;
        }
        cc.director.getActionManager().addAction(action, this, false);
        return action;
    },

回复晚了,多谢:ok_hand: