Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OP05
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
OP05
Commits
531fc82d
Commit
531fc82d
authored
Dec 16, 2021
by
Tt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改需求
parent
b9237bac
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
4939 additions
and
4306 deletions
+4939
-4306
tryagain.mp3
assets/OP05/audios/tryagain.mp3
+0
-0
tryagain.mp3.meta
assets/OP05/audios/tryagain.mp3.meta
+1
-1
OP05.fire
assets/OP05/scene/OP05.fire
+4523
-4180
OP05.js
assets/OP05/scene/OP05.js
+394
-117
gameManager.js
assets/OP05/scene/gameManager.js
+11
-1
defaultData.js
assets/OP05/script/defaultData.js
+4
-1
btn_replay.png
assets/OP05/textures/read/btn_replay.png
+0
-0
btn_replay.png.meta
assets/OP05/textures/read/btn_replay.png.meta
+6
-6
No files found.
assets/OP05/audios/tryagain.mp3
View file @
531fc82d
No preview for this file type
assets/OP05/audios/tryagain.mp3.meta
View file @
531fc82d
...
@@ -2,6 +2,6 @@
...
@@ -2,6 +2,6 @@
"ver": "2.0.1",
"ver": "2.0.1",
"uuid": "e187dccb-ea0a-45de-be95-53c50683cd19",
"uuid": "e187dccb-ea0a-45de-be95-53c50683cd19",
"downloadMode": 0,
"downloadMode": 0,
"duration": 1.
188
,
"duration": 1.
708286
,
"subMetas": {}
"subMetas": {}
}
}
\ No newline at end of file
assets/OP05/scene/OP05.fire
View file @
531fc82d
This source diff could not be displayed because it is too large. You can
view the blob
instead.
assets/OP05/scene/OP05.js
View file @
531fc82d
...
@@ -103,8 +103,7 @@ cc.Class({
...
@@ -103,8 +103,7 @@ cc.Class({
},
},
getDefaultData
()
{
getDefaultData
()
{
return
itemData
;
return
defaultData
;
// return defaultData;
},
},
preloadItem
()
{
preloadItem
()
{
...
@@ -173,6 +172,7 @@ cc.Class({
...
@@ -173,6 +172,7 @@ cc.Class({
this
.
initSingleData
();
this
.
initSingleData
();
this
.
initAudio
();
this
.
initAudio
();
this
.
initView
();
this
.
initView
();
this
.
initEvent
();
},
},
...
@@ -192,6 +192,8 @@ cc.Class({
...
@@ -192,6 +192,8 @@ cc.Class({
_cardTouchItems
:
null
,
_cardTouchItems
:
null
,
_successItems
:
null
,
_successItems
:
null
,
initSingleData
()
{
initSingleData
()
{
this
.
_cat
=
GameManager
.
getIns
().
cat
;
this
.
_tryagain
=
GameManager
.
getIns
().
tryagain
;
this
.
_stageData
=
GameManager
.
getIns
().
getStageData
();
this
.
_stageData
=
GameManager
.
getIns
().
getStageData
();
GameManager
.
getIns
().
setState
(
0
);
//调用数组中的数据,同时设置关卡状态为0
GameManager
.
getIns
().
setState
(
0
);
//调用数组中的数据,同时设置关卡状态为0
// console.log("1")
// console.log("1")
...
@@ -211,6 +213,25 @@ cc.Class({
...
@@ -211,6 +213,25 @@ cc.Class({
this
.
initLayout
();
this
.
initLayout
();
},
},
initLayout
()
{
initLayout
()
{
if
(
GameManager
.
getIns
().
getState
()
==
0
)
{
this
.
state0InitPart
();
}
else
if
(
GameManager
.
getIns
().
getState
()
==
1
)
{
this
.
state1StartPlay
();
}
else
if
(
GameManager
.
getIns
().
getState
()
==
2
)
{
this
.
state2ComplatePlay
();
}
else
if
(
GameManager
.
getIns
().
getState
()
==
3
)
{
this
.
state3GoodJob
();
}
else
if
(
GameManager
.
getIns
().
getState
()
==
4
)
{
this
.
state4TryAgain
();
}
else
if
(
GameManager
.
getIns
().
getState
()
==
5
)
{
this
.
state5Finish
();
}
else
if
(
GameManager
.
getIns
().
getState
()
==
6
)
{
}
},
initEvent
()
{
let
btn_mao
=
pg
.
view
.
find
(
this
,
"
btn_mao
"
)
let
btn_carton
=
pg
.
view
.
find
(
this
,
"
btn_carton
"
)
let
btn_replay
=
pg
.
view
.
find
(
this
,
"
btn_replay
"
)
let
btn_replay
=
pg
.
view
.
find
(
this
,
"
btn_replay
"
)
let
btn_recording
=
pg
.
view
.
find
(
this
,
"
btn_recording
"
)
let
btn_recording
=
pg
.
view
.
find
(
this
,
"
btn_recording
"
)
let
btn_record
=
pg
.
view
.
find
(
this
,
"
btn_record
"
)
let
btn_record
=
pg
.
view
.
find
(
this
,
"
btn_record
"
)
...
@@ -228,51 +249,188 @@ cc.Class({
...
@@ -228,51 +249,188 @@ cc.Class({
let
icon_hand
=
pg
.
view
.
find
(
this
,
"
icon_hand
"
);
let
icon_hand
=
pg
.
view
.
find
(
this
,
"
icon_hand
"
);
let
btn_picture
=
pg
.
view
.
find
(
this
,
"
btn_picture
"
);
let
btn_picture
=
pg
.
view
.
find
(
this
,
"
btn_picture
"
);
pg
.
view
.
touchOn
(
btn_record
,
this
.
onTouchRecord
,
this
);
//注册按钮监听
pg
.
view
.
touchOn
(
btn_record
,
this
.
onTouchRecord
,
this
);
//注册按钮监听
pg
.
view
.
touchOn
(
btn_next
,
this
.
onTouchNext
,
this
);
pg
.
view
.
touchOn
(
btn_next
,
this
.
onTouchNext
,
this
);
pg
.
view
.
touchOn
(
btn_return
,
this
.
onTouchReturn
,
this
);
pg
.
view
.
touchOn
(
btn_return
,
this
.
onTouchReturn
,
this
);
pg
.
view
.
touchOn
(
btn_recording
,
this
.
onTouchRecording
,
this
);
pg
.
view
.
touchOn
(
btn_recording
,
this
.
onTouchRecording
,
this
);
pg
.
view
.
touchOn
(
btn_replay
,
this
.
onTouchReplay
,
this
);
pg
.
view
.
touchOn
(
btn_replay
,
this
.
onTouchReplay
,
this
);
pg
.
view
.
touchOn
(
btn_picture
,
this
.
onTouchPicture
,
this
);
pg
.
view
.
touchOn
(
btn_picture
,
this
.
onTouchPicture
,
this
);
pg
.
view
.
touchOn
(
btn_carton
,
this
.
onTouchCarton
,
this
);
pg
.
view
.
touchOn
(
icon_ex
,
this
.
onTouchWord
,
this
);
pg
.
view
.
touchOn
(
btn_mao
,
this
.
onTouchCat
,
this
);
},
state0InitPart
()
{
let
btn_replay
=
pg
.
view
.
find
(
this
,
"
btn_replay
"
)
let
btn_recording
=
pg
.
view
.
find
(
this
,
"
btn_recording
"
)
let
btn_record
=
pg
.
view
.
find
(
this
,
"
btn_record
"
)
let
progress
=
pg
.
view
.
find
(
this
,
"
progress
"
)
let
end
=
pg
.
view
.
find
(
this
,
"
end
"
);
let
end_success
=
pg
.
view
.
find
(
end
,
"
bg_success
"
)
let
bg_tryagain
=
pg
.
view
.
find
(
end
,
"
bg_tryagain
"
)
let
carton
=
pg
.
view
.
find
(
this
,
"
carton
"
)
let
bg_book
=
pg
.
view
.
find
(
this
,
"
bg_book
"
);
let
icon_ex
=
pg
.
view
.
find
(
this
,
"
icon_ex
"
);
let
btn_next
=
pg
.
view
.
find
(
this
,
"
btn_next
"
);
let
btn_return
=
pg
.
view
.
find
(
this
,
"
btn_return
"
);
if
(
GameManager
.
getIns
().
getState
()
==
0
)
{
let
icon_ex_txt
=
pg
.
view
.
find
(
icon_ex
,
"
txt
"
);
pg
.
view
.
visible
(
btn_record
,
false
);
let
icon_hand
=
pg
.
view
.
find
(
this
,
"
icon_hand
"
);
pg
.
view
.
visible
(
end
,
false
);
//不显示的内容用false
let
btn_picture
=
pg
.
view
.
find
(
this
,
"
btn_picture
"
);
pg
.
view
.
visible
(
end_success
,
false
);
pg
.
view
.
visible
(
icon_ex
,
false
);
pg
.
view
.
visible
(
btn_replay
,
false
);
//更换书的样子
pg
.
view
.
visible
(
btn_record
,
false
);
pg
.
view
.
visible
(
btn_next
,
true
);
//显示的内容用true
pg
.
view
.
visible
(
end
,
false
);
//不显示的内容用false
pg
.
view
.
visible
(
btn_return
,
true
);
pg
.
view
.
visible
(
end_success
,
false
);
let
bg_book_img
=
this
.
_stageData
.
img
;
//从数组中调取img数据
pg
.
view
.
visible
(
icon_ex
,
false
);
pg
.
view
.
setNetImg
(
bg_book
,
bg_book_img
);
//与界面的节点绑定
//更换书的样子
//拓展加载动画的内容
pg
.
view
.
visible
(
btn_next
,
true
);
//显示的内容用true
this
.
animationName
=
""
;
pg
.
view
.
visible
(
btn_return
,
true
);
let
bg_book_img
=
this
.
_stageData
.
img
;
//从数组中调取img数据
pg
.
view
.
setNetImg
(
bg_book
,
bg_book_img
);
//与界面的节点绑定
//拓展加载动画的内容
this
.
animationName
=
""
;
this
.
_tryagainCount
=
0
;
if
(
!
this
.
_cat
||
!
this
.
_cat
.
start
||
this
.
_catStartPlayed
)
{
pg
.
view
.
loadDB
(
carton
,
{
ske
:
this
.
_stageData
.
cartoonSke
,
tex
:
this
.
_stageData
.
cartoonTex
,
png
:
this
.
_stageData
.
cartoonPng
}).
then
((
animationName
)
=>
{
pg
.
view
.
loadDB
(
carton
,
{
ske
:
this
.
_stageData
.
cartoonSke
,
tex
:
this
.
_stageData
.
cartoonTex
,
png
:
this
.
_stageData
.
cartoonPng
}).
then
((
animationName
)
=>
{
this
.
animationName
=
animationName
;
this
.
animationName
=
animationName
;
GameManager
.
getIns
().
setState
(
1
);
GameManager
.
getIns
().
setState
(
1
);
this
.
initLayout
()
//完成后直接进入下一步
this
.
initLayout
()
//完成后直接进入下一步
})
})
}
else
if
(
GameManager
.
getIns
().
getState
()
==
1
)
{
}
else
{
pg
.
view
.
visible
(
btn_replay
,
false
);
pg
.
audio
.
playAudioByUrl
(
this
.
_cat
.
start
).
then
(()
=>
{
pg
.
view
.
visible
(
btn_record
,
false
);
this
.
_catStartPlayed
=
true
;
let
dragonDisplay
=
carton
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
pg
.
view
.
loadDB
(
carton
,
{
ske
:
this
.
_stageData
.
cartoonSke
,
tex
:
this
.
_stageData
.
cartoonTex
,
png
:
this
.
_stageData
.
cartoonPng
}).
then
((
animationName
)
=>
{
dragonDisplay
.
playAnimation
(
this
.
animationName
,
1
);
//animation所有的动画名称
this
.
animationName
=
animationName
;
icon_ex_txt
.
active
=
false
;
GameManager
.
getIns
().
setState
(
1
);
icon_ex
.
active
=
false
;
this
.
initLayout
()
//完成后直接进入下一步
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
})
pg
.
view
.
visible
(
icon_ex
,
true
);
})
let
icon_ex_word
=
this
.
_stageData
.
word
;
}
this
.
wordAni
(
icon_ex_txt
,
icon_ex_word
)
},
pg
.
audio
.
playAudioByUrl
(
this
.
_stageData
.
sound
);
state1StartPlay
()
{
},
1000
*
2
));
let
btn_replay
=
pg
.
view
.
find
(
this
,
"
btn_replay
"
)
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
let
btn_recording
=
pg
.
view
.
find
(
this
,
"
btn_recording
"
)
pg
.
view
.
visible
(
btn_record
,
true
);
let
btn_record
=
pg
.
view
.
find
(
this
,
"
btn_record
"
)
pg
.
view
.
visible
(
btn_replay
,
true
);
let
progress
=
pg
.
view
.
find
(
this
,
"
progress
"
)
this
.
playSFX
(
"
audio_record
"
);
let
end
=
pg
.
view
.
find
(
this
,
"
end
"
);
},
1000
*
6.3
));
let
end_success
=
pg
.
view
.
find
(
end
,
"
bg_success
"
)
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
let
bg_tryagain
=
pg
.
view
.
find
(
end
,
"
bg_tryagain
"
)
let
carton
=
pg
.
view
.
find
(
this
,
"
carton
"
)
let
bg_book
=
pg
.
view
.
find
(
this
,
"
bg_book
"
);
let
icon_ex
=
pg
.
view
.
find
(
this
,
"
icon_ex
"
);
let
btn_next
=
pg
.
view
.
find
(
this
,
"
btn_next
"
);
let
btn_return
=
pg
.
view
.
find
(
this
,
"
btn_return
"
);
let
icon_ex_txt
=
pg
.
view
.
find
(
icon_ex
,
"
txt
"
);
let
icon_hand
=
pg
.
view
.
find
(
this
,
"
icon_hand
"
);
let
btn_picture
=
pg
.
view
.
find
(
this
,
"
btn_picture
"
);
pg
.
view
.
visible
(
btn_replay
,
false
);
pg
.
view
.
visible
(
btn_record
,
false
);
this
.
playPartAni
()
this
.
playWordAni
().
then
(()
=>
{
this
.
playRecordAudio
();
})
// this._timeoutIds.push(setTimeout(() => {
// pg.view.visible(icon_hand, true);
// let action = cc.tween(icon_hand);
// action.sequence(
// cc.tween().by(0.5, { y: 50 }),
// cc.tween().by(0.5, { y: -50 }),
// ).repeatForever();
// action.start();
// }, 1000 * 6.3));
},
state2ComplatePlay
()
{
let
btn_replay
=
pg
.
view
.
find
(
this
,
"
btn_replay
"
)
let
btn_recording
=
pg
.
view
.
find
(
this
,
"
btn_recording
"
)
let
btn_record
=
pg
.
view
.
find
(
this
,
"
btn_record
"
)
let
progress
=
pg
.
view
.
find
(
this
,
"
progress
"
)
let
end
=
pg
.
view
.
find
(
this
,
"
end
"
);
let
end_success
=
pg
.
view
.
find
(
end
,
"
bg_success
"
)
let
bg_tryagain
=
pg
.
view
.
find
(
end
,
"
bg_tryagain
"
)
let
carton
=
pg
.
view
.
find
(
this
,
"
carton
"
)
let
bg_book
=
pg
.
view
.
find
(
this
,
"
bg_book
"
);
let
icon_ex
=
pg
.
view
.
find
(
this
,
"
icon_ex
"
);
let
btn_next
=
pg
.
view
.
find
(
this
,
"
btn_next
"
);
let
btn_return
=
pg
.
view
.
find
(
this
,
"
btn_return
"
);
let
icon_ex_txt
=
pg
.
view
.
find
(
icon_ex
,
"
txt
"
);
let
icon_hand
=
pg
.
view
.
find
(
this
,
"
icon_hand
"
);
let
btn_picture
=
pg
.
view
.
find
(
this
,
"
btn_picture
"
);
pg
.
view
.
visible
(
icon_hand
,
false
);
pg
.
view
.
visible
(
btn_record
,
false
);
pg
.
view
.
visible
(
btn_replay
,
false
);
pg
.
view
.
visible
(
btn_recording
,
true
);
pg
.
view
.
visible
(
progress
,
true
);
},
state3GoodJob
()
{
let
btn_replay
=
pg
.
view
.
find
(
this
,
"
btn_replay
"
)
let
btn_recording
=
pg
.
view
.
find
(
this
,
"
btn_recording
"
)
let
btn_record
=
pg
.
view
.
find
(
this
,
"
btn_record
"
)
let
progress
=
pg
.
view
.
find
(
this
,
"
progress
"
)
let
end
=
pg
.
view
.
find
(
this
,
"
end
"
);
let
end_success
=
pg
.
view
.
find
(
end
,
"
bg_success
"
)
let
bg_tryagain
=
pg
.
view
.
find
(
end
,
"
bg_tryagain
"
)
let
carton
=
pg
.
view
.
find
(
this
,
"
carton
"
)
let
bg_book
=
pg
.
view
.
find
(
this
,
"
bg_book
"
);
let
icon_ex
=
pg
.
view
.
find
(
this
,
"
icon_ex
"
);
let
btn_next
=
pg
.
view
.
find
(
this
,
"
btn_next
"
);
let
btn_return
=
pg
.
view
.
find
(
this
,
"
btn_return
"
);
let
icon_ex_txt
=
pg
.
view
.
find
(
icon_ex
,
"
txt
"
);
let
icon_hand
=
pg
.
view
.
find
(
this
,
"
icon_hand
"
);
let
btn_picture
=
pg
.
view
.
find
(
this
,
"
btn_picture
"
);
pg
.
view
.
visible
(
btn_record
,
false
);
pg
.
view
.
visible
(
btn_recording
,
false
);
pg
.
view
.
visible
(
progress
,
false
);
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
//4秒钟之后出现goodjob提示
pg
.
view
.
visible
(
end
,
true
);
pg
.
view
.
visible
(
end_success
,
true
);
this
.
playSFX
(
"
audio_goodjob
"
);
},
1000
*
0.5
));
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
this
.
nextStage
();
},
1000
*
4
));
//6秒钟之后进入下一关卡
},
state4TryAgain
()
{
let
btn_replay
=
pg
.
view
.
find
(
this
,
"
btn_replay
"
)
let
btn_recording
=
pg
.
view
.
find
(
this
,
"
btn_recording
"
)
let
btn_record
=
pg
.
view
.
find
(
this
,
"
btn_record
"
)
let
progress
=
pg
.
view
.
find
(
this
,
"
progress
"
)
let
end
=
pg
.
view
.
find
(
this
,
"
end
"
);
let
end_success
=
pg
.
view
.
find
(
end
,
"
bg_success
"
)
let
bg_tryagain
=
pg
.
view
.
find
(
end
,
"
bg_tryagain
"
)
let
carton
=
pg
.
view
.
find
(
this
,
"
carton
"
)
let
bg_book
=
pg
.
view
.
find
(
this
,
"
bg_book
"
);
let
icon_ex
=
pg
.
view
.
find
(
this
,
"
icon_ex
"
);
let
btn_next
=
pg
.
view
.
find
(
this
,
"
btn_next
"
);
let
btn_return
=
pg
.
view
.
find
(
this
,
"
btn_return
"
);
let
icon_ex_txt
=
pg
.
view
.
find
(
icon_ex
,
"
txt
"
);
let
icon_hand
=
pg
.
view
.
find
(
this
,
"
icon_hand
"
);
let
btn_picture
=
pg
.
view
.
find
(
this
,
"
btn_picture
"
);
// 一局失败弹出tryagain,同时下方录音按钮明亮并出现提示
this
.
playSFX
(
"
audio_tryagain
"
);
pg
.
view
.
visible
(
end
,
true
);
pg
.
view
.
visible
(
bg_tryagain
,
true
);
pg
.
view
.
visible
(
btn_recording
,
false
);
pg
.
view
.
visible
(
btn_record
,
true
);
pg
.
view
.
visible
(
progress
,
false
);
this
.
_playing
=
true
;
this
.
_tryagainCount
++
;
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
if
(
this
.
_tryagainCount
==
1
)
{
pg
.
audio
.
playAudioByUrl
(
this
.
_tryagain
.
one
).
then
(()
=>
{
this
.
_playing
=
false
;
})
// this.playSFX("audio_record");
pg
.
view
.
visible
(
icon_hand
,
true
);
pg
.
view
.
visible
(
icon_hand
,
true
);
let
action
=
cc
.
tween
(
icon_hand
);
let
action
=
cc
.
tween
(
icon_hand
);
action
.
sequence
(
action
.
sequence
(
...
@@ -280,35 +438,11 @@ cc.Class({
...
@@ -280,35 +438,11 @@ cc.Class({
cc
.
tween
().
by
(
0.5
,
{
y
:
-
50
}),
cc
.
tween
().
by
(
0.5
,
{
y
:
-
50
}),
).
repeatForever
();
).
repeatForever
();
action
.
start
();
action
.
start
();
},
1000
*
6.3
));
}
else
if
(
this
.
_tryagainCount
==
2
)
{
}
else
if
(
GameManager
.
getIns
().
getState
()
==
2
)
{
pg
.
audio
.
playAudioByUrl
(
this
.
_tryagain
.
two
).
then
(()
=>
{
pg
.
view
.
visible
(
icon_hand
,
false
);
this
.
_playing
=
false
;
pg
.
view
.
visible
(
btn_record
,
false
);
})
pg
.
view
.
visible
(
btn_replay
,
false
);
// this.playSFX("audio_record");
pg
.
view
.
visible
(
btn_recording
,
true
);
pg
.
view
.
visible
(
progress
,
true
);
}
else
if
(
GameManager
.
getIns
().
getState
()
==
3
)
{
pg
.
view
.
visible
(
btn_record
,
false
);
pg
.
view
.
visible
(
btn_recording
,
false
);
pg
.
view
.
visible
(
progress
,
false
);
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
//4秒钟之后出现goodjob提示
pg
.
view
.
visible
(
end
,
true
);
pg
.
view
.
visible
(
end_success
,
true
);
this
.
playSFX
(
"
audio_goodjob
"
);
},
1000
*
0.5
));
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
this
.
nextStage
();
},
1000
*
4
));
//6秒钟之后进入下一关卡
}
else
if
(
GameManager
.
getIns
().
getState
()
==
4
)
{
// 一局失败弹出tryagain,同时下方录音按钮明亮并出现提示
pg
.
view
.
visible
(
end
,
true
);
pg
.
view
.
visible
(
bg_tryagain
,
true
);
pg
.
view
.
visible
(
btn_recording
,
false
);
pg
.
view
.
visible
(
btn_record
,
true
);
pg
.
view
.
visible
(
progress
,
false
);
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
this
.
playSFX
(
"
audio_record
"
);
pg
.
view
.
visible
(
icon_hand
,
true
);
pg
.
view
.
visible
(
icon_hand
,
true
);
let
action
=
cc
.
tween
(
icon_hand
);
let
action
=
cc
.
tween
(
icon_hand
);
action
.
sequence
(
action
.
sequence
(
...
@@ -316,67 +450,188 @@ cc.Class({
...
@@ -316,67 +450,188 @@ cc.Class({
cc
.
tween
().
by
(
0.5
,
{
y
:
-
50
}),
cc
.
tween
().
by
(
0.5
,
{
y
:
-
50
}),
).
repeatForever
();
).
repeatForever
();
action
.
start
();
action
.
start
();
},
1000
*
1
));
}
else
{
pg
.
audio
.
playAudioByUrl
(
this
.
_tryagain
.
three
).
then
(()
=>
{
this
.
_playing
=
false
;
this
.
nextStage
();
})
}
},
1000
*
1
));
},
state5Finish
()
{
let
btn_replay
=
pg
.
view
.
find
(
this
,
"
btn_replay
"
)
let
btn_recording
=
pg
.
view
.
find
(
this
,
"
btn_recording
"
)
let
btn_record
=
pg
.
view
.
find
(
this
,
"
btn_record
"
)
let
progress
=
pg
.
view
.
find
(
this
,
"
progress
"
)
let
end
=
pg
.
view
.
find
(
this
,
"
end
"
);
let
end_success
=
pg
.
view
.
find
(
end
,
"
bg_success
"
)
let
bg_tryagain
=
pg
.
view
.
find
(
end
,
"
bg_tryagain
"
)
let
carton
=
pg
.
view
.
find
(
this
,
"
carton
"
)
let
bg_book
=
pg
.
view
.
find
(
this
,
"
bg_book
"
);
let
icon_ex
=
pg
.
view
.
find
(
this
,
"
icon_ex
"
);
let
btn_next
=
pg
.
view
.
find
(
this
,
"
btn_next
"
);
let
btn_return
=
pg
.
view
.
find
(
this
,
"
btn_return
"
);
let
icon_ex_txt
=
pg
.
view
.
find
(
icon_ex
,
"
txt
"
);
let
icon_hand
=
pg
.
view
.
find
(
this
,
"
icon_hand
"
);
let
btn_picture
=
pg
.
view
.
find
(
this
,
"
btn_picture
"
);
pg
.
view
.
visible
(
end
,
false
);
pg
.
view
.
visible
(
end_success
,
false
);
pg
.
view
.
visible
(
bg_tryagain
,
false
);
}
else
if
(
GameManager
.
getIns
().
getState
()
==
5
)
{
pg
.
view
.
visible
(
end
,
false
);
pg
.
view
.
visible
(
end_success
,
false
);
pg
.
view
.
visible
(
bg_tryagain
,
false
);
this
.
playSFX
(
"
audio_finish
"
);
// pg.view.visible(btn_picture, true);
pg
.
view
.
visible
(
btn_record
,
false
);
onHomeworkFinish
&&
onHomeworkFinish
();
}
else
if
(
GameManager
.
getIns
().
getState
()
==
6
)
{
}
pg
.
audio
.
playAudioByUrl
(
this
.
_cat
.
finish
)
// this.playSFX("audio_finish");
// pg.view.visible(btn_picture, true);
pg
.
view
.
visible
(
btn_record
,
false
);
onHomeworkFinish
&&
onHomeworkFinish
();
},
playPartAni
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
btn_replay
=
pg
.
view
.
find
(
this
,
"
btn_replay
"
)
let
btn_recording
=
pg
.
view
.
find
(
this
,
"
btn_recording
"
)
let
btn_record
=
pg
.
view
.
find
(
this
,
"
btn_record
"
)
let
progress
=
pg
.
view
.
find
(
this
,
"
progress
"
)
let
end
=
pg
.
view
.
find
(
this
,
"
end
"
);
let
end_success
=
pg
.
view
.
find
(
end
,
"
bg_success
"
)
let
bg_tryagain
=
pg
.
view
.
find
(
end
,
"
bg_tryagain
"
)
let
carton
=
pg
.
view
.
find
(
this
,
"
carton
"
)
let
bg_book
=
pg
.
view
.
find
(
this
,
"
bg_book
"
);
let
icon_ex
=
pg
.
view
.
find
(
this
,
"
icon_ex
"
);
let
btn_next
=
pg
.
view
.
find
(
this
,
"
btn_next
"
);
let
btn_return
=
pg
.
view
.
find
(
this
,
"
btn_return
"
);
let
icon_ex_txt
=
pg
.
view
.
find
(
icon_ex
,
"
txt
"
);
let
icon_hand
=
pg
.
view
.
find
(
this
,
"
icon_hand
"
);
let
btn_picture
=
pg
.
view
.
find
(
this
,
"
btn_picture
"
);
let
dragonDisplay
=
carton
.
getComponent
(
dragonBones
.
ArmatureDisplay
);
dragonDisplay
.
playAnimation
(
this
.
animationName
,
1
);
//animation所有的动画名称
});
},
playWordAni
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
let
btn_replay
=
pg
.
view
.
find
(
this
,
"
btn_replay
"
)
let
btn_recording
=
pg
.
view
.
find
(
this
,
"
btn_recording
"
)
let
btn_record
=
pg
.
view
.
find
(
this
,
"
btn_record
"
)
let
progress
=
pg
.
view
.
find
(
this
,
"
progress
"
)
let
end
=
pg
.
view
.
find
(
this
,
"
end
"
);
let
end_success
=
pg
.
view
.
find
(
end
,
"
bg_success
"
)
let
bg_tryagain
=
pg
.
view
.
find
(
end
,
"
bg_tryagain
"
)
let
carton
=
pg
.
view
.
find
(
this
,
"
carton
"
)
let
bg_book
=
pg
.
view
.
find
(
this
,
"
bg_book
"
);
let
icon_ex
=
pg
.
view
.
find
(
this
,
"
icon_ex
"
);
let
btn_next
=
pg
.
view
.
find
(
this
,
"
btn_next
"
);
let
btn_return
=
pg
.
view
.
find
(
this
,
"
btn_return
"
);
let
icon_ex_txt
=
pg
.
view
.
find
(
icon_ex
,
"
txt
"
);
let
icon_hand
=
pg
.
view
.
find
(
this
,
"
icon_hand
"
);
let
btn_picture
=
pg
.
view
.
find
(
this
,
"
btn_picture
"
);
this
.
_playing
=
true
;
icon_ex_txt
.
active
=
false
;
icon_ex
.
active
=
false
;
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
pg
.
view
.
visible
(
icon_ex
,
true
);
let
icon_ex_word
=
this
.
_stageData
.
word
;
let
aniFinished
=
false
;
let
audioFinished
=
false
;
this
.
wordAni
(
icon_ex_txt
,
icon_ex_word
).
then
(()
=>
{
aniFinished
=
true
;
if
(
aniFinished
&&
audioFinished
)
{
this
.
_playing
=
false
;
resolve
(
''
);
}
})
pg
.
audio
.
playAudioByUrl
(
this
.
_stageData
.
sound
).
then
(()
=>
{
audioFinished
=
true
;
if
(
aniFinished
&&
audioFinished
)
{
this
.
_playing
=
false
;
resolve
(
''
);
}
})
},
1000
*
2
));
});
},
},
playRecordAudio
()
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
_playing
=
true
;
let
btn_replay
=
pg
.
view
.
find
(
this
,
"
btn_replay
"
)
let
btn_recording
=
pg
.
view
.
find
(
this
,
"
btn_recording
"
)
let
btn_record
=
pg
.
view
.
find
(
this
,
"
btn_record
"
)
let
progress
=
pg
.
view
.
find
(
this
,
"
progress
"
)
let
end
=
pg
.
view
.
find
(
this
,
"
end
"
);
let
end_success
=
pg
.
view
.
find
(
end
,
"
bg_success
"
)
let
bg_tryagain
=
pg
.
view
.
find
(
end
,
"
bg_tryagain
"
)
let
carton
=
pg
.
view
.
find
(
this
,
"
carton
"
)
let
bg_book
=
pg
.
view
.
find
(
this
,
"
bg_book
"
);
let
icon_ex
=
pg
.
view
.
find
(
this
,
"
icon_ex
"
);
let
btn_next
=
pg
.
view
.
find
(
this
,
"
btn_next
"
);
let
btn_return
=
pg
.
view
.
find
(
this
,
"
btn_return
"
);
let
icon_ex_txt
=
pg
.
view
.
find
(
icon_ex
,
"
txt
"
);
let
icon_hand
=
pg
.
view
.
find
(
this
,
"
icon_hand
"
);
let
btn_picture
=
pg
.
view
.
find
(
this
,
"
btn_picture
"
);
pg
.
view
.
visible
(
btn_record
,
true
);
pg
.
view
.
visible
(
btn_replay
,
true
);
if
(
this
.
_audio_record
)
{
this
.
_playing
=
false
;
resolve
(
""
);
}
else
{
this
.
_audio_record
=
true
;
pg
.
audio
.
playAudioByUrl
(
this
.
_cat
.
record
).
then
(()
=>
{
this
.
_playing
=
false
;
resolve
(
''
);
})
}
});
},
wordAni
(
item
,
content
)
{
wordAni
(
item
,
content
)
{
item
.
active
=
true
;
return
new
Promise
((
resolve
,
reject
)
=>
{
let
itemfirst
=
pg
.
view
.
find
(
item
,
"
first
"
);
item
.
active
=
true
;
//动态居中算法。
let
itemfirst
=
pg
.
view
.
find
(
item
,
"
first
"
);
//锚点在中间,左右延长,第一个字不去显示
//动态居中算法。
let
contentArr
=
content
.
split
(
""
);
//锚点在中间,左右延长,第一个字不去显示
let
s0
=
contentArr
.
shift
();
let
contentArr
=
content
.
split
(
""
);
let
s1
=
contentArr
.
join
(
""
);
let
s0
=
contentArr
.
shift
();
//首字母变大
let
s1
=
contentArr
.
join
(
""
);
let
count
=
100
;
//首字母变大
let
max
=
150
;
let
count
=
100
;
let
str1
=
`<size=
${
max
}
><color=#ffffff>
${
s0
}
</color></size><size=
${
count
}
><color=#0000>
${
s1
}
</color></size>`
let
max
=
150
;
let
strfirst1
=
`<size=
${
max
}
><color=#fc4a4a>
${
s0
}
</color></size>`
;
let
str1
=
`<size=
${
max
}
><color=#ffffff>
${
s0
}
</color></size><size=
${
count
}
><color=#0000>
${
s1
}
</color></size>`
item
.
getComponent
(
cc
.
RichText
).
string
=
str1
;
let
strfirst1
=
`<size=
${
max
}
><color=#fc4a4a>
${
s0
}
</color></size>`
;
itemfirst
.
y
=
17
;
item
.
getComponent
(
cc
.
RichText
).
string
=
str1
;
itemfirst
.
getComponent
(
cc
.
RichText
).
string
=
strfirst1
;
itemfirst
.
y
=
17
;
itemfirst
.
getComponent
(
cc
.
RichText
).
string
=
strfirst1
;
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
this
.
_timeoutIds
.
push
(
setTimeout
(()
=>
{
let
times
=
20
;
let
times
=
20
;
let
time
=
0
;
let
time
=
0
;
let
inter
=
setInterval
(()
=>
{
let
inter
=
setInterval
(()
=>
{
time
++
;
time
++
;
let
nowCount
=
count
+
(
max
-
count
)
*
(
time
/
times
);
let
nowCount
=
count
+
(
max
-
count
)
*
(
time
/
times
);
if
(
nowCount
>=
150
)
{
if
(
nowCount
>=
150
)
{
nowCount
=
150
;
nowCount
=
150
;
clearInterval
(
inter
);
clearInterval
(
inter
);
}
}
let
str2
=
`<size=
${
max
}
><color=#ffffff>
${
s0
}
</color></size><size=
${
nowCount
}
><color=#0000>
${
s1
}
</color></size>`
let
str2
=
`<size=
${
max
}
><color=#ffffff>
${
s0
}
</color></size><size=
${
nowCount
}
><color=#0000>
${
s1
}
</color></size>`
itemfirst
.
y
=
0
;
itemfirst
.
y
=
0
;
item
.
getComponent
(
cc
.
RichText
).
string
=
str2
;
item
.
getComponent
(
cc
.
RichText
).
string
=
str2
;
},
30
);
},
30
);
this
.
_intervalIds
.
push
(
inter
);
this
.
_intervalIds
.
push
(
inter
);
},
4100
));
setTimeout
(()
=>
{
// setTimeout(() => {
resolve
(
''
);
// //全部变大
},
1200
);
// let str2 = `<size=150><color=#ffffff>${s0}</color><color=#0000>${s1}</color></size>`
},
4100
));
// itemfirst.y = 0;
});
// item.getComponent(cc.RichText).string = str2;
// }, 1100);
},
},
//按钮触发,使用的方法
//按钮触发,使用的方法
onTouchRecord
()
{
onTouchRecord
()
{
if
(
this
.
_playing
)
return
;
this
.
playSFX
(
"
audio_btns
"
);
this
.
playSFX
(
"
audio_btns
"
);
let
end
=
pg
.
view
.
find
(
this
,
"
end
"
);
let
end
=
pg
.
view
.
find
(
this
,
"
end
"
);
let
bg_tryagain
=
pg
.
view
.
find
(
end
,
"
bg_tryagain
"
)
let
bg_tryagain
=
pg
.
view
.
find
(
end
,
"
bg_tryagain
"
)
...
@@ -393,12 +648,12 @@ cc.Class({
...
@@ -393,12 +648,12 @@ cc.Class({
"
recordId
"
:
"
6144295213f0a2200000ed93
"
,
"
recordId
"
:
"
6144295213f0a2200000ed93
"
,
"
eof
"
:
1
,
"
eof
"
:
1
,
"
result
"
:
{
"
result
"
:
{
"
pronunciation
"
:
7
5
,
"
pronunciation
"
:
2
5
,
"
resource_version
"
:
"
3.1.0
"
,
"
resource_version
"
:
"
3.1.0
"
,
"
fluency
"
:
60
,
"
fluency
"
:
60
,
"
rhythm
"
:
90
,
"
rhythm
"
:
90
,
"
kernel_version
"
:
"
5.2.4
"
,
"
kernel_version
"
:
"
5.2.4
"
,
"
overall
"
:
7
4
,
"
overall
"
:
7
5
,
"
integrity
"
:
100
,
"
integrity
"
:
100
,
"
duration
"
:
"
6.779
"
,
"
duration
"
:
"
6.779
"
,
"
rear_tone
"
:
"
fall
"
,
"
rear_tone
"
:
"
fall
"
,
...
@@ -437,6 +692,7 @@ cc.Class({
...
@@ -437,6 +692,7 @@ cc.Class({
},
},
onTouchReplay
()
{
onTouchReplay
()
{
if
(
this
.
_playing
)
return
;
this
.
playSFX
(
"
audio_btns
"
);
this
.
playSFX
(
"
audio_btns
"
);
GameManager
.
getIns
().
setState
(
1
);
GameManager
.
getIns
().
setState
(
1
);
this
.
initLayout
()
this
.
initLayout
()
...
@@ -445,6 +701,25 @@ cc.Class({
...
@@ -445,6 +701,25 @@ cc.Class({
// this.playSFX("audio_btns");
// this.playSFX("audio_btns");
},
},
onTouchCarton
()
{
if
(
this
.
_playing
)
return
;
this
.
_playing
=
true
;
this
.
playPartAni
();
setTimeout
(()
=>
{
this
.
_playing
=
false
;
},
900
);
},
onTouchWord
()
{
if
(
this
.
_playing
)
return
;
this
.
playWordAni
();
},
onTouchCat
()
{
if
(
this
.
_playing
)
return
;
this
.
_playing
=
true
;
pg
.
audio
.
playAudioByUrl
(
this
.
_cat
.
wait
).
then
(()
=>
{
this
.
_playing
=
false
;
})
},
nextStage
()
{
nextStage
()
{
let
isOver
=
GameManager
.
getIns
().
addStage
();
//关卡标记+1
let
isOver
=
GameManager
.
getIns
().
addStage
();
//关卡标记+1
...
@@ -561,8 +836,10 @@ cc.Class({
...
@@ -561,8 +836,10 @@ cc.Class({
if
(
!
audioSource
)
return
resolve
();
if
(
!
audioSource
)
return
resolve
();
let
audioClip
=
audioSource
.
clip
;
let
audioClip
=
audioSource
.
clip
;
if
(
!
audioClip
)
return
resolve
();
if
(
!
audioClip
)
return
resolve
();
cc
.
audioEngine
.
play
(
audioClip
,
false
,
1
);
let
id
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
1
);
resolve
(
''
);
cc
.
audioEngine
.
setFinishCallback
(
id
,
()
=>
{
resolve
();
})
});
});
},
},
...
...
assets/OP05/scene/gameManager.js
View file @
531fc82d
...
@@ -13,13 +13,17 @@ class GameManager {
...
@@ -13,13 +13,17 @@ class GameManager {
this
.
_list
=
[];
this
.
_list
=
[];
this
.
_stage
=
0
;
//关卡
this
.
_stage
=
0
;
//关卡
this
.
_state
=
0
;
//状态
this
.
_state
=
0
;
//状态
this
.
_cat
=
{};
this
.
_tryagain
=
{};
}
}
init
()
{
init
()
{
console
.
log
(
`init`
);
console
.
log
(
`init`
);
}
}
parseData
(
data
)
{
parseData
(
data
)
{
console
.
log
(
data
);
console
.
log
(
data
);
let
arr
=
data
.
contentObj
.
picArr
;
this
.
_cat
=
data
.
contentObj
.
picArr
.
cat
;
this
.
_tryagain
=
data
.
contentObj
.
picArr
.
tryagain
;
let
arr
=
data
.
contentObj
.
picArr
.
list
;
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
let
ar
=
arr
[
i
];
let
ar
=
arr
[
i
];
let
obj
=
{};
let
obj
=
{};
...
@@ -33,6 +37,12 @@ class GameManager {
...
@@ -33,6 +37,12 @@ class GameManager {
}
}
console
.
log
(
this
.
_list
);
//原始数据转为数组
console
.
log
(
this
.
_list
);
//原始数据转为数组
}
}
get
cat
()
{
return
this
.
_cat
;
}
get
tryagain
()
{
return
this
.
_tryagain
;
}
setState
(
num
)
{
setState
(
num
)
{
this
.
_state
=
num
;
this
.
_state
=
num
;
}
}
...
...
assets/OP05/script/defaultData.js
View file @
531fc82d
...
@@ -3,7 +3,10 @@ export const defaultData = {
...
@@ -3,7 +3,10 @@ export const defaultData = {
{
{
"
picArr
"
:
{
"
picArr
"
:
{
"
cat
"
:
{
"
cat
"
:
{
"
start
"
:
"
http://staging-teach.cdn.ireadabc.com/c3db5ac421ef039cf540edfa5116c831.mp3
"
,
"
record
"
:
"
http://staging-teach.cdn.ireadabc.com/2db9fa7c28a11fdbcecfa6a5b5e62319.mp3
"
,
"
wait
"
:
"
http://staging-teach.cdn.ireadabc.com/aaeb274c49f400c26b05583d481aca09.mp3
"
,
"
finish
"
:
"
http://staging-teach.cdn.ireadabc.com/f1ce89b2162d82214369265e47d3dda3.mp3
"
"
start
"
:
"
http://staging-teach.cdn.ireadabc.com/c3db5ac421ef039cf540edfa5116c831.mp3
"
,
"
record
"
:
"
http://staging-teach.cdn.ireadabc.com/2db9fa7c28a11fdbcecfa6a5b5e62319.mp3
"
,
"
wait
"
:
"
http://staging-teach.cdn.ireadabc.com/aaeb274c49f400c26b05583d481aca09.mp3
"
,
"
finish
"
:
"
http://staging-teach.cdn.ireadabc.com/f1ce89b2162d82214369265e47d3dda3.mp3
"
},
},
"
tryagain
"
:
{
"
tryagain
"
:
{
"
one
"
:
"
http://staging-teach.cdn.ireadabc.com/bdc09d9eb89b73e67357b502ae2158dd.mp3
"
,
"
two
"
:
"
http://staging-teach.cdn.ireadabc.com/aaeb274c49f400c26b05583d481aca09.mp3
"
,
"
three
"
:
"
http://staging-teach.cdn.ireadabc.com/301ec5c708d22928ccf2162215f429fe.mp3
"
"
one
"
:
"
http://staging-teach.cdn.ireadabc.com/bdc09d9eb89b73e67357b502ae2158dd.mp3
"
,
"
two
"
:
"
http://staging-teach.cdn.ireadabc.com/aaeb274c49f400c26b05583d481aca09.mp3
"
,
"
three
"
:
"
http://staging-teach.cdn.ireadabc.com/301ec5c708d22928ccf2162215f429fe.mp3
"
...
...
assets/OP05/textures/read/btn_replay.png
View replaced file @
b9237bac
View file @
531fc82d
20 KB
|
W:
|
H:
14.6 KB
|
W:
|
H:
2-up
Swipe
Onion skin
assets/OP05/textures/read/btn_replay.png.meta
View file @
531fc82d
...
@@ -7,8 +7,8 @@
...
@@ -7,8 +7,8 @@
"premultiplyAlpha": false,
"premultiplyAlpha": false,
"genMipmaps": false,
"genMipmaps": false,
"packable": true,
"packable": true,
"width":
244
,
"width":
176
,
"height": 2
32
,
"height": 2
06
,
"platformSettings": {},
"platformSettings": {},
"subMetas": {
"subMetas": {
"btn_replay": {
"btn_replay": {
...
@@ -22,10 +22,10 @@
...
@@ -22,10 +22,10 @@
"offsetY": 0,
"offsetY": 0,
"trimX": 0,
"trimX": 0,
"trimY": 0,
"trimY": 0,
"width":
244
,
"width":
176
,
"height": 2
32
,
"height": 2
06
,
"rawWidth":
244
,
"rawWidth":
176
,
"rawHeight": 2
32
,
"rawHeight": 2
06
,
"borderTop": 0,
"borderTop": 0,
"borderBottom": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderLeft": 0,
...
...
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