Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hy01_danci
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
hy01_danci
Commits
1125a0b3
Commit
1125a0b3
authored
Jun 13, 2023
by
Tt
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://vcs.ireadabc.com/template/hy01_danci
parents
7233d4c1
1acd3561
Changes
14
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
3552 additions
and
187 deletions
+3552
-187
layer_record.prefab
assets/hy01_danci/common/prefab/layer_record.prefab
+1484
-0
layer_record.prefab.meta
assets/hy01_danci/common/prefab/layer_record.prefab.meta
+8
-0
LayerRecord.ts
assets/hy01_danci/common/script/LayerRecord.ts
+62
-59
p0.png
assets/hy01_danci/common/textures/record/p0.png
+0
-0
p0.png.meta
assets/hy01_danci/common/textures/record/p0.png.meta
+36
-0
p1.png
assets/hy01_danci/common/textures/record/p1.png
+0
-0
p1.png.meta
assets/hy01_danci/common/textures/record/p1.png.meta
+36
-0
p2.png
assets/hy01_danci/common/textures/record/p2.png
+0
-0
p2.png.meta
assets/hy01_danci/common/textures/record/p2.png.meta
+36
-0
p3.png
assets/hy01_danci/common/textures/record/p3.png
+0
-0
p3.png.meta
assets/hy01_danci/common/textures/record/p3.png.meta
+36
-0
voice_white.png
assets/hy01_danci/common/textures/record/voice_white.png
+0
-0
voice_white.png.meta
...ts/hy01_danci/common/textures/record/voice_white.png.meta
+36
-0
hy01_danci.fire
assets/hy01_danci/scene/hy01_danci.fire
+1818
-128
No files found.
assets/hy01_danci/common/prefab/layer_record.prefab
0 → 100644
View file @
1125a0b3
This diff is collapsed.
Click to expand it.
assets/hy01_danci/common/prefab/layer_record.prefab.meta
0 → 100644
View file @
1125a0b3
{
"ver": "1.2.9",
"uuid": "35fbe4f1-249e-4263-90a1-de923c148363",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
assets/hy01_danci/common/script/LayerRecord.ts
View file @
1125a0b3
...
...
@@ -6,48 +6,76 @@ let win: any = window;
let
courseware
=
win
.
courseware
;
@
ccclass
export
default
class
LayerRecord
extends
cc
.
Component
{
@
property
(
cc
.
Label
)
label
:
cc
.
Label
=
null
;
@
property
text
:
string
=
'
hello
'
;
// LIFE-CYCLE CALLBACKS:
onLoad
()
{
}
start
()
{
private
layout_record
:
cc
.
Node
;
onLoad
()
{
this
.
layout_record
=
pg
.
view
.
find
(
this
,
'
layout_record
'
)
let
AniNode
=
pg
.
view
.
find
(
this
.
layout_record
,
'
AniNode
'
);
AniNode
.
active
=
false
;
let
btn_play
=
pg
.
view
.
find
(
this
.
layout_record
,
'
btn_play
'
);
btn_play
.
active
=
false
;
this
.
initEvent
();
pg
.
event
.
emit
(
'
layer_record_setting
'
,
{
letter
:
'
test
'
,
targetTime
:
10
})
}
private
letter
:
string
;
private
targetTime
:
number
;
initEvent
()
{
pg
.
event
.
on
(
'
layer_record_setting
'
,
(
data
)
=>
{
this
.
letter
=
data
.
letter
this
.
targetTime
=
data
.
targetTime
})
let
btn_record
=
pg
.
view
.
find
(
this
.
layout_record
,
'
btn_record
'
);
btn_record
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onTouchRecord
,
this
);
btn_record
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
this
.
onTouchRecordEnd
,
this
);
}
showVoiceWhite
()
{
let
voice_white
=
pg
.
view
.
find
(
this
.
layout_record
,
'
voice_white
'
);
cc
.
tween
(
voice_white
).
set
({
scale
:
1
,
opacity
:
255
}).
to
(
1
,
{
scale
:
1.5
,
opacity
:
0
}).
delay
(
0.5
).
union
().
repeatForever
().
start
();
}
private
startTime
:
number
;
showTimeStart
()
{
if
(
!
this
.
targetTime
)
return
;
let
nowTime
=
new
Date
().
getTime
();
this
.
startTime
=
nowTime
;
}
showTimeUpdate
()
{
if
(
!
this
.
startTime
)
return
;
let
nowTime
=
new
Date
().
getTime
();
let
subTime
=
(
nowTime
-
this
.
startTime
)
/
1000
;
let
percent
=
1
-
(
subTime
/
this
.
targetTime
);
percent
=
Math
.
max
(
percent
,
0
)
let
record_time
=
pg
.
view
.
find
(
this
.
layout_record
,
'
record_time
'
);
record_time
.
getComponent
(
cc
.
Sprite
).
fillRange
=
percent
;
if
(
percent
==
0
)
{
this
.
showTimeEnd
();
}
}
showTimeEnd
()
{
this
.
startTime
=
null
;
let
record_time
=
pg
.
view
.
find
(
this
.
layout_record
,
'
record_time
'
);
record_time
.
getComponent
(
cc
.
Sprite
).
fillRange
=
0
;
}
protected
update
(
dt
:
number
):
void
{
this
.
showTimeUpdate
();
}
//按钮触发,使用的方法
async
onTouchRecord
()
{
let
ske
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
speak_ske
'
);
let
btn_start
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_start
'
);
let
btn_stop
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_stop
'
);
btn_start
.
active
=
false
;
btn_stop
.
active
=
true
;
ske
.
getComponent
(
dragonBones
.
ArmatureDisplay
).
timeScale
=
1
;
cc
.
audioEngine
.
stopAllEffects
();
let
AniNode
=
pg
.
view
.
find
(
this
.
layout_record
,
'
AniNode
'
);
AniNode
.
active
=
true
;
this
.
showTimeStart
();
let
end
=
pg
.
view
.
find
(
this
,
"
end
"
);
let
bg_tryagain
=
pg
.
view
.
find
(
end
,
"
bg_tryagain
"
)
pg
.
view
.
visible
(
end
,
false
);
pg
.
view
.
visible
(
bg_tryagain
,
false
);
courseware
&&
courseware
.
startTest
(
this
.
touchData
.
txt
);
//开始录音
cc
.
audioEngine
.
stopAllEffects
();
courseware
&&
courseware
.
startTest
(
this
.
letter
);
//开始录音
}
async
onTouchRecordEnd
()
{
let
ske
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
speak_ske
'
);
let
btn_start
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_start
'
);
let
btn_stop
=
pg
.
view
.
find
(
this
.
layout_speak
,
'
btn_stop
'
);
pg
.
view
.
playDBAnimation
(
ske
,
'
newAnimation
'
,
1
);
ske
.
getComponent
(
dragonBones
.
ArmatureDisplay
).
timeScale
=
10000
;
btn_stop
.
active
=
false
;
btn_start
.
active
=
false
;
let
AniNode
=
pg
.
view
.
find
(
this
.
layout_record
,
'
AniNode
'
);
AniNode
.
active
=
false
;
this
.
showTimeEnd
();
let
testData
=
{
"
dtLastResponse
"
:
"
2021-09-17 13:36:26:109
"
,
"
refText
"
:
"
I haven't found anything out about him yet.
"
,
...
...
@@ -69,38 +97,13 @@ export default class LayerRecord extends cc.Component {
"
applicationId
"
:
"
154838659000009e
"
}
if
(
!
courseware
)
return
this
.
recrodEnd
(
testData
)
// await pg.time.delay(5);
courseware
&&
courseware
.
stopTest
((
data
)
=>
{
data
=
JSON
.
parse
(
data
);
this
.
recrodEnd
(
data
);
});
//结束录音
}
private
tryData
:
Array
<
Option
>
;
async
recrodEnd
(
data
)
{
Game
.
getIns
().
player
.
addVoice
(
data
);
let
score
=
data
.
result
.
overall
;
if
(
score
>=
80
)
{
//提示成功
this
.
updateTips
(
TIPS_STATE
.
GOOD
);
Game
.
getIns
().
player
.
addRight
();
this
.
touchFishs
.
push
(
this
.
touchData
);
}
else
{
//提示失败
if
(
this
.
tryData
.
some
(
td
=>
td
.
id
==
this
.
touchData
.
id
))
{
this
.
updateTips
(
TIPS_STATE
.
COM
);
this
.
touchFishs
.
push
(
this
.
touchData
);
}
else
{
this
.
updateTips
(
TIPS_STATE
.
TRY
);
this
.
tryData
.
push
(
this
.
touchData
);
this
.
viewFishs
=
this
.
viewFishs
.
filter
(
v
=>
v
.
id
!=
this
.
touchData
.
id
);
}
}
await
pg
.
time
.
delay
(
3
);
this
.
updateTips
(
null
);
this
.
playCard
(
null
);
this
.
updateLayoutSpeak
(
true
)
this
.
touching
=
false
;
pg
.
event
.
on
(
'
layer_record_score
'
,
score
);
}
// update (dt) {}
}
assets/hy01_danci/common/textures/record/p0.png
0 → 100644
View file @
1125a0b3
7.77 KB
assets/hy01_danci/common/textures/record/p0.png.meta
0 → 100644
View file @
1125a0b3
{
"ver": "2.3.5",
"uuid": "dd5d53aa-0ec7-4476-a807-42f251d89b87",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 150,
"height": 150,
"platformSettings": {},
"subMetas": {
"p0": {
"ver": "1.0.4",
"uuid": "c9eb055f-e3e0-4f6e-9e05-45d7c4608877",
"rawTextureUuid": "dd5d53aa-0ec7-4476-a807-42f251d89b87",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 23,
"trimY": 23,
"width": 104,
"height": 104,
"rawWidth": 150,
"rawHeight": 150,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/hy01_danci/common/textures/record/p1.png
0 → 100644
View file @
1125a0b3
7.71 KB
assets/hy01_danci/common/textures/record/p1.png.meta
0 → 100644
View file @
1125a0b3
{
"ver": "2.3.5",
"uuid": "422dcc2c-0347-46ab-88d9-a167e71390ac",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 150,
"height": 150,
"platformSettings": {},
"subMetas": {
"p1": {
"ver": "1.0.4",
"uuid": "84c11178-f263-4e14-aa51-104545bb5499",
"rawTextureUuid": "422dcc2c-0347-46ab-88d9-a167e71390ac",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 23,
"trimY": 23,
"width": 104,
"height": 104,
"rawWidth": 150,
"rawHeight": 150,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/hy01_danci/common/textures/record/p2.png
0 → 100644
View file @
1125a0b3
8.01 KB
assets/hy01_danci/common/textures/record/p2.png.meta
0 → 100644
View file @
1125a0b3
{
"ver": "2.3.5",
"uuid": "27ef14bc-6d9a-4418-b9be-57fa7debf46f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 150,
"height": 150,
"platformSettings": {},
"subMetas": {
"p2": {
"ver": "1.0.4",
"uuid": "79273752-abd4-4f1c-90d6-790e6a7d507c",
"rawTextureUuid": "27ef14bc-6d9a-4418-b9be-57fa7debf46f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 23,
"trimY": 23,
"width": 104,
"height": 104,
"rawWidth": 150,
"rawHeight": 150,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/hy01_danci/common/textures/record/p3.png
0 → 100644
View file @
1125a0b3
8.36 KB
assets/hy01_danci/common/textures/record/p3.png.meta
0 → 100644
View file @
1125a0b3
{
"ver": "2.3.5",
"uuid": "0a711ec1-92b8-4ff7-b0f5-feb00b6a2c24",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 150,
"height": 150,
"platformSettings": {},
"subMetas": {
"p3": {
"ver": "1.0.4",
"uuid": "15171692-6cb7-462b-aca3-86891a8c425a",
"rawTextureUuid": "0a711ec1-92b8-4ff7-b0f5-feb00b6a2c24",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 23,
"trimY": 23,
"width": 104,
"height": 104,
"rawWidth": 150,
"rawHeight": 150,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/hy01_danci/common/textures/record/voice_white.png
0 → 100644
View file @
1125a0b3
5.66 KB
assets/hy01_danci/common/textures/record/voice_white.png.meta
0 → 100644
View file @
1125a0b3
{
"ver": "2.3.5",
"uuid": "de7b6722-7804-402d-93f0-1eb866a83834",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 184,
"height": 184,
"platformSettings": {},
"subMetas": {
"voice_white": {
"ver": "1.0.4",
"uuid": "4a26b10f-d021-4bad-ac0e-f513daa05ae5",
"rawTextureUuid": "de7b6722-7804-402d-93f0-1eb866a83834",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 1,
"offsetY": 0,
"trimX": 12,
"trimY": 11,
"width": 162,
"height": 162,
"rawWidth": 184,
"rawHeight": 184,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/hy01_danci/scene/hy01_danci.fire
View file @
1125a0b3
This diff is collapsed.
Click to expand it.
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