用户:
卫道士32_32*2没了查看:0 回复:5 评论:0 创建时间:2020-05-05T12:51:34
防止喵线------------------------------------------------------------------------------------------------------------------
class timer{
public var ticks = 0;
public ansyc function startTimer(){
while (True){
self.ticks += 1
await sleep(1)
}
}
public function resetTimer(){
self.ticks = 0
}
}
//使用
var timer = new timer()
timer.startTimer()
await sleep(13)
console.log(timer.ticks)
划重点!!!
1.
public function startTimer(){ //”public“方便程序获取
2.
var timer = new timer() //实例化
🆗
class timer{
public var ticks = 0;
public ansyc function startTimer(){
while (True){
self.ticks += 1
await sleep(1)
}
}
public function resetTimer(){
self.ticks = 0
}
}
//使用
var timer = new timer()
timer.startTimer()
await sleep(13)
console.log(timer.ticks)
//存代码ing……点赞0
评论