1、监听node的状态,比如创建释放等
self:registerScriptHandler(function(event) if event == "enter" then elseif event == "exit" then elseif event == "enterTransitionFinish" then elseif event == "exitTransitionStart" then elseif event == "cleanup" then end end)
2、默认ProgressBar或者siler中的bar背景是缩放形式,如果要改成切割的话,setScale9Enabled(false)即可,如代码所示
local soundSiler = self.mView.soundSlider soundSiler:setPercent(musicVolume * 100); soundSiler:loadProgressBarTexture("creator/hall/Texture/SettingDialog/progressBar.png") soundSiler:setScale9Enabled(false); soundSiler:addEventListener(function(sender,event) local volume = sender:getPercent() / 100.0 audio.setMusicVolume(volume) end )
3、spine动画有黑边
相关链接:http://www.cgjoy.com/forum.PHP?mod=viewthread&tid=178120
https://github.com/cocos-creator/engine/pull/1104/files#diff-6ee557b6de23dd5ee8e19a7c2a180495
https://github.com/EsotericSoftware/spine-runtimes/issues/809
第一步,spine导出时候把 “ 预乘Alpha” 取消勾选,然后再加上如下代码
方法一:
cc.Image:setPNGPremultipliedAlphaEnabled(false)
方法二
spineNode::setOpacityModifyRGB(true)
3、如果print没有输出的话
如果不重新编译模拟器的话 需要用release_print代替print...
原文链接:https://www.f2er.com/cocos2dx/338316.html