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
561ced30
Commit
561ced30
authored
Apr 23, 2023
by
Friends233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改定时器
parent
aa07dd0d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
GameScene.ts
assets/Script/GameScene.ts
+12
-2
No files found.
assets/Script/GameScene.ts
View file @
561ced30
...
...
@@ -81,6 +81,8 @@ export default class GameScene extends cc.Component {
/** 加速倍率 */
speedMultiplier
=
1
timer
=
null
protected
onLoad
():
void
{
// loadGameResources()
...
...
@@ -183,7 +185,8 @@ export default class GameScene extends cc.Component {
this
.
startGameCountAni
(()
=>
{
this
.
isStartGame
=
true
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
)
})
}
...
...
@@ -301,6 +304,7 @@ export default class GameScene extends cc.Component {
this
.
isGameOver
=
true
this
.
setClipState
(
CLIP_STATE
.
GAME_OVER
)
this
.
unschedule
(
this
.
startCd
)
window
.
clearInterval
(
this
.
timer
)
exportEvent
.
fire
(
CUSTOM_EVENT
.
GAME_OVER
,
{
...
this
.
gameConfig
.
LevelInfo
[
this
.
actLevel
],
score
:
this
.
starNum
,
...
...
@@ -323,6 +327,7 @@ export default class GameScene extends cc.Component {
this
.
setLable
(
'cdIcon/cd'
,
`0s`
)
this
.
gameOver
()
this
.
unschedule
(
this
.
startCd
)
window
.
clearInterval
(
this
.
timer
)
return
}
this
.
countDown
=
cd
...
...
@@ -331,6 +336,7 @@ export default class GameScene extends cc.Component {
protected
onDestroy
():
void
{
this
.
unschedule
(
this
.
startCd
)
window
.
clearInterval
(
this
.
timer
)
}
/** 刷新关卡信息 */
...
...
@@ -352,6 +358,7 @@ export default class GameScene extends cc.Component {
this
.
updateGameProc
()
this
.
unschedule
(
this
.
startCd
)
window
.
clearInterval
(
this
.
timer
)
this
.
setLable
(
'cdIcon/cd'
,
`
${
this
.
countDown
}
s`
)
}
...
...
@@ -372,6 +379,7 @@ export default class GameScene extends cc.Component {
if
(
this
.
starNum
>=
this
.
levelObjectives
)
{
this
.
isStartGame
=
false
this
.
unschedule
(
this
.
startCd
)
window
.
clearInterval
(
this
.
timer
)
exportEvent
.
fire
(
CUSTOM_EVENT
.
PASS_LEVEL
,
{
...
this
.
gameConfig
.
LevelInfo
[
this
.
actLevel
],
score
:
this
.
starNum
,
...
...
@@ -386,13 +394,15 @@ export default class GameScene extends cc.Component {
const
nextLevel
=
this
.
actLevel
+
1
this
.
isStartGame
=
true
this
.
unschedule
(
this
.
startCd
)
window
.
clearInterval
(
this
.
timer
)
if
(
nextLevel
>=
this
.
gameConfig
.
LevelInfo
.
length
)
{
// 已通关
this
.
gameOver
()
return
}
this
.
refreshLevelInfo
(
nextLevel
)
this
.
refreshStageProps
()
this
.
schedule
(
this
.
startCd
,
1
)
// this.schedule(this.startCd, 1)
this
.
timer
=
setInterval
(()
=>
this
.
startCd
(),
1000
)
}
/** 更新游戏进度条信息 */
...
...
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