常规node属性
node.x -> node.position.x
node.y -> node.postion.y
node.color -> node.getComponent(Sprite).color
node.opacity -> node.getComponent(UIOpacity).opacity
node.width -> node.getComponent(UITransform).width
node.height -> node.getComponent(UITransform).height
node.anchorX -> node.getComponent(UITransform).anchorX
node.anchorY -> node.getComponent(UITransform).anchorY
计时器
cc.director.getScheduler().enableForTarget(this); -> Scheduler.enableForTarget(this);
sheduler.schedule(()=>{}, this, 1, macro.REPEAT_FOREVER); 的macro不能自动导入,只能鼠标移到macro上然后点击修复
SpriteFrame
spriteFrame.getTexture() -> spriteFrame.texture
spriteFrame.getOriginalSize() -> spriteFrame.originalSize
let newSp = new cc.SpriteFrame(texture, cc.rect(0, 0, texture.width, texture.height)); -> let newSp = new SpriteFrame();
newSp.setRect(cc.rect(j * width, i * height, width, height)); newSp.texture = texture;
newSp.rect = rect(j * width, i * height, width, height);
鼠标事件
EventTouch
e.getLocation -> e.getUILocation
3.0EventTouch的getLocation获取的位置已经不正确了,需要使用getUILocation
按钮不响应,要把Layer设置为UI_2D
按钮吞噬事件
(this.node as any)._touchListener.setSwallowTouches(false) -> this.topBg.eventProcessor.touchListener.setSwallowTouches(false)
调试面板
Framerate 帧率,一般为60,表示每秒钟刷新60次
Draw call 通知GPU渲染的过程称为一次Draw Call
Frame time 每帧时间,1秒/60次 = 16.67毫秒
Instance Count 实例数量?
Triangle 三角面数量?
Game Logic 游戏逻辑耗时
Physics 物理引擎耗时
Renderer 渲染耗时
GFX Texture Mem 纹理缓存 一张512x512的32位图占用内存 8位=1字节,32位=4字节, 512x512x4 = 1048576字节, 1024字节=1KB, 1024KB=1M, 1048576/1024/1024 = 1M
GFX Buffer Mem ?