直播平台软件开发,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 --定时器的使用, 更多内容欢迎关注之后的文章
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
2022-03-08 短视频直播系统,选择选项时,点击出现下拉框
2022-03-08 手机直播源码,验证码自动读秒倒计时
2022-03-08 直播软件搭建,通过Android DrawerLayout实现侧边栏功能