首页 > 其他 > 详细

quick schedule 的添加和移除

时间:2015-05-04 23:38:50      阅读:249      评论:0      收藏:0      [点我收藏+]
local scheduler = require(cc.PACKAGE_NAME .. ".scheduler")
 
local MainScene = class("MainScene", function()
    return display.newScene("MainScene")
end)

function MainScene:ctor()

    local label=cc.ui.UILabel.new({
        UILabelType = 2, text = "test hero move control", size = 32})
        :align(display.CENTER, display.cx, display.cy+150)
        :addTo(self)


    local handle  
    local interval = 1  
    local repeatIndex = 3  
    local index = 0  
    handle = scheduler.scheduleUpdateGlobal(function()  
        index = index + 1  
        label:setString(string.format("%d", index))  
        if index >= repeatIndex then  
            scheduler.unscheduleGlobal(handle)  
            print("over")  
        end  
    end)  
end

return MainScene

 

quick schedule 的添加和移除

原文:http://www.cnblogs.com/yufenghou/p/4477980.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!