Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OPW_BoardGame_L5R4
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
OPW_BoardGame_L5R4
Commits
b739e1fc
Commit
b739e1fc
authored
Nov 25, 2022
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成语音评测页面
parent
f8b65a0e
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
959 additions
and
338 deletions
+959
-338
PronunciationTestLayer.js
...4/prefab/PronunciationTestLayer/PronunciationTestLayer.js
+322
-280
PronunciationTestLayer.prefab
...efab/PronunciationTestLayer/PronunciationTestLayer.prefab
+275
-4
audios.meta
..._BoardGame_L5R4/prefab/PronunciationTestLayer/audios.meta
+12
-0
right.wav
...dGame_L5R4/prefab/PronunciationTestLayer/audios/right.wav
+0
-0
right.wav.meta
..._L5R4/prefab/PronunciationTestLayer/audios/right.wav.meta
+7
-0
wrong.mp3
...dGame_L5R4/prefab/PronunciationTestLayer/audios/wrong.mp3
+0
-0
wrong.mp3.meta
..._L5R4/prefab/PronunciationTestLayer/audios/wrong.mp3.meta
+7
-0
progress_1.png.meta
...refab/PronunciationTestLayer/textures/progress_1.png.meta
+2
-2
OPW_BoardGame_L5R4.fire
assets/OPW_BoardGame_L5R4/scene/OPW_BoardGame_L5R4.fire
+322
-51
OPW_BoardGame_L5R4.ts
assets/OPW_BoardGame_L5R4/scene/OPW_BoardGame_L5R4.ts
+12
-1
No files found.
assets/OPW_BoardGame_L5R4/prefab/PronunciationTestLayer/PronunciationTestLayer.js
View file @
b739e1fc
...
...
@@ -4,25 +4,54 @@
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
async
function
asyncPlayDragonBoneAnimation
(
node
,
animationName
,
time
=
1
,
onFrameEvent
=
null
)
{
async
function
asyncPlayDragonBoneAnimation
(
node
,
animationName
,
time
=
1
,
onFrameEvent
=
null
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
)
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
)
.
once
(
dragonBones
.
EventObject
.
COMPLETE
,
()
=>
{
resolve
(
null
);
});
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
)
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
)
.
on
(
dragonBones
.
EventObject
.
FRAME_EVENT
,
({
name
})
=>
{
if
(
onFrameEvent
&&
typeof
(
onFrameEvent
)
==
'
function
'
)
{
if
(
onFrameEvent
&&
typeof
onFrameEvent
==
"
function
"
)
{
onFrameEvent
(
name
);
}
});
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
)
node
.
getComponent
(
dragonBones
.
ArmatureDisplay
)
.
playAnimation
(
animationName
,
time
);
});
}
function
playAudioByUrl
(
audio_url
,
cb
=
null
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
audio_url
)
{
cc
.
assetManager
.
loadRemote
(
audio_url
,
(
err
,
audioClip
)
=>
{
const
audioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
resolve
(
audioId
);
if
(
cb
)
{
cc
.
audioEngine
.
setFinishCallback
(
audioId
,
()
=>
{
cb
();
});
}
});
}
else
{
resolve
(
0
);
if
(
cb
)
{
cb
();
}
}
});
}
cc
.
Class
({
extends
:
cc
.
Component
,
...
...
@@ -42,15 +71,20 @@ cc.Class({
// this._bar = value;
// }
// },
audioBeforeTest
:
""
,
recordWaitCount
:
0
,
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start
()
{
start
()
{},
init
(
audio_url
)
{
this
.
audioBeforeTest
=
audio_url
;
},
showVoice
(
node
,
testLetter
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
voice
=
this
.
node
;
...
...
@@ -78,167 +112,169 @@ cc.Class({
cloneNode
.
y
=
0
;
img
.
addChild
(
cloneNode
);
let
progressBar
=
progress
.
getComponent
(
cc
.
ProgressBar
)
let
progressBar
=
progress
.
getComponent
(
cc
.
ProgressBar
);
progressBar
.
progress
=
1
;
let
url
=
this
.
recordWaitCount
==
0
?
this
.
data
.
recordWait
:
""
;
// this.playAudioByUrl(url, () => {
let
url
=
this
.
recordWaitCount
==
0
?
this
.
audioBeforeTest
:
""
;
let
cat
=
cc
.
find
(
"
cat
"
,
catBase
);
asyncPlayDragonBoneAnimation
(
cat
,
"
begin
"
,
0
);
playAudioByUrl
(
url
,
()
=>
{
asyncPlayDragonBoneAnimation
(
cat
,
"
record
"
,
0
);
cc
.
tween
(
progressBar
).
delay
(
1
).
to
(
3
,
{
progress
:
0
}).
call
(()
=>
{
}).
start
();
cc
.
tween
(
progressBar
)
.
delay
(
1
)
.
to
(
3
,
{
progress
:
0
})
.
call
(()
=>
{})
.
start
();
console
.
log
(
'
startTest->
'
+
testLetter
);
console
.
log
(
"
startTest->
"
+
testLetter
);
window
.
courseware
&&
window
.
courseware
.
startTest
(
testLetter
);
//开始录音
setTimeout
(
async
()
=>
{
if
(
!
window
.
courseware
)
{
let
testData
=
{
"
dtLastResponse
"
:
"
2021-09-17 13:36:26:109
"
,
"
refText
"
:
"
I haven't found anything out about him yet.
"
,
"
recordId
"
:
"
6144295213f0a2200000ed93
"
,
"
eof
"
:
1
,
"
result
"
:
{
"
pronunciation
"
:
25
,
"
resource_version
"
:
"
3.1.0
"
,
"
fluency
"
:
60
,
"
rhythm
"
:
90
,
"
kernel_version
"
:
"
5.2.4
"
,
"
overall
"
:
80
,
//25
"
integrity
"
:
100
,
"
duration
"
:
"
6.779
"
,
"
rear_tone
"
:
"
fall
"
,
"
speed
"
:
96
,
"
words
"
:
[
dtLastResponse
:
"
2021-09-17 13:36:26:109
"
,
refText
:
"
I haven't found anything out about him yet.
"
,
recordId
:
"
6144295213f0a2200000ed93
"
,
eof
:
1
,
result
:
{
pronunciation
:
25
,
resource_version
:
"
3.1.0
"
,
fluency
:
60
,
rhythm
:
90
,
kernel_version
:
"
5.2.4
"
,
overall
:
80
,
//25
integrity
:
100
,
duration
:
"
6.779
"
,
rear_tone
:
"
fall
"
,
speed
:
96
,
words
:
[
{
"
phonemes
"
:
[
phonemes
:
[
{
"
phoneme
"
:
"
w
"
,
"
pronunciation
"
:
55
,
"
span
"
:
{
"
end
"
:
95
,
"
start
"
:
88
}
phoneme
:
"
w
"
,
pronunciation
:
55
,
span
:
{
end
:
95
,
start
:
88
,
},
},
{
"
phoneme
"
:
"
ɛ
"
,
"
pronunciation
"
:
100
,
"
span
"
:
{
"
end
"
:
107
,
"
start
"
:
95
}
phoneme
:
"
ɛ
"
,
pronunciation
:
100
,
span
:
{
end
:
107
,
start
:
95
,
},
},
{
"
phoneme
"
:
"
r
"
,
"
pronunciation
"
:
99
,
"
span
"
:
{
"
end
"
:
123
,
"
start
"
:
107
}
}
phoneme
:
"
r
"
,
pronunciation
:
99
,
span
:
{
end
:
123
,
start
:
107
,
},
},
],
"
phonics
"
:
[
phonics
:
[
{
"
overall
"
:
85
,
"
phoneme
"
:
[
"
w
"
,
"
ɛ
"
,
"
r
"
],
"
spell
"
:
"
Where
"
}
overall
:
85
,
phoneme
:
[
"
w
"
,
"
ɛ
"
,
"
r
"
],
spell
:
"
Where
"
,
},
],
"
scores
"
:
{
"
overall
"
:
80
,
"
pronunciation
"
:
92
scores
:
{
overall
:
80
,
pronunciation
:
92
,
},
span
:
{
end
:
123
,
start
:
88
,
},
"
span
"
:
{
"
end
"
:
123
,
"
start
"
:
88
word
:
"
Where
"
,
},
"
word
"
:
"
Where
"
},
{
"
phonemes
"
:
[
{
"
phoneme
"
:
"
w
"
,
"
pronunciation
"
:
55
,
"
span
"
:
{
"
end
"
:
95
,
"
start
"
:
88
}
phonemes
:
[
{
phoneme
:
"
w
"
,
pronunciation
:
55
,
span
:
{
end
:
95
,
start
:
88
,
},
},
{
"
phoneme
"
:
"
ɛ
"
,
"
pronunciation
"
:
100
,
"
span
"
:
{
"
end
"
:
107
,
"
start
"
:
95
}
phoneme
:
"
ɛ
"
,
pronunciation
:
100
,
span
:
{
end
:
107
,
start
:
95
,
},
},
{
"
phoneme
"
:
"
r
"
,
"
pronunciation
"
:
99
,
"
span
"
:
{
"
end
"
:
123
,
"
start
"
:
107
}
}
phoneme
:
"
r
"
,
pronunciation
:
99
,
span
:
{
end
:
123
,
start
:
107
,
},
},
],
"
phonics
"
:
[
phonics
:
[
{
"
overall
"
:
85
,
"
phoneme
"
:
[
"
w
"
,
"
ɛ
"
,
"
r
"
],
"
spell
"
:
"
Where
"
}
overall
:
85
,
phoneme
:
[
"
w
"
,
"
ɛ
"
,
"
r
"
],
spell
:
"
Where
"
,
},
],
"
scores
"
:
{
"
overall
"
:
10
,
"
pronunciation
"
:
92
scores
:
{
overall
:
10
,
pronunciation
:
92
,
},
"
span
"
:
{
"
end
"
:
123
,
"
start
"
:
88
span
:
{
end
:
123
,
start
:
88
,
},
"
word
"
:
"
Where
"
}
]
word
:
"
Where
"
,
},
"
tokenId
"
:
"
6144295408558b08dd000001
"
,
"
applicationId
"
:
"
154838659000009e
"
}
],
},
tokenId
:
"
6144295408558b08dd000001
"
,
applicationId
:
"
154838659000009e
"
,
};
this
.
recordWaitCount
++
;
if
(
this
.
recrodEnd
(
testData
))
{
// this.playLocalAudio("正确");
this
.
playLocalAudio
(
"
right
"
);
asyncPlayDragonBoneAnimation
(
cat
,
"
right
"
,
1
);
await
this
.
showVoiceGood
();
this
.
hideVoice
();
return
resolve
(
true
)
return
resolve
(
true
);
}
else
{
// this.playLocalAudio("错误弹回");
this
.
playLocalAudio
(
"
wrong
"
);
asyncPlayDragonBoneAnimation
(
cat
,
"
wrong
"
,
1
);
await
this
.
showVoiceTry
();
this
.
hideVoice
();
return
resolve
(
false
);
}
}
// await pg.time.delay(5);
window
.
courseware
&&
window
.
courseware
.
stopTest
(
async
(
data
)
=>
{
window
.
courseware
&&
window
.
courseware
.
stopTest
(
async
(
data
)
=>
{
this
.
recordWaitCount
++
;
data
=
JSON
.
parse
(
data
);
if
(
this
.
recrodEnd
(
data
))
{
// this.playLocalAudio("正确");
this
.
playLocalAudio
(
"
right
"
);
asyncPlayDragonBoneAnimation
(
cat
,
"
right
"
,
1
);
await
this
.
showVoiceGood
();
this
.
hideVoice
();
return
resolve
(
true
)
return
resolve
(
true
);
}
else
{
// this.playLocalAudio("错误弹回");
this
.
playLocalAudio
(
"
错误弹回
"
);
asyncPlayDragonBoneAnimation
(
cat
,
"
wrong
"
,
1
);
await
this
.
showVoiceTry
();
this
.
hideVoice
();
return
resolve
(
false
);
}
});
//结束录音
},
4000
);
// })
});
});
},
...
...
@@ -251,14 +287,11 @@ cc.Class({
let
imgTry
=
voice
.
getChildByName
(
"
try
"
);
imgLight
.
active
=
true
;
cc
.
Tween
.
stopAllByTarget
(
imgLight
);
cc
.
tween
(
imgLight
)
.
by
(
3
,
{
angle
:
360
})
.
repeatForever
()
.
start
();
cc
.
tween
(
imgLight
).
by
(
3
,
{
angle
:
360
}).
repeatForever
().
start
();
imgGood
.
active
=
true
;
imgTry
.
active
=
false
;
setTimeout
(()
=>
{
resolve
(
''
);
resolve
(
""
);
},
2000
);
});
},
...
...
@@ -272,14 +305,11 @@ cc.Class({
let
imgTry
=
voice
.
getChildByName
(
"
try
"
);
imgLight
.
active
=
true
;
cc
.
Tween
.
stopAllByTarget
(
imgLight
);
cc
.
tween
(
imgLight
)
.
by
(
3
,
{
angle
:
360
})
.
repeatForever
()
.
start
();
cc
.
tween
(
imgLight
).
by
(
3
,
{
angle
:
360
}).
repeatForever
().
start
();
imgGood
.
active
=
false
;
imgTry
.
active
=
true
;
setTimeout
(()
=>
{
resolve
(
''
);
resolve
(
""
);
},
2000
);
});
},
...
...
@@ -302,7 +332,7 @@ cc.Class({
if
(
!
sentences
)
return
true
;
for
(
let
i
=
0
;
i
<
sentences
.
length
;
i
++
)
{
const
details
=
sentences
[
i
].
details
;
const
isSuccess
=
details
.
some
(
item
=>
item
.
overall
<=
40
);
const
isSuccess
=
details
.
some
((
item
)
=>
item
.
overall
<=
40
);
if
(
isSuccess
)
return
false
;
}
return
true
;
...
...
@@ -311,6 +341,18 @@ cc.Class({
hideVoice
()
{
let
voice
=
this
.
node
;
voice
.
active
=
false
;
},
playLocalAudio
(
audioName
)
{
const
audio
=
cc
.
find
(
`audioClips/
${
audioName
}
`
,
this
.
node
)
.
getComponent
(
cc
.
AudioSource
);
return
new
Promise
((
resolve
,
reject
)
=>
{
const
id
=
cc
.
audioEngine
.
playEffect
(
audio
.
clip
,
false
);
cc
.
audioEngine
.
setFinishCallback
(
id
,
()
=>
{
resolve
(
id
);
});
});
}
// update (dt) {},
...
...
assets/OPW_BoardGame_L5R4/prefab/PronunciationTestLayer/PronunciationTestLayer.prefab
View file @
b739e1fc
...
...
@@ -40,19 +40,22 @@
},
{
"__id__": 33
},
{
"__id__": 36
}
],
"_active":
tru
e,
"_active":
fals
e,
"_components": [
{
"__id__":
36
"__id__":
44
},
{
"__id__":
37
"__id__":
45
}
],
"_prefab": {
"__id__":
38
"__id__":
46
},
"_opacity": 255,
"_color": {
...
...
@@ -1342,6 +1345,272 @@
"fileId": "c8TTnwgvpL2Kb1J1NCiHC8",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "audioClips",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 37
},
{
"__id__": 40
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 43
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "right",
"_objFlags": 0,
"_parent": {
"__id__": 36
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 38
}
],
"_prefab": {
"__id__": 39
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
},
"_enabled": true,
"_clip": {
"__uuid__": "9ab937ea-56b2-433a-8bf2-fc5db40f33d6"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "87e8bdef-072f-4642-b630-352bb34d47b4"
},
"fileId": "b72HtDZt5D1JFSlkV3dHvr",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "wrong",
"_objFlags": 0,
"_parent": {
"__id__": 36
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 41
}
],
"_prefab": {
"__id__": 42
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 40
},
"_enabled": true,
"_clip": {
"__uuid__": "2ca571b6-6cc3-4b8f-830e-e9dd662c0b6c"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "87e8bdef-072f-4642-b630-352bb34d47b4"
},
"fileId": "0chKulT+1NHLcNjfZBplCI",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "87e8bdef-072f-4642-b630-352bb34d47b4"
},
"fileId": "dessiBBVFGHYtjCtBgRQeZ",
"sync": false
},
{
"__type__": "cc.Widget",
"_name": "",
...
...
@@ -1377,6 +1646,8 @@
"__id__": 1
},
"_enabled": true,
"audioBeforeTest": "",
"recordWaitCount": 0,
"_id": ""
},
{
...
...
assets/OPW_BoardGame_L5R4/prefab/PronunciationTestLayer/audios.meta
0 → 100644
View file @
b739e1fc
{
"ver": "1.1.2",
"uuid": "d5d7295b-e125-4e5f-b27f-fc93795c8e53",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
assets/OPW_BoardGame_L5R4/prefab/PronunciationTestLayer/audios/right.wav
0 → 100644
View file @
b739e1fc
File added
assets/OPW_BoardGame_L5R4/prefab/PronunciationTestLayer/audios/right.wav.meta
0 → 100644
View file @
b739e1fc
{
"ver": "2.0.1",
"uuid": "9ab937ea-56b2-433a-8bf2-fc5db40f33d6",
"downloadMode": 0,
"duration": 0.45102,
"subMetas": {}
}
\ No newline at end of file
assets/OPW_BoardGame_L5R4/prefab/PronunciationTestLayer/audios/wrong.mp3
0 → 100644
View file @
b739e1fc
File added
assets/OPW_BoardGame_L5R4/prefab/PronunciationTestLayer/audios/wrong.mp3.meta
0 → 100644
View file @
b739e1fc
{
"ver": "2.0.1",
"uuid": "2ca571b6-6cc3-4b8f-830e-e9dd662c0b6c",
"downloadMode": 0,
"duration": 0.6818,
"subMetas": {}
}
\ No newline at end of file
assets/OPW_BoardGame_L5R4/prefab/PronunciationTestLayer/textures/progress_1.png.meta
View file @
b739e1fc
...
...
@@ -28,8 +28,8 @@
"rawHeight": 51,
"borderTop": 0,
"borderBottom": 0,
"borderLeft":
0
,
"borderRight":
0
,
"borderLeft":
38
,
"borderRight":
16
,
"subMetas": {}
}
}
...
...
assets/OPW_BoardGame_L5R4/scene/OPW_BoardGame_L5R4.fire
View file @
b739e1fc
...
...
@@ -96,25 +96,25 @@
"__id__": 217
},
{
"__id__": 2
55
"__id__": 2
63
},
{
"__id__": 2
56
"__id__": 2
64
},
{
"__id__": 2
57
"__id__": 2
65
}
],
"_active": true,
"_components": [
{
"__id__": 2
65
"__id__": 2
73
},
{
"__id__": 2
66
"__id__": 2
74
},
{
"__id__": 2
67
"__id__": 2
75
}
],
"_prefab": null,
...
...
@@ -10847,19 +10847,22 @@
},
{
"__id__": 249
},
{
"__id__": 252
}
],
"_active": false,
"_components": [
{
"__id__": 2
52
"__id__": 2
60
},
{
"__id__": 2
53
"__id__": 2
61
}
],
"_prefab": {
"__id__": 2
54
"__id__": 2
62
},
"_opacity": 255,
"_color": {
...
...
@@ -10883,8 +10886,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
128
0,
96
0,
0,
0,
0,
...
...
@@ -10906,7 +10909,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "7
9NB9B0J1FfauSvPDUXMbh
"
"_id": "7
5T40zECtOHZ/PNIbc2zBZ
"
},
{
"__type__": "cc.Node",
...
...
@@ -10973,7 +10976,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
25eIyBPg5KTKYeW1jVd5hq
"
"_id": "
ddzAmTzuVITaOoE1N7BCZH
"
},
{
"__type__": "cc.Sprite",
...
...
@@ -11005,7 +11008,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "
d3niGuB7hAZ4BSc8vWkjTl
"
"_id": "
2fRl7/ZLlJSarpHEremvst
"
},
{
"__type__": "cc.Widget",
...
...
@@ -11032,7 +11035,7 @@
"_isAbsVerticalCenter": true,
"_originalWidth": 50000,
"_originalHeight": 50000,
"_id": "
59XcWTDXVB95RS6FgQqh+i
"
"_id": "
a5spwm7L9JeqAiDFb82ZOQ
"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -11107,7 +11110,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
f93KPVOY9CZrOTBk8Bve7h
"
"_id": "
29v0F+8INF4K5Yi1ml40nK
"
},
{
"__type__": "cc.Sprite",
...
...
@@ -11139,7 +11142,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "
24r1x8rhxI/7yqShCECNCc
"
"_id": "
71925cD3xDRosrohdHWJ7O
"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -11221,7 +11224,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
6elb8plVtISIgk6DNuRClg
"
"_id": "
794qnVDp5Li5VDUv2YfzFq
"
},
{
"__type__": "cc.Node",
...
...
@@ -11285,7 +11288,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
f4S9uq0mdKeIxAP84PTlnK
"
"_id": "
d2lE+bhI5Nt7ll6nwKxSXm
"
},
{
"__type__": "dragonBones.ArmatureDisplay",
...
...
@@ -11325,7 +11328,7 @@
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$enableBatch": false,
"_id": "
d8jZh7qctI4Y4H8xmkly60
"
"_id": "
eaHuu4h7BFdJsPszHnMCWC
"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -11400,7 +11403,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
b97wBzAB5Pk4L2olvLd2WX
"
"_id": "
d7BdU+23NFlq0gus9fb6Rq
"
},
{
"__type__": "cc.Button",
...
...
@@ -11468,7 +11471,7 @@
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "
d9Ji/J+eVHSLuGOKaX9toC
"
"_id": "
fbQbgiOVNLnJVg64xhTeCs
"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -11506,7 +11509,7 @@
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "
96D6C5Zy1LFJqgyqPFceqN
"
"_id": "
b0PeZu5etOsKr93+sWOWPK
"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -11577,7 +11580,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
37naXtTW5DNqWWbCt6ovxK
"
"_id": "
d3Vofx3K9J5Ko1hQXoPY2Z
"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -11659,7 +11662,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
c06Ofer4xGT5nReH61vg4R
"
"_id": "
8258XoFCJG4oT7vFhaLNDC
"
},
{
"__type__": "cc.Node",
...
...
@@ -11723,7 +11726,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
72BPWdVsBFJ6wOcBGv7ZF1
"
"_id": "
40lesAfrZGQLCSYqjAnS/N
"
},
{
"__type__": "cc.Sprite",
...
...
@@ -11755,7 +11758,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "
efNSA72WZM0aHS0MzOWcxj
"
"_id": "
62OI4sCt9LhYPvxdhYlAfk
"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -11798,7 +11801,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "
43SBOBZsNIp6oQaK5gRajw
"
"_id": "
68wU0rYslCcpa1ajuz+3b1
"
},
{
"__type__": "cc.ProgressBar",
...
...
@@ -11815,7 +11818,7 @@
"_N$mode": 0,
"_N$progress": 1,
"_N$reverse": false,
"_id": "
85Ehaed7ZGqbFRo5psxOKm
"
"_id": "
dctEEwOqNIDYbNBqclw8jK
"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -11890,7 +11893,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
35OlO/V6NJpJRA8ui8RcXy
"
"_id": "
47p3W1uA5FY6svtCMOxpu8
"
},
{
"__type__": "cc.Sprite",
...
...
@@ -11922,7 +11925,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "
0cm8SN1S9GOJKWi3DCrlcv
"
"_id": "
a2POaVqS1LE5wRVy+3zsYN
"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -11997,7 +12000,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
deMplk1T5PeqUjlShlc1/7
"
"_id": "
7dxPpEXjlEvb3csggtDs6R
"
},
{
"__type__": "cc.Sprite",
...
...
@@ -12029,7 +12032,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "
31WxfUs6tMv4flNn2WhkGX
"
"_id": "
8fQkQ+22JLnYP+7gxO7M7h
"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -12104,7 +12107,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "
51v7JUPkpKZoy1EdfwK1Qx
"
"_id": "
cfeNuCAvxOOrvcwNzWAKxH
"
},
{
"__type__": "cc.Sprite",
...
...
@@ -12136,7 +12139,7 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "
6bXtyznwtAnrgnfTI7jks/
"
"_id": "
9c66G9YbdJc5LfqNu2no4R
"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -12149,6 +12152,272 @@
"fileId": "c8TTnwgvpL2Kb1J1NCiHC8",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "audioClips",
"_objFlags": 0,
"_parent": {
"__id__": 217
},
"_children": [
{
"__id__": 253
},
{
"__id__": 256
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 259
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "61axejzhFMYoPBgTjg0OML"
},
{
"__type__": "cc.Node",
"_name": "right",
"_objFlags": 0,
"_parent": {
"__id__": 252
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 254
}
],
"_prefab": {
"__id__": 255
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "fdPwq5iBVCMol4N6uZeM8Y"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 253
},
"_enabled": true,
"_clip": {
"__uuid__": "9ab937ea-56b2-433a-8bf2-fc5db40f33d6"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "d1x8UxVXhMJZ+rZTpl7iq1"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 217
},
"asset": {
"__uuid__": "87e8bdef-072f-4642-b630-352bb34d47b4"
},
"fileId": "b72HtDZt5D1JFSlkV3dHvr",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "wrong",
"_objFlags": 0,
"_parent": {
"__id__": 252
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 257
}
],
"_prefab": {
"__id__": 258
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "860SZvIfJKeL/0gjAiy4lQ"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 256
},
"_enabled": true,
"_clip": {
"__uuid__": "2ca571b6-6cc3-4b8f-830e-e9dd662c0b6c"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "9cuxz0FadH0YAP1NJk463P"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 217
},
"asset": {
"__uuid__": "87e8bdef-072f-4642-b630-352bb34d47b4"
},
"fileId": "0chKulT+1NHLcNjfZBplCI",
"sync": false
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 217
},
"asset": {
"__uuid__": "87e8bdef-072f-4642-b630-352bb34d47b4"
},
"fileId": "dessiBBVFGHYtjCtBgRQeZ",
"sync": false
},
{
"__type__": "cc.Widget",
"_name": "",
...
...
@@ -12174,7 +12443,7 @@
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "
f5JGE+TeFJ5oPBAawSIokG
"
"_id": "
5awcLiOtZM9o4KbIW9/h0L
"
},
{
"__type__": "16155YRBRBLL4FPRlTZRpiI",
...
...
@@ -12184,7 +12453,9 @@
"__id__": 217
},
"_enabled": true,
"_id": "8dfkVpHmxCl5/dY7sHIxjD"
"audioBeforeTest": "",
"recordWaitCount": 0,
"_id": "3fY+V+UrRMDbcbChKnthRF"
},
{
"__type__": "cc.PrefabInfo",
...
...
@@ -12322,13 +12593,13 @@
},
"_children": [
{
"__id__": 2
58
"__id__": 2
66
},
{
"__id__": 26
1
"__id__": 26
9
},
{
"__id__": 2
62
"__id__": 2
70
}
],
"_active": false,
...
...
@@ -12386,11 +12657,11 @@
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 2
57
"__id__": 2
65
},
"_children": [
{
"__id__": 2
59
"__id__": 2
67
}
],
"_active": true,
...
...
@@ -12448,13 +12719,13 @@
"_name": "BRLNSDB",
"_objFlags": 0,
"_parent": {
"__id__": 2
58
"__id__": 2
66
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 26
0
"__id__": 26
8
}
],
"_prefab": null,
...
...
@@ -12510,7 +12781,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
59
"__id__": 2
67
},
"_enabled": true,
"_materials": [],
...
...
@@ -12541,7 +12812,7 @@
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 2
57
"__id__": 2
65
},
"_children": [],
"_active": true,
...
...
@@ -12599,11 +12870,11 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 2
57
"__id__": 2
65
},
"_children": [
{
"__id__": 2
63
"__id__": 2
71
}
],
"_active": true,
...
...
@@ -12661,13 +12932,13 @@
"_name": "btn",
"_objFlags": 512,
"_parent": {
"__id__": 2
62
"__id__": 2
70
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
64
"__id__": 2
72
}
],
"_prefab": null,
...
...
@@ -12723,7 +12994,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
63
"__id__": 2
71
},
"_enabled": true,
"_clip": {
...
...
assets/OPW_BoardGame_L5R4/scene/OPW_BoardGame_L5R4.ts
View file @
b739e1fc
...
...
@@ -27,6 +27,7 @@ const MSG_PLAYER_TO_HOME = "msg_player_to_home";
const
MSG_PROFIX_END
=
"
__END__
"
;
const
DEBUG
=
true
;
const
TOTAL_SCORE
=
42
;
// 总分 - 双方分数之和等于 TOTAL_SCORE
const
AI_SUCCESS_RATE
=
0.85
;
// ai评测成功率
@
ccclass
export
default
class
SceneComponent
extends
MyCocosSceneComponent
{
...
...
@@ -152,6 +153,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
initLoadingLayer
();
this
.
initOfflineLayer
();
this
.
initPronunciationTestLayer
();
this
.
initCoolCat
();
this
.
initTurntable
();
this
.
initGemstone
();
this
.
initScore
();
...
...
@@ -210,6 +212,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
initPronunciationTestLayer
()
{
const
loadingLayerBase
=
cc
.
find
(
"
Canvas/PronunciationTestLayer
"
);
this
.
pronunciationTestLayer
=
loadingLayerBase
.
getComponent
(
"
PronunciationTestLayer
"
);
this
.
pronunciationTestLayer
.
init
(
"
http://staging-teach.cdn.ireadabc.com/31952573236dd316a8ee1672d1614a1c.mp3
"
)
}
redPlayerNode
=
null
;
...
...
@@ -238,6 +241,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
treeNode
=
cc
.
find
(
"
Canvas/center_map/tree/stand
"
);
}
// 初始化酷猫
coolCat
=
null
;
initCoolCat
()
{
this
.
coolCat
=
cc
.
find
(
"
Canvas/coolcatLand/coolcat
"
);
}
// 小人上树
playerToTree
(
playerNode
)
{
const
wordPos
=
this
.
treeNode
.
convertToWorldSpaceAR
(
cc
.
v2
(
0
,
0
))
...
...
@@ -700,7 +709,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
if
(
isAi
)
{
setTimeout
(()
=>
{
console
.
log
(
"
语音评测结束
"
)
if
(
Math
.
random
()
>
1
)
{
if
(
Math
.
random
()
>
AI_SUCCESS_RATE
)
{
console
.
log
(
"
评测失败,后退
"
)
// 后退
this
.
runEvent
(
MSG_PLAYER_TO_HOME
,
{
success
:
false
,
gemIndex
:
param
.
index
});
...
...
@@ -711,7 +720,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
},
DEBUG
?
10
:
2000
);
}
else
{
this
.
coolCat
.
active
=
false
;
this
.
pronunciationTestLayer
.
showVoice
(
this
.
gemstonesAll
[
param
.
index
],
this
.
gemstonesAll
[
param
.
index
].
__letter
).
then
(
res
=>
{
this
.
coolCat
.
active
=
true
;
this
.
runEvent
(
MSG_PLAYER_TO_HOME
,
{
success
:
res
,
gemIndex
:
param
.
index
});
})
}
...
...
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