直播平台软件开发,cocos lua --定时器的使用

直播平台软件开发,cocos lua --定时器的使用

1
--取分钟<br>local lastmi = math.floor(dwSeconds/60)<br>--取秒       <br>local lastsec = dwSeconds - lastmi * 60<br>--格式 00:00<br>local lasttext = "" .. string.format("%02d", lastmi) .. ":" .. string.format("%02d", lastsec)<br>--设置时间<br>clocktime:setString(lasttext)<br> <br> <br>--<br>if (self._dissmiss_timecount) then<br>    local scheduler = CCDirector:getInstance():getScheduler()  <br>    scheduler:unscheduleScriptEntry(self._dissmiss_timecount);<br>    self._dissmiss_timecount = nil<br>end<br> <br>local function timerFun(dt)<br>yl.Print("num:"..(self._dissmiss_timecount_num or 0))<br>if self._dissmiss_timecount_num then<br>self._dissmiss_timecount_num = self._dissmiss_timecount_num - 1<br>local lastmi = math.floor(self._dissmiss_timecount_num/60)<br>local lastsec = self._dissmiss_timecount_num - lastmi * 60<br>local lasttext = "" .. string.format("%02d", lastmi) .. ":" ..                 <br>                          string.format("%02d", lastsec)<br>if self.csbDisNode then<br>local pTimeText =  self.csbDisNode:getChildByName("bg"):getChildByName("clock"):getChildByName("Time");<br>if pTimeText then<br>pTimeText:setString(lasttext)<br>end<br>else<br>yl.Print("self.csbDisNode is nil");<br>end<br>end<br>end<br>local scheduler = CCDirector:getInstance():getScheduler()  <br>self._dissmiss_timecount = scheduler:scheduleScriptFunc(timerFun, 1, false)<br>self._dissmiss_timecount_num = dwSeconds<br>end

​以上就是直播平台软件开发,cocos lua --定时器的使用, 更多内容欢迎关注之后的文章

 

posted @   云豹科技-苏凌霄  阅读(23)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
历史上的今天:
2022-03-08 短视频直播系统,选择选项时,点击出现下拉框
2022-03-08 手机直播源码,验证码自动读秒倒计时
2022-03-08 直播软件搭建,通过Android DrawerLayout实现侧边栏功能
点击右上角即可分享
微信分享提示