cocos2dx 3.0 quick lua schedler

前端之家收集整理的这篇文章主要介绍了cocos2dx 3.0 quick lua schedler前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

local scheduler = {}<<该模块在初始化时不会自动载入>>@H_404_1@

加载方式:local scheduler = require(cc.PACKAGE_NAME .. ".scheduler")@H_404_1@

--------note start -----@H_404_1@

计划一个全局帧事件回调,返回该计划的句柄@H_404_1@

1) scheduler.scheduleUpdateGlobal(listener)@H_404_1@

listener:回调函数@H_404_1@

return schedule 句柄@H_404_1@

schedler.nscheduleGlobal(scheduler)@H_404_1@

scheduler: scheduleUpdateGlobal(listener)函数的返回句柄@H_404_1@

2)计划一个以指定时间间隔执行的全局事件回调,返回该计划的句柄@H_404_1@

local function onInterval(dt)endlocal handle = scheduler.scheduleGlobal(onInterval,0.5)@H_404_1@

使用scheduler.unscheduleGlobal(handle) 取消一个全局计划@H_404_1@

3)计划一个全局延时回调,并返回该句柄@H_404_1@

scheduler.performWithDelayGlobal(listener,time)会在指定时间后执行一次回调函数,然后自动取消该计划@H_404_1@

猜你在找的Cocos2d-x相关文章