Commit c7f76e3e authored by Friends233's avatar Friends233

增加屏幕监听计时

parent aa07dd0d
...@@ -81,6 +81,10 @@ export default class GameScene extends cc.Component { ...@@ -81,6 +81,10 @@ export default class GameScene extends cc.Component {
/** 加速倍率 */ /** 加速倍率 */
speedMultiplier = 1 speedMultiplier = 1
/** 差值 */
difference = 0
dateNow = 0
protected onLoad(): void { protected onLoad(): void {
// loadGameResources() // loadGameResources()
...@@ -102,6 +106,14 @@ export default class GameScene extends cc.Component { ...@@ -102,6 +106,14 @@ export default class GameScene extends cc.Component {
gameBtn.on(cc.Node.EventType.TOUCH_END, this.playGame, this) gameBtn.on(cc.Node.EventType.TOUCH_END, this.playGame, this)
this.node.on(CUSTOM_EVENT.CLIP_ANI_END, this.onAnimCompleted, this) this.node.on(CUSTOM_EVENT.CLIP_ANI_END, this.onAnimCompleted, this)
this.node.on(CUSTOM_EVENT.CLIP_COLLISION, this.onCollEnter, this) this.node.on(CUSTOM_EVENT.CLIP_COLLISION, this.onCollEnter, this)
cc.game.on(cc.game.EVENT_HIDE, () => {
this.dateNow = Date.now()
})
cc.game.on(cc.game.EVENT_SHOW, () => {
const difference = Date.now() - this.dateNow
this.countDown = Math.max(0, this.countDown - Math.ceil(difference / 1000))
this.dateNow = 0
})
exportEvent.on(CUSTOM_EVENT.NEXT_LEVEL, this.nextLevel, this) exportEvent.on(CUSTOM_EVENT.NEXT_LEVEL, this.nextLevel, this)
exportEvent.on(CUSTOM_EVENT.GAME_START, this.startGame, this) exportEvent.on(CUSTOM_EVENT.GAME_START, this.startGame, this)
......
This diff is collapsed.
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<!-- <script src="//yun.duiba.com.cn/db_games/libs0924/svgaParser.minWeb.js" crossorigin="anonymous"></script>--> <!-- <script src="//yun.duiba.com.cn/db_games/libs0924/svgaParser.minWeb.js" crossorigin="anonymous"></script>-->
<link rel="stylesheet" type="text/css" href="https://yun.duiba.com.cn/db_games/ccc_game/template/1681898392442/style-mobile.css"/> <link rel="stylesheet" type="text/css" href="https://yun.duiba.com.cn/db_games/ccc_game/template/1682304200376/style-mobile.css"/>
<style> <style>
...@@ -90,9 +90,9 @@ ...@@ -90,9 +90,9 @@
</div> </div>
</div> </div>
<script src="https://yun.duiba.com.cn/db_games/ccc_game/template/1681898392442/src/settings.js" charset="utf-8"></script> <script src="https://yun.duiba.com.cn/db_games/ccc_game/template/1682304200376/src/settings.js" charset="utf-8"></script>
<script src="https://yun.duiba.com.cn/db_games/ccc_game/template/1681898392442/main.js" charset="utf-8"></script> <script src="https://yun.duiba.com.cn/db_games/ccc_game/template/1682304200376/main.js" charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
(function () { (function () {
......
window.__remoteUrl__ = "https://yun.duiba.com.cn/db_games/ccc_game/template/1681898392442/"; window.__remoteUrl__ = "https://yun.duiba.com.cn/db_games/ccc_game/template/1682304200376/";
window.__remoteAssets__ = window.__remoteUrl__ + "assets/"; window.__remoteAssets__ = window.__remoteUrl__ + "assets/";
window.__version__ = 1681898392442; window.__version__ = 1682304200376;
window.__ENV__ = "prod"; window.__ENV__ = "prod";
window.boot = function () { window.boot = function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment