import './libs/weapp-adapter'
window.requestAnimationFrame(loop)
var test_run_times = 0
function test_audits(){
if(test_run_times == 0 ){
let key = 'test_audits'
let value = '打开 Audits 后无法写入数据'
wx.setStorageSync(key, value)
let rs = wx.getStorageSync(key)
if(rs == value){
console.log('Storage 写入读取成功!')
}else{
console.log('Storage 写入读取失败!')
console.log(rs)
}
test_run_times++
}
}
function loop() {
let ctx = canvas.getContext('2d')
ctx.fillStyle = '#ffffff'
ctx.fillRect(0, 0, window.innerWidth, window.innerHeight)
ctx.fillStyle = '#000000'
ctx.font = `${parseInt(window.innerWidth / 20)}px Arial`
ctx.fillText('欢迎使用代码片段', 10, window.innerHeight * 1 / 5)
ctx.fillText('可在控制台查看代码片段的说明和文档', 10, window.innerHeight * 1 / 5 + 30)
test_audits()
window.requestAnimationFrame(loop)
}
你好,升级下rc版本
}
}
// 游戏逻辑更新主函数
update() {
if ( databus.gameOver )
return;
this.bg.update()
databus.bullets
.concat(databus.enemys)
.forEach((item) => {
item.update()
})
this.enemyGenerate()
this.collisionDetection()
if ( databus.frame % 20 === 0 ) {
this.player.shoot()
this.music.playShoot()
}
}
// 实现游戏帧循环
loop() {
databus.frame++
test_audits()
this.update()
this.render()
this.aniId = window.requestAnimationFrame(
this.bindLoop,
canvas
)
}
}
补充,开发者工具,稳定版 Stable Build (1.03.2006090) 也有这个问题