7 changed files with 1785 additions and 3713 deletions
File diff suppressed because it is too large
@ -0,0 +1,57 @@ |
|||||
|
// window.hash = '#p';
|
||||
|
|
||||
|
isHash(); |
||||
|
|
||||
|
// 判断是否在演示模式 能否直接开始游戏
|
||||
|
function isHash() { |
||||
|
console.log('window.hash: ', window.hash); |
||||
|
if (window.hash && window.hash === '#p') { |
||||
|
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() { |
||||
|
console.log('连点7次开始游戏'); |
||||
|
window.count = Count.of(countOver); |
||||
|
addHash(); |
||||
|
} |
||||
|
|
||||
|
// 倒计时结束 开始游戏
|
||||
|
function countOver() { |
||||
|
timeInstance.start(); |
||||
|
} |
||||
|
|
||||
|
// 添加hash值
|
||||
|
function addHash() { |
||||
|
window.hash = '#p'; |
||||
|
} |
||||
|
|
||||
|
function test() { |
||||
|
document.addEventListener('click', () => { |
||||
|
main.play(); |
||||
|
}); |
||||
|
} |
||||
|
test(); |
Loading…
Reference in new issue