Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jj15_zww
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
jj15_zww
Commits
a539a174
Commit
a539a174
authored
Jul 15, 2025
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 增加统计上报
parent
6f444e0e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
5 deletions
+54
-5
jj15_zww.ts
assets/jj15_zww/scene/jj15_zww.ts
+14
-4
MyCocosSceneComponent_jj15_zww.ts
assets/jj15_zww/script/MyCocosSceneComponent_jj15_zww.ts
+8
-1
util_jj15_zww.ts
assets/jj15_zww/script/util_jj15_zww.ts
+32
-0
No files found.
assets/jj15_zww/scene/jj15_zww.ts
View file @
a539a174
import
{
a
syncDelay
,
onHomeworkFinish
}
from
"
../script/util_jj15_zww
"
;
import
{
a
ddSRAudioDuration
,
asyncDelay
,
onHomeworkFinish
,
setSRRecord
,
showSRResult
}
from
"
../script/util_jj15_zww
"
;
import
{
MyCocosSceneComponent
}
from
"
../script/MyCocosSceneComponent_jj15_zww
"
;
import
pg
from
"
./pg_jj15_zww
"
;
import
hw
from
"
./hw_jj15_zww
"
;
...
...
@@ -417,10 +417,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
soundNode
.
scale
=
0.76
;
iconNode
.
on
(
'
touchstart
'
,
()
=>
{
this
.
playAudioByUrl
(
this
.
data
.
audio_url
,
()
=>
{
this
.
playAudioByUrl
(
this
.
data
.
audio_url
,
(
duration
)
=>
{
iconNode
.
active
=
true
;
animNode
.
active
=
false
;
addSRAudioDuration
(
this
.
data
.
audio_url
,
duration
);
})
animNode
.
active
=
true
;
iconNode
.
active
=
false
;
...
...
@@ -490,6 +494,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
console
.
log
(
"
[onFinish] middleLayer not found
"
)
}
})
showSRResult
();
},
1
)
}
...
...
@@ -600,10 +605,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
btn_voice
=
e
.
target
;
let
com
=
btn_voice
.
getComponent
(
ImgAuto
);
com
.
playVoiceStart
();
pg
.
audio
.
playAudioByUrl
(
audio
,
()
=>
{
pg
.
audio
.
playAudioByUrl
(
audio
,
(
duration
)
=>
{
this
.
currentAudioId
=
null
;
com
.
playVoiceEnd
();
resolve
(
true
);
addSRAudioDuration
(
audio
,
duration
);
},
(
audioId
)
=>
{
this
.
currentAudioId
=
audioId
;
})
...
...
@@ -786,6 +792,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
ingBg
=
pg
.
view
.
find
(
ing
,
'
bg
'
);
ingBg
.
getComponent
(
ImgAuto
).
playVoiceEnd
();
let
score
=
recordData
.
result
.
overall
setSRRecord
(
this
.
currentDt
.
text
,
recordData
.
result
.
audio_duration
);
this
.
updatePopAni
(
null
,
score
);
this
.
checkCardsTime
=
3
;
this
.
scheduleOnce
(()
=>
{
...
...
@@ -877,10 +884,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
play
.
active
=
false
;
stop
.
active
=
true
;
this
.
checkCardsTime
=
9999999
;
pg
.
audio
.
playAudioByUrl
(
recordData
.
audioUrl
,
()
=>
{
pg
.
audio
.
playAudioByUrl
(
recordData
.
audioUrl
,
(
duration
)
=>
{
this
.
currentCard
=
null
;
this
.
checkCardsTime
=
3
;
this
.
onTouchCardPlayEnd
(
layer
);
addSRAudioDuration
(
recordData
.
audioUrl
,
duration
);
},
(
audioId
)
=>
{
this
.
currentPlayAudioId
=
audioId
;
})
...
...
assets/jj15_zww/script/MyCocosSceneComponent_jj15_zww.ts
View file @
a539a174
...
...
@@ -168,7 +168,8 @@ export class MyCocosSceneComponent extends cc.Component {
const
audioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
if
(
cb
)
{
cc
.
audioEngine
.
setFinishCallback
(
audioId
,
()
=>
{
cb
();
const
duration
=
cc
.
audioEngine
.
getDuration
(
audioId
);
cb
(
duration
);
});
}
});
...
...
@@ -176,6 +177,12 @@ export class MyCocosSceneComponent extends cc.Component {
cb
&&
cb
();
}
}
getAudioDuration
(
audio_url
)
{
const
audioId
=
cc
.
audioEngine
.
play
(
audio_url
,
false
,
0.01
);
const
duration
=
cc
.
audioEngine
.
getDuration
(
audioId
);
return
duration
;
}
}
...
...
assets/jj15_zww/script/util_jj15_zww.ts
View file @
a539a174
...
...
@@ -473,6 +473,38 @@ export function showTips(tips) {
}
}
export
function
setSRRecord
(
key
,
value
)
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
middleLayerComponent
.
setSRRecord
(
key
,
value
);
}
else
{
console
.
log
(
'
setSRRecord
'
);
}
}
export
function
addSRAudioDuration
(
key
,
value
)
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
middleLayerComponent
.
addSRAudioDuration
(
key
,
value
);
}
else
{
console
.
log
(
'
addSRAudioDuration
'
);
}
}
export
function
showSRResult
()
{
const
middleLayer
=
cc
.
find
(
'
middleLayer
'
);
if
(
middleLayer
)
{
const
middleLayerComponent
=
middleLayer
.
getComponent
(
'
middleLayer
'
);
middleLayerComponent
.
showSRResultByRecord
();
}
else
{
console
.
log
(
'
addSRAudioDuration
'
);
}
}
...
...
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