cocos2d-x lua日期获取

作者: 亮亮同学 | 来源:发表于2017-11-20 15:53 被阅读5次

cocos2d-x技术群新群:117871561
c++技术交流群:593010226

-- txt_time_ymd日期(Text)  txt_time_hms 时间 (Text) ViewLayer 显示层对象 
function MyCache.setDate(txt_time_ymd,txt_time_hms,ViewLayer)
    local timerNode = cc.Node:create()
    :addTo(ViewLayer)
  txt_time_ymd:setString(os.date("%Y-%m-%d",os.time()))
  txt_time_hms:setString(os.date("%H-%M-%S",os.time()))
  timerNode:runAction(cc.RepeatForever:create( 
                        cc.Sequence:create(
                        cc.DelayTime:create(1),
                        cc.CallFunc:create(function()
                          txt_time_hms:setString(os.date("%H-%M-%S",os.time())) 
                      end)
                  )))
end

相关文章

网友评论

    本文标题:cocos2d-x lua日期获取

    本文链接:https://www.haomeiwen.com/subject/ywpvvxtx.html