Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JJ_Game_09
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
JJ_Game_09
Commits
4f4ce7d2
Commit
4f4ce7d2
authored
Dec 28, 2023
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: debug
parent
1207da21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
2 deletions
+43
-2
JJ_Game_09.ts
assets/JJ_Game_09/scene/JJ_Game_09.ts
+43
-2
No files found.
assets/JJ_Game_09/scene/JJ_Game_09.ts
View file @
4f4ce7d2
...
...
@@ -29,8 +29,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
addPreloadAnima
()
{
}
isDestroy
;
protected
onDestroy
():
void
{
this
.
isDestroy
=
true
;
clearTimeout
(
this
.
timeOut
);
clearInterval
(
this
.
intervalId
);
cc
.
audioEngine
.
setEffectsVolume
(
1
);
}
onLoadEnd
()
{
...
...
@@ -112,6 +116,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
async
randomPopo
()
{
const
createPopo
=
async
()
=>
{
await
asyncDelay
(
RandomInt
(
0
,
20
));
if
(
this
.
isDestroy
)
{
return
;
}
const
rType
=
Math
.
random
()
<
0.5
?
1
:
2
;
// 1: 小泡泡,2:大泡泡
const
node
=
getSprNode
(
rType
==
1
?
"
popo_sm
"
:
"
popo_big
"
);
node
.
y
=
0
-
(
this
.
node
.
height
/
2
)
-
260
;
...
...
@@ -131,7 +138,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
ppArr
.
push
(
createPopo
());
}
await
Promise
.
all
(
ppArr
);
if
(
this
.
isDestroy
)
{
return
;
}
await
this
.
randomPopo
();
if
(
this
.
isDestroy
)
{
return
;
}
}
initEvent
()
{
this
.
btn_laba
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onLaba
,
this
);
...
...
@@ -171,6 +184,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
page
=
index
;
this
.
updateTop
();
this
.
playLocalAudio
(
"
fanye
"
,
0.2
).
then
(()
=>
{
if
(
this
.
isDestroy
)
{
return
;
}
this
.
playQuestionAudio
();
});
console
.
log
(
"
idx:
"
+
index
);
...
...
@@ -200,6 +216,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
this
.
intervalId
)
clearInterval
(
this
.
intervalId
);
this
.
stop
=
false
;
this
.
intervalId
=
setInterval
(()
=>
{
if
(
this
.
isDestroy
)
{
return
;
}
count
++
;
// btn_laba1.active = count % 2 == 0;
btn_laba2
.
active
=
count
%
2
==
1
;
...
...
@@ -210,6 +229,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
},
150
)
pg
.
audio
.
playAudioByUrl
(
audio
).
then
((
audioId
)
=>
{
if
(
this
.
isDestroy
)
{
return
;
}
this
.
stop
=
true
;
btn_laba1
.
active
=
true
;
btn_laba2
.
active
=
true
;
...
...
@@ -231,7 +253,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
isRecording
=
true
;
btn_recording
.
active
=
true
;
recording_count
.
fillRange
=
0
;
cc
.
tween
(
recording_count
).
to
(
120
,
{
fillRange
:
-
1
}).
call
(()
=>
{
recording_count
.
fillRange
=
0
;
this
.
recordStop
();
}).
start
();
cc
.
tween
(
recording_count
).
to
(
120
,
{
fillRange
:
-
1
}).
call
(()
=>
{
if
(
this
.
isDestroy
)
{
return
;
}
recording_count
.
fillRange
=
0
;
this
.
recordStop
();
}).
start
();
let
text
=
""
;
if
(
Game
.
getIns
().
lists
[
this
.
page
].
text
)
{
...
...
@@ -266,6 +292,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
time
=
cc
.
audioEngine
.
getDuration
(
audioId
);
cc
.
tween
(
recording_count
).
to
(
time
,
{
fillRange
:
-
1
}).
call
(()
=>
{
recording_count
.
fillRange
=
0
;
}).
start
();
}).
then
(()
=>
{
if
(
this
.
isDestroy
)
{
return
;
}
this
.
btn_stop
.
active
=
false
;
this
.
btn_play
.
active
=
true
;
});
...
...
@@ -299,6 +328,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
this
.
timeOut
)
clearTimeout
(
this
.
timeOut
);
this
.
timeOut
=
setTimeout
(()
=>
{
if
(
this
.
isDestroy
)
{
return
;
}
let
index
=
this
.
page_view
.
getComponent
(
cc
.
PageView
).
getCurrentPageIndex
();
this
.
page_view
.
getComponent
(
cc
.
PageView
).
scrollToPage
(
index
+
1
,
0.1
);
},
2000
);
...
...
@@ -326,6 +358,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
this
.
autoPlay
==
0
)
return
;
let
time
=
audioId
?
1000
:
3000
;
this
.
timeOut
=
setTimeout
(()
=>
{
if
(
this
.
isDestroy
)
{
return
;
}
let
index
=
this
.
page_view
.
getComponent
(
cc
.
PageView
).
getCurrentPageIndex
();
this
.
page_view
.
getComponent
(
cc
.
PageView
).
scrollToPage
(
index
+
1
,
0.1
);
},
time
);
...
...
@@ -344,6 +379,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
const
group
=
cc
.
instantiate
(
this
.
layout_pic
);
let
pic
=
cc
.
find
(
"
pic
"
,
group
);
await
pg
.
view
.
setNetImg
(
pic
,
question
.
pic_url
,
{
w
:
943
,
h
:
1024
},
true
);
if
(
this
.
isDestroy
)
{
return
;
}
cc
.
find
(
"
pic2
"
,
group
).
active
=
false
;
// 等首图加载完成后 隐藏加载进度条
if
(
index
==
0
)
{
...
...
@@ -389,6 +427,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
layout_loading
.
active
=
false
;
this
.
recordEndView
.
active
=
true
;
asyncDelay
(
2
).
then
(()
=>
{
if
(
this
.
isDestroy
)
{
return
;
}
this
.
onHideEnd
();
});
let
overall
=
res
.
result
.
overall
;
...
...
@@ -474,5 +515,5 @@ export default class SceneComponent extends MyCocosSceneComponent {
console
.
log
(
str
);
// }
}
}
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