game-3dkadiya
游戏
安装
npm install game-3dkadiya
使用
{
"usingComponents": {
"game": "game-3dkadiya/index"
}
}
{
"node_modules_es6_whitelist": [
"game-3dkadiya"
]
}
Page({
data: {
},
onInitDone(game) {
this.gameComponent = game;
// 跳转到下一个
// this.gameComponent.nextFun();
},
onUpdate(par) {
// 滚动回调
// progress: 当前进度,总进度为 100, currentIndex:当前产品下标
// console.error(par);
},
onTouchFun(e) {
let type = e.type;
if (!this.gameComponent) { return false; }
if (type === "touchStart") {
this.gameComponent.eventObj.start(e);
} else if (type === "touchMove") {
this.gameComponent.eventObj.move(e);
} else {
this.gameComponent.eventObj.end(e);
}
}
})
<!-- 游戏容器 -->
<game onInitDone="onInitDone" onUpdate="onUpdate" />
<view style="height:100vh;position:absolute;width: 100vw;left:0;top:0;z-index:10;" onTouchStart="onTouchFun" onTouchMove="onTouchFun" onTouchEnd="onTouchFun" onTouchCancel="onTouchFun">
</view>