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
776060bf
Commit
776060bf
authored
Jul 01, 2023
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hy01修改
parent
83c91eb1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
16 deletions
+44
-16
LayerRecord_hy01_danci.ts
assets/hy01_danci/common/script/LayerRecord_hy01_danci.ts
+10
-0
hy01_danci.ts
assets/hy01_danci/scene/hy01_danci.ts
+33
-15
defaultData_hy01_danci.ts
assets/hy01_danci/script/defaultData_hy01_danci.ts
+1
-1
No files found.
assets/hy01_danci/common/script/LayerRecord_hy01_danci.ts
View file @
776060bf
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
// letter: 'test',
// letter: 'test',
// targetTime: 10
// targetTime: 10
// })
// })
// pg.event.emit('layer_record_close')
//pg.event.on('layer_record_start_record',()=>{});
//pg.event.on('layer_record_start_record',()=>{});
//pg.event.on('layer_record_end_record',()=>{});
//pg.event.on('layer_record_end_record',()=>{});
...
@@ -33,6 +34,13 @@ export default class LayerRecord extends cc.Component {
...
@@ -33,6 +34,13 @@ export default class LayerRecord extends cc.Component {
this
.
letter
=
data
.
letter
this
.
letter
=
data
.
letter
this
.
targetTime
=
data
.
targetTime
this
.
targetTime
=
data
.
targetTime
})
})
pg
.
event
.
on
(
'
layer_record_close
'
,
(
data
)
=>
{
this
.
layout_record
.
active
=
false
;
if
(
this
.
recordAudioId
)
{
cc
.
audioEngine
.
stopEffect
(
this
.
recordAudioId
)
}
this
.
playVoiceEnd
();
})
let
btn_record
=
pg
.
view
.
find
(
this
.
layout_record
,
'
btn_record
'
);
let
btn_record
=
pg
.
view
.
find
(
this
.
layout_record
,
'
btn_record
'
);
let
btn_play
=
pg
.
view
.
find
(
this
.
layout_record
,
'
btn_play
'
);
let
btn_play
=
pg
.
view
.
find
(
this
.
layout_record
,
'
btn_play
'
);
btn_record
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onTouchRecord
,
this
);
btn_record
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onTouchRecord
,
this
);
...
@@ -143,6 +151,7 @@ export default class LayerRecord extends cc.Component {
...
@@ -143,6 +151,7 @@ export default class LayerRecord extends cc.Component {
this
.
showTimeStart
();
this
.
showTimeStart
();
cc
.
audioEngine
.
stopAllEffects
();
cc
.
audioEngine
.
stopAllEffects
();
pg
.
event
.
emit
(
'
layer_record_start_record
'
);
courseware
&&
courseware
.
startTest
(
this
.
letter
);
//开始录音
courseware
&&
courseware
.
startTest
(
this
.
letter
);
//开始录音
}
}
async
onTouchRecordEnd
()
{
async
onTouchRecordEnd
()
{
...
@@ -170,6 +179,7 @@ export default class LayerRecord extends cc.Component {
...
@@ -170,6 +179,7 @@ export default class LayerRecord extends cc.Component {
"
tokenId
"
:
"
6144295408558b08dd000001
"
,
"
tokenId
"
:
"
6144295408558b08dd000001
"
,
"
applicationId
"
:
"
154838659000009e
"
"
applicationId
"
:
"
154838659000009e
"
}
}
pg
.
event
.
emit
(
'
layer_record_end_record
'
);
if
(
!
courseware
)
{
if
(
!
courseware
)
{
return
this
.
recrodEnd
(
testData
)
return
this
.
recrodEnd
(
testData
)
}
}
...
...
assets/hy01_danci/scene/hy01_danci.ts
View file @
776060bf
...
@@ -45,13 +45,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -45,13 +45,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
recordFlag
:
boolean
;
//录音模式
private
recordFlag
:
boolean
;
//录音模式
private
score
:
number
;
private
score
:
number
;
private
scoreList
:
Array
<
number
>
;
private
scoreList
:
Array
<
number
>
;
private
temp
Score
:
number
;
private
temp
Count
:
number
;
initData
()
{
initData
()
{
// 所有全局变量 默认都是null
// 所有全局变量 默认都是null
this
.
_cantouch
=
true
;
this
.
_cantouch
=
true
;
let
data
=
this
.
data
;
let
data
=
this
.
data
;
this
.
score
=
0
;
this
.
score
=
0
;
this
.
temp
Score
=
0
;
this
.
temp
Count
=
0
;
this
.
recordFlag
=
data
.
recordFlag
;
this
.
recordFlag
=
data
.
recordFlag
;
this
.
list
=
data
.
questions
[
0
].
options
;
this
.
list
=
data
.
questions
[
0
].
options
;
this
.
scoreList
=
this
.
list
.
map
(()
=>
3
);
this
.
scoreList
=
this
.
list
.
map
(()
=>
3
);
...
@@ -92,7 +92,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -92,7 +92,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
}
}
lastPage
()
{
lastPage
()
{
this
.
lastLayer
();
// 停止当前所有动作
this
.
preLayer
();
}
}
nextPage
()
{
nextPage
()
{
this
.
nextLayer
();
this
.
nextLayer
();
...
@@ -136,10 +137,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -136,10 +137,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
private
get
OutLayer
()
{
private
get
OutLayer
()
{
return
this
.
layers
[
this
.
count
+
2
]
return
this
.
layers
[
this
.
count
+
2
]
}
}
private
voiceTouchForbid
:
boolean
;
private
count
:
number
;
private
count
:
number
;
initGame
()
{
initGame
()
{
this
.
count
=
0
;
this
.
count
=
0
;
this
.
touchForbid
=
true
;
this
.
voiceTouchForbid
=
true
;
let
currentLayer
=
this
.
createLayer
();
let
currentLayer
=
this
.
createLayer
();
this
.
updateLayer
(
currentLayer
,
this
.
CurrentData
)
this
.
updateLayer
(
currentLayer
,
this
.
CurrentData
)
this
.
layers
.
push
(
currentLayer
)
this
.
layers
.
push
(
currentLayer
)
...
@@ -149,11 +152,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -149,11 +152,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
startGame
()
{
startGame
()
{
this
.
touchForbid
=
false
;
this
.
touchForbid
=
false
;
this
.
voiceTouchForbid
=
false
;
this
.
startPlay
();
this
.
startPlay
();
}
}
private
currentAudioId
:
any
;
startPlay
()
{
startPlay
()
{
this
.
touchForbid
=
false
;
if
(
this
.
recordFlag
)
{
if
(
this
.
recordFlag
)
{
this
.
touchForbid
=
false
;
pg
.
event
.
emit
(
'
layer_record_open
'
,
{
pg
.
event
.
emit
(
'
layer_record_open
'
,
{
letter
:
this
.
CurrentData
.
content
,
letter
:
this
.
CurrentData
.
content
,
targetTime
:
this
.
CurrentData
.
duration
targetTime
:
this
.
CurrentData
.
duration
...
@@ -164,12 +169,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -164,12 +169,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
let
com
=
img_voice
.
getComponent
(
ImgVoice
);
let
com
=
img_voice
.
getComponent
(
ImgVoice
);
com
.
playVoiceStart
();
com
.
playVoiceStart
();
pg
.
audio
.
playAudioByUrl
(
this
.
CurrentData
.
audio
,
()
=>
{
pg
.
audio
.
playAudioByUrl
(
this
.
CurrentData
.
audio
,
()
=>
{
this
.
currentAudioId
=
null
;
com
.
playVoiceEnd
();
com
.
playVoiceEnd
();
this
.
touchForbid
=
true
;
pg
.
event
.
once
(
'
layer_coin_show_coin_end
'
,
()
=>
{
pg
.
event
.
once
(
'
layer_coin_show_coin_end
'
,
()
=>
{
this
.
touchForbid
=
false
;
this
.
nextLayer
();
this
.
nextLayer
();
})
// 动画回调\
})
// 动画回调\
this
.
score
+=
3
;
this
.
score
+=
3
;
pg
.
event
.
emit
(
'
layer_coin_show_coin
'
,
3
)
//1 2 3硬币数量
pg
.
event
.
emit
(
'
layer_coin_show_coin
'
,
3
)
//1 2 3硬币数量
},
(
audioId
)
=>
{
this
.
currentAudioId
=
audioId
;
})
})
}
}
}
}
...
@@ -185,13 +195,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -185,13 +195,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
score
+=
1
;
this
.
score
+=
1
;
this
.
scoreList
[
this
.
count
]
-=
1
;
this
.
scoreList
[
this
.
count
]
-=
1
;
}
}
this
.
tempScore
=
0
;
}
}
onRecorScore
(
score
)
{
onRecorScore
(
score
)
{
if
(
score
<
10
)
{
if
(
score
<
10
)
{
pg
.
event
.
once
(
'
layer_right_show_tryagain_end
'
,
()
=>
{
pg
.
event
.
once
(
'
layer_right_show_tryagain_end
'
,
()
=>
{
this
.
temp
Score
+=
1
;
this
.
temp
Count
+=
1
;
if
(
this
.
temp
Score
==
2
)
{
if
(
this
.
temp
Count
==
2
)
{
this
.
addScore
(
1
);
this
.
addScore
(
1
);
pg
.
event
.
once
(
'
layer_coin_show_coin_end
'
,
()
=>
{
pg
.
event
.
once
(
'
layer_coin_show_coin_end
'
,
()
=>
{
this
.
nextLayer
();
this
.
nextLayer
();
...
@@ -227,16 +236,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -227,16 +236,18 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg
.
event
.
emit
(
'
layer_right_show_excellent
'
)
pg
.
event
.
emit
(
'
layer_right_show_excellent
'
)
}
}
}
}
lastLayer
()
{
preLayer
()
{
alert
(
"
上一题
"
)
// 积分需要计算,未获取的内容
// 积分需要计算,未获取的内容
if
(
!
this
.
LastData
)
return
;
if
(
!
this
.
LastData
)
return
;
this
.
tempCount
=
0
;
cc
.
audioEngine
.
stopEffect
(
this
.
currentAudioId
);
pg
.
event
.
emit
(
'
img_voice_play_voice_end
'
);
pg
.
event
.
emit
(
'
layer_record_close
'
);
cc
.
tween
(
this
.
LastLayer
).
to
(
3
,
{
x
:
0
,
y
:
0
,
scale
:
1
}).
start
();
cc
.
tween
(
this
.
lastLayer
).
to
(
3
,
{
x
:
0
,
y
:
0
,
scale
:
1
}).
start
();
cc
.
tween
(
this
.
CurrentLayer
).
to
(
3
,
{
x
:
this
.
layer_word_little
.
x
,
y
:
this
.
layer_word_little
.
y
,
scale
:
this
.
layer_word_little
.
scale
}).
start
();
cc
.
tween
(
this
.
CurrentLayer
).
to
(
3
,
{
x
:
this
.
layer_word_little
.
x
,
y
:
this
.
layer_word_little
.
y
,
scale
:
this
.
layer_word_little
.
scale
}).
start
();
if
(
this
.
next
Layer
)
{
if
(
this
.
Little
Layer
)
{
cc
.
tween
(
this
.
next
Layer
).
to
(
3
,
{
x
:
-
1500
}).
start
();
cc
.
tween
(
this
.
Little
Layer
).
to
(
3
,
{
x
:
-
1500
}).
start
();
}
}
this
.
scheduleOnce
(()
=>
{
this
.
scheduleOnce
(()
=>
{
this
.
count
--
;
this
.
count
--
;
...
@@ -249,6 +260,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -249,6 +260,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
gameOver
();
this
.
gameOver
();
return
;
return
;
}
}
this
.
tempCount
=
0
;
pg
.
event
.
emit
(
'
layer_record_close
'
);
this
.
currentAudioId
&&
cc
.
audioEngine
.
stopEffect
(
this
.
currentAudioId
);
pg
.
event
.
emit
(
'
img_voice_play_voice_end
'
);
// 停止当前所有动作
if
(
this
.
OutData
&&
!
this
.
OutLayer
)
{
if
(
this
.
OutData
&&
!
this
.
OutLayer
)
{
let
outLayer
=
this
.
createLittleLayer
();
let
outLayer
=
this
.
createLittleLayer
();
this
.
updateLayer
(
outLayer
,
this
.
OutData
)
this
.
updateLayer
(
outLayer
,
this
.
OutData
)
...
@@ -264,6 +280,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -264,6 +280,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc
.
tween
(
this
.
OutLayer
).
to
(
3
,
{
x
:
this
.
layer_word_little
.
x
,
y
:
this
.
layer_word_little
.
y
}).
start
();
cc
.
tween
(
this
.
OutLayer
).
to
(
3
,
{
x
:
this
.
layer_word_little
.
x
,
y
:
this
.
layer_word_little
.
y
}).
start
();
}
}
this
.
scheduleOnce
(()
=>
{
this
.
scheduleOnce
(()
=>
{
this
.
touchForbid
=
false
;
this
.
count
++
;
this
.
count
++
;
this
.
startPlay
();
this
.
startPlay
();
},
3
)
},
3
)
...
@@ -275,7 +292,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -275,7 +292,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this
.
startGame
();
this
.
startGame
();
}
}
gameOver
()
{
gameOver
()
{
pg
.
event
.
on
(
'
layer_ending_touch_replay
'
,
()
=>
{
pg
.
event
.
on
ce
(
'
layer_ending_touch_replay
'
,
()
=>
{
this
.
replay
();
this
.
replay
();
})
})
pg
.
event
.
emit
(
'
layer_ending_show
'
,
{
coin
:
this
.
score
})
pg
.
event
.
emit
(
'
layer_ending_show
'
,
{
coin
:
this
.
score
})
...
@@ -321,6 +338,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
...
@@ -321,6 +338,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
}
}
}
onTouchVoice
(
e
)
{
onTouchVoice
(
e
)
{
if
(
this
.
voiceTouchForbid
)
return
;
let
layer
=
e
.
target
.
parent
;
let
layer
=
e
.
target
.
parent
;
if
(
layer
===
this
.
CurrentLayer
)
{
if
(
layer
===
this
.
CurrentLayer
)
{
let
img_voice
=
pg
.
view
.
find
(
this
.
CurrentLayer
,
'
voice/img_voice
'
);
let
img_voice
=
pg
.
view
.
find
(
this
.
CurrentLayer
,
'
voice/img_voice
'
);
...
...
assets/hy01_danci/script/defaultData_hy01_danci.ts
View file @
776060bf
...
@@ -15,7 +15,7 @@ export const defaultData =
...
@@ -15,7 +15,7 @@ export const defaultData =
// }], "bgAudio": "", "bgAudioName": "", "audioName": "", "npcTitle": "123", "npcAudio": "http://staging-teach.cdn.ireadabc.com/f96fcb73dc6b3dcf2ce71fe2ba76e4c3_l.mp3", "npcAudioName": "选项正确.mp3"
// }], "bgAudio": "", "bgAudioName": "", "audioName": "", "npcTitle": "123", "npcAudio": "http://staging-teach.cdn.ireadabc.com/f96fcb73dc6b3dcf2ce71fe2ba76e4c3_l.mp3", "npcAudioName": "选项正确.mp3"
// }
// }
{
{
"
recordFlag
"
:
fals
e
,
"
recordFlag
"
:
tru
e
,
"
title
"
:
"
test
"
,
"
title
"
:
"
test
"
,
"
audio_url
"
:
''
,
"
audio_url
"
:
''
,
npcTitle
:
"
I show info
"
,
npcTitle
:
"
I show info
"
,
...
...
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