Cocos Creator 笔记
开发环境构建
插件安装
1 | npm install -D @eslint/js@^10.0.1 eslint@^10.0.3 eslint-config-prettier@^10.1.8 eslint-plugin-only-warn@^1.2.1 eslint-plugin-prettier@^5.5.5 globals@^17.4.0 prettier@^3.8.1 typescript@^5.9.3 typescript-eslint@^8.57.0 |
环境配置
开发
事件
useCapture
node.on(event,callback,target,useCapture)
- true: 捕获模式,从父节点开始依次捕获事件
- false: 冒泡模式,从子节点开始依次向父节点冒泡
阻止冒泡
node.stopPropagation()
- 阻止向父节点冒泡,当前节点其他事件监听依然有效
- useCapture 为 true 时阻止子节点捕获
swallowTouches
- node._touchListener.setSwallowTouches(args:bool)
- true:穿透触摸事件
匀速贝塞尔曲线
1 | bezier(p0: cc.Vec2, p1: cc.Vec2, p2: cc.Vec2, t: number) { |
2.4.x更新lib库
- 拉最新的库版本直接替换。
https://github.com/cocos/cocos-engine-external