Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Sbox_FT_08
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
Sbox_FT_08
Commits
af228ac2
Commit
af228ac2
authored
Dec 19, 2021
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 释放定时器
parent
b20cd983
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
14 deletions
+19
-14
GameLogic.js
assets/Sbox_FT_08/script/GameLogic.js
+19
-14
No files found.
assets/Sbox_FT_08/script/GameLogic.js
View file @
af228ac2
...
...
@@ -263,10 +263,10 @@ export default class GameLogic {
this
.
g_cartoon
.
getCartoonElement
(
"
bird_1
"
).
wrong
()
this
.
g_cartoon
.
getCartoonElement
(
"
bird_2
"
).
wrong
()
this
.
g_cartoon
.
playAudio
(
"
try_again
"
,
()
=>
{
setTimeout
(()
=>
{
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
this
.
g_cartoon
.
playAudio
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
audio_url
)
this
.
enableClick
(
`card_
${
index
+
1
}
_image_container`
)
},
1000
)
},
1000
)
)
})
}
else
{
this
.
enableClick
(
`card_
${
index
+
1
}
_image_container`
)
...
...
@@ -346,11 +346,11 @@ export default class GameLogic {
})
this
.
g_cartoon
.
tweenChange
(
bell2
.
node
,
{
scaleX
:
1
,
scaleY
:
1
},
0.2
,
()
=>
{
this
.
g_cartoon
.
getCartoonElement
(
"
bird_1
"
).
flyBack
(()
=>
{
setTimeout
(()
=>
{
this
.
_timeoutIds
(
setTimeout
(()
=>
{
if
(
callback
)
{
callback
();
}
},
1500
)
},
1500
)
)
})
this
.
g_cartoon
.
getCartoonElement
(
"
bird_2
"
).
flyBack
()
});
...
...
@@ -699,21 +699,21 @@ export default class GameLogic {
birdAniWrong_1
.
node
.
opacity
=
255
;
birdStatic_1
.
node
.
opacity
=
0
;
birdAudio
.
switchAni
(
1
)
setTimeout
(()
=>
{
this
.
_timeoutIds
(
setTimeout
(()
=>
{
birdAniWrong_1
.
node
.
opacity
=
0
;
birdStatic_1
.
node
.
opacity
=
255
;
birdAudio
.
switchAni
(
0
)
},
1000
);
},
1000
)
)
;
}
bird_2
.
wrong
=
()
=>
{
birdAniWrong_2
.
node
.
opacity
=
255
;
birdStatic_2
.
node
.
opacity
=
0
;
setTimeout
(()
=>
{
this
.
_timeoutIds
(
setTimeout
(()
=>
{
birdAniWrong_2
.
node
.
opacity
=
0
;
birdStatic_2
.
node
.
opacity
=
255
;
},
1000
);
},
1000
)
)
;
}
bird_1
.
node
.
y
=
-
cc
.
winSize
.
height
/
2
+
bird_1
.
node
.
height
+
10
...
...
@@ -762,16 +762,24 @@ export default class GameLogic {
const
downTime
=
Math
.
ceil
((
cc
.
winSize
.
height
/
100
)
*
1000
)
/
1000
console
.
log
(
downTime
)
this
.
intervalID
=
setInterval
(()
=>
{
this
.
_intervalIds
(
setInterval
(()
=>
{
let
snow
=
getSnow
(
Math
.
ceil
(
Math
.
random
()
*
4
)
)
// this.g_cartoon.tweenChange(snow, {y: -cc.winSize.height / 2}, downTime)
cc
.
tween
(
snow
).
to
(
downTime
,
{
y
:
-
cc
.
winSize
.
height
/
2
}).
call
(()
=>
snow
.
destroy
()).
start
()
},
100
);
},
100
)
)
;
}
_timeoutIds
=
[]
_intervalIds
=
[]
// 生命周期
destroy
()
{
clearInterval
(
this
.
intervalID
);
this
.
_timeoutIds
.
forEach
(
id
=>
{
clearTimeout
(
id
);
});
this
.
_intervalIds
.
forEach
(
id
=>
{
clearInterval
(
id
);
});
}
...
...
@@ -783,9 +791,6 @@ export default class GameLogic {
// Common function
maskLayer
=
null
;
initMaskLayer
()
{
...
...
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