You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
909 B
53 lines
909 B
// 判断是否在演示模式 能否直接开始游戏
|
|
function isHash() {
|
|
if (location.hash && location.hash === 'p') {
|
|
Demo.of();
|
|
Count.of(countOver);
|
|
} else {
|
|
// 连点7次触发倒计时
|
|
startGame();
|
|
}
|
|
}
|
|
|
|
function startGame() {
|
|
var count = 0,
|
|
timer;
|
|
document.onclick = function () {
|
|
if (count < 6) {
|
|
if (timer) {
|
|
clearTimeout(timer);
|
|
}
|
|
count++;
|
|
timer = setTimeout(function () {
|
|
count = 0;
|
|
}, 300);
|
|
} else if (count === 6) {
|
|
count = 0;
|
|
clearTimeout(timer);
|
|
sevenClick();
|
|
}
|
|
};
|
|
}
|
|
|
|
function sevenClick() {
|
|
Count.of(countOver);
|
|
addHash();
|
|
}
|
|
|
|
// 倒计时结束 开始游戏
|
|
function countOver() {
|
|
timeInstance.start();
|
|
}
|
|
|
|
// 添加hash值
|
|
function addHash() {
|
|
location.hash = 'p';
|
|
Demo.of();
|
|
}
|
|
|
|
function test() {
|
|
document.addEventListener('click', () => {
|
|
main.play();
|
|
});
|
|
}
|
|
test();
|
|
|