Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Cocos-GoldenMiner
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
等吃饭
Cocos-GoldenMiner
Commits
19692b24
Commit
19692b24
authored
Apr 24, 2023
by
Friends233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改游戏定时器
parent
561ced30
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
22 deletions
+32
-22
GameScene.ts
assets/Script/GameScene.ts
+25
-15
index.js
build/web-mobile/assets/main/index.js
+1
-1
index.html
build/web-mobile/index.html
+3
-3
main.js
build/web-mobile/main.js
+2
-2
project.json
settings/project.json
+1
-1
No files found.
assets/Script/GameScene.ts
View file @
19692b24
...
@@ -149,7 +149,7 @@ export default class GameScene extends cc.Component {
...
@@ -149,7 +149,7 @@ export default class GameScene extends cc.Component {
/** 目标数量 */
/** 目标数量 */
num
:
1
,
num
:
1
,
/** 倒计时 */
/** 倒计时 */
cds
:
50
,
cds
:
3
,
},
},
{
{
level
:
1
,
level
:
1
,
...
@@ -186,7 +186,10 @@ export default class GameScene extends cc.Component {
...
@@ -186,7 +186,10 @@ export default class GameScene extends cc.Component {
this
.
isStartGame
=
true
this
.
isStartGame
=
true
cc
.
find
(
'clipMask/clipWrp'
,
this
.
node
).
getComponent
(
cc
.
Animation
).
play
()
cc
.
find
(
'clipMask/clipWrp'
,
this
.
node
).
getComponent
(
cc
.
Animation
).
play
()
// this.schedule(this.startCd, 1)
// this.schedule(this.startCd, 1)
this
.
timer
=
setInterval
(()
=>
this
.
startCd
(),
1000
)
clearTimeout
(
this
.
timer
)
this
.
timer
=
setTimeout
(()
=>
{
this
.
startCd
()
},
1000
)
})
})
}
}
...
@@ -303,8 +306,8 @@ export default class GameScene extends cc.Component {
...
@@ -303,8 +306,8 @@ export default class GameScene extends cc.Component {
gameOver
()
{
gameOver
()
{
this
.
isGameOver
=
true
this
.
isGameOver
=
true
this
.
setClipState
(
CLIP_STATE
.
GAME_OVER
)
this
.
setClipState
(
CLIP_STATE
.
GAME_OVER
)
this
.
unschedule
(
this
.
startCd
)
//
this.unschedule(this.startCd)
window
.
clear
Interval
(
this
.
timer
)
window
.
clear
Timeout
(
this
.
timer
)
exportEvent
.
fire
(
CUSTOM_EVENT
.
GAME_OVER
,
{
exportEvent
.
fire
(
CUSTOM_EVENT
.
GAME_OVER
,
{
...
this
.
gameConfig
.
LevelInfo
[
this
.
actLevel
],
...
this
.
gameConfig
.
LevelInfo
[
this
.
actLevel
],
score
:
this
.
starNum
,
score
:
this
.
starNum
,
...
@@ -326,17 +329,21 @@ export default class GameScene extends cc.Component {
...
@@ -326,17 +329,21 @@ export default class GameScene extends cc.Component {
if
(
!
cd
||
cd
<=
0
)
{
if
(
!
cd
||
cd
<=
0
)
{
this
.
setLable
(
'cdIcon/cd'
,
`0s`
)
this
.
setLable
(
'cdIcon/cd'
,
`0s`
)
this
.
gameOver
()
this
.
gameOver
()
this
.
unschedule
(
this
.
startCd
)
//
this.unschedule(this.startCd)
window
.
clear
Interval
(
this
.
timer
)
window
.
clear
Timeout
(
this
.
timer
)
return
return
}
}
this
.
countDown
=
cd
this
.
countDown
=
cd
this
.
setLable
(
'cdIcon/cd'
,
`
${
this
.
countDown
}
s`
)
this
.
setLable
(
'cdIcon/cd'
,
`
${
this
.
countDown
}
s`
)
clearTimeout
(
this
.
timer
)
this
.
timer
=
setTimeout
(()
=>
{
this
.
startCd
()
},
1000
);
}
}
protected
onDestroy
():
void
{
protected
onDestroy
():
void
{
this
.
unschedule
(
this
.
startCd
)
//
this.unschedule(this.startCd)
window
.
clear
Interval
(
this
.
timer
)
window
.
clear
Timeout
(
this
.
timer
)
}
}
/** 刷新关卡信息 */
/** 刷新关卡信息 */
...
@@ -357,8 +364,8 @@ export default class GameScene extends cc.Component {
...
@@ -357,8 +364,8 @@ export default class GameScene extends cc.Component {
this
.
updateGameProc
()
this
.
updateGameProc
()
this
.
unschedule
(
this
.
startCd
)
//
this.unschedule(this.startCd)
window
.
clear
Interval
(
this
.
timer
)
window
.
clear
Timeout
(
this
.
timer
)
this
.
setLable
(
'cdIcon/cd'
,
`
${
this
.
countDown
}
s`
)
this
.
setLable
(
'cdIcon/cd'
,
`
${
this
.
countDown
}
s`
)
}
}
...
@@ -378,8 +385,8 @@ export default class GameScene extends cc.Component {
...
@@ -378,8 +385,8 @@ export default class GameScene extends cc.Component {
// 达到目标
// 达到目标
if
(
this
.
starNum
>=
this
.
levelObjectives
)
{
if
(
this
.
starNum
>=
this
.
levelObjectives
)
{
this
.
isStartGame
=
false
this
.
isStartGame
=
false
this
.
unschedule
(
this
.
startCd
)
//
this.unschedule(this.startCd)
window
.
clear
Interval
(
this
.
timer
)
window
.
clear
Timeout
(
this
.
timer
)
exportEvent
.
fire
(
CUSTOM_EVENT
.
PASS_LEVEL
,
{
exportEvent
.
fire
(
CUSTOM_EVENT
.
PASS_LEVEL
,
{
...
this
.
gameConfig
.
LevelInfo
[
this
.
actLevel
],
...
this
.
gameConfig
.
LevelInfo
[
this
.
actLevel
],
score
:
this
.
starNum
,
score
:
this
.
starNum
,
...
@@ -393,8 +400,8 @@ export default class GameScene extends cc.Component {
...
@@ -393,8 +400,8 @@ export default class GameScene extends cc.Component {
nextLevel
()
{
nextLevel
()
{
const
nextLevel
=
this
.
actLevel
+
1
const
nextLevel
=
this
.
actLevel
+
1
this
.
isStartGame
=
true
this
.
isStartGame
=
true
this
.
unschedule
(
this
.
startCd
)
//
this.unschedule(this.startCd)
window
.
clear
Interval
(
this
.
timer
)
window
.
clear
Timeout
(
this
.
timer
)
if
(
nextLevel
>=
this
.
gameConfig
.
LevelInfo
.
length
)
{
// 已通关
if
(
nextLevel
>=
this
.
gameConfig
.
LevelInfo
.
length
)
{
// 已通关
this
.
gameOver
()
this
.
gameOver
()
return
return
...
@@ -402,7 +409,10 @@ export default class GameScene extends cc.Component {
...
@@ -402,7 +409,10 @@ export default class GameScene extends cc.Component {
this
.
refreshLevelInfo
(
nextLevel
)
this
.
refreshLevelInfo
(
nextLevel
)
this
.
refreshStageProps
()
this
.
refreshStageProps
()
// this.schedule(this.startCd, 1)
// this.schedule(this.startCd, 1)
this
.
timer
=
setInterval
(()
=>
this
.
startCd
(),
1000
)
clearTimeout
(
this
.
timer
)
this
.
timer
=
setTimeout
(()
=>
{
this
.
startCd
()
},
1000
)
}
}
/** 更新游戏进度条信息 */
/** 更新游戏进度条信息 */
...
...
build/web-mobile/assets/main/index.js
View file @
19692b24
This diff is collapsed.
Click to expand it.
build/web-mobile/index.html
View file @
19692b24
...
@@ -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/168
1898392442
/style-mobile.css"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"https://yun.duiba.com.cn/db_games/ccc_game/template/168
2301770504
/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/168
1898392442
/src/settings.js"
charset=
"utf-8"
></script>
<script
src=
"https://yun.duiba.com.cn/db_games/ccc_game/template/168
2301770504
/src/settings.js"
charset=
"utf-8"
></script>
<script
src=
"https://yun.duiba.com.cn/db_games/ccc_game/template/168
1898392442
/main.js"
charset=
"utf-8"
></script>
<script
src=
"https://yun.duiba.com.cn/db_games/ccc_game/template/168
2301770504
/main.js"
charset=
"utf-8"
></script>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
(
function
()
{
(
function
()
{
...
...
build/web-mobile/main.js
View file @
19692b24
window
.
__remoteUrl__
=
"https://yun.duiba.com.cn/db_games/ccc_game/template/168
1898392442
/"
;
window
.
__remoteUrl__
=
"https://yun.duiba.com.cn/db_games/ccc_game/template/168
2301770504
/"
;
window
.
__remoteAssets__
=
window
.
__remoteUrl__
+
"assets/"
;
window
.
__remoteAssets__
=
window
.
__remoteUrl__
+
"assets/"
;
window
.
__version__
=
168
1898392442
;
window
.
__version__
=
168
2301770504
;
window
.
__ENV__
=
"prod"
;
window
.
__ENV__
=
"prod"
;
window
.
boot
=
function
()
{
window
.
boot
=
function
()
{
...
...
settings/project.json
View file @
19692b24
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
"width"
:
960
,
"width"
:
960
,
"height"
:
640
"height"
:
640
},
},
"last-module-event-record-time"
:
168
1469884076
,
"last-module-event-record-time"
:
168
2239993727
,
"assets-sort-type"
:
"name"
,
"assets-sort-type"
:
"name"
,
"facebook"
:
{
"facebook"
:
{
"enable"
:
false
,
"enable"
:
false
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment