Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Sbx_Pronunciation
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
Sbx_Pronunciation
Commits
26662d28
Commit
26662d28
authored
Dec 14, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix
parent
af75a815
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
31 deletions
+43
-31
Cartoon.js
play/assets/tmpGame/script/Cartoon.js
+4
-1
GameLogic.js
play/assets/tmpGame/script/GameLogic.js
+38
-29
Scene.js
play/assets/tmpGame/script/Scene.js
+1
-1
No files found.
play/assets/tmpGame/script/Cartoon.js
View file @
26662d28
...
...
@@ -168,7 +168,10 @@ export default class Cartoon {
}
stopVideo
(
videoPlayer
)
{
videoPlayer
.
stop
()
console
.
log
(
videoPlayer
)
if
(
videoPlayer
.
clip
&&
videoPlayer
.
clip
.
loaded
)
{
videoPlayer
.
stop
()
}
}
playVideo
(
videoPlayer
,
callback
)
{
...
...
play/assets/tmpGame/script/GameLogic.js
View file @
26662d28
...
...
@@ -44,18 +44,19 @@ export default class GameLogic {
this
.
initBottomButtons
();
this
.
initDragonContainers
();
this
.
initRightImageContainer
();
if
(
!
this
.
loadQuestion
(
true
))
{
const
btnRestart
=
this
.
g_cartoon
.
getCartoonElement
(
"
btn_restart
"
);
if
(
this
.
m_currentQuestion
<=
-
1
)
{
btnRestart
.
node
.
opacity
=
128
;
btnRestart
.
disable
=
true
;
console
.
log
(
"
Disable restart
"
)
}
else
{
btnRestart
.
node
.
opacity
=
255
;
btnRestart
.
disable
=
false
;
this
.
loadQuestion
(
true
).
then
(
res
=>
{
if
(
!
res
)
{
const
btnRestart
=
this
.
g_cartoon
.
getCartoonElement
(
"
btn_restart
"
);
if
(
this
.
m_currentQuestion
<=
-
1
)
{
btnRestart
.
node
.
opacity
=
128
;
btnRestart
.
disable
=
true
;
// console.log("Disable restart")
}
else
{
btnRestart
.
node
.
opacity
=
255
;
btnRestart
.
disable
=
false
;
}
}
}
})
this
.
enableClick
(
"
Sysyem_init_done
"
)
}
...
...
@@ -93,7 +94,7 @@ export default class GameLogic {
addEventListener
()
{
const
btnRestart
=
this
.
g_cartoon
.
getCartoonElement
(
"
btn_restart
"
);
this
.
g_cartoon
.
subscribeTouchEvent
(
"
bgMain
"
,
()
=>
{
if
(
btnRestart
.
disable
)
{
if
(
btnRestart
.
disable
||
!
this
.
checkClickEnable
()
)
{
return
}
this
.
playCurrentQuestion
()
...
...
@@ -291,11 +292,11 @@ export default class GameLogic {
if
(
!
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
played
)
{
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
played
=
true
;
this
.
g_cartoon
.
playAudio
(
"
sm_join
"
,
()
=>
{
this
.
stopCurrentPlaying
();
//
this.stopCurrentPlaying();
play
()
})
}
else
{
this
.
stopCurrentPlaying
();
//
this.stopCurrentPlaying();
play
()
}
...
...
@@ -445,11 +446,19 @@ export default class GameLogic {
this
.
checkButtonDisable
();
if
(
this
.
m_currentQuestion
>=
this
.
g_formData
.
dataArray
.
length
)
{
this
.
m_currentQuestion
=
this
.
g_formData
.
dataArray
.
length
-
1
return
false
;
this
.
m_currentQuestion
=
this
.
g_formData
.
dataArray
.
length
-
1
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
resolve
(
false
)
},
20
);
});
}
else
if
(
this
.
m_currentQuestion
<=
-
1
)
{
this
.
m_currentQuestion
=
0
;
return
false
;
this
.
m_currentQuestion
=
0
;
return
new
Promise
((
resolve
,
reject
)
=>
{
setTimeout
(()
=>
{
resolve
(
false
)
},
20
);
});
}
let
textDragon
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
textDragonBones
...
...
@@ -463,7 +472,7 @@ export default class GameLogic {
let
p2
=
null
if
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
rightType
==
"
image
"
)
{
console
.
log
(
"
右侧加载图片
"
)
//
console.log("右侧加载图片")
this
.
g_cartoon
.
getCartoonElement
(
"
rightImageContainer
"
).
node
.
active
=
true
this
.
g_cartoon
.
getCartoonElement
(
"
rightDragonContainer
"
).
node
.
active
=
false
p2
=
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -472,7 +481,7 @@ export default class GameLogic {
})
})
}
else
{
console
.
log
(
"
右侧加载骨骼动画
"
)
//
console.log("右侧加载骨骼动画")
this
.
g_cartoon
.
getCartoonElement
(
"
rightImageContainer
"
).
node
.
active
=
false
this
.
g_cartoon
.
getCartoonElement
(
"
rightDragonContainer
"
).
node
.
active
=
true
p2
=
new
Promise
((
resolve
,
reject
)
=>
{
...
...
@@ -507,7 +516,7 @@ export default class GameLogic {
const
btnRestart
=
this
.
g_cartoon
.
getCartoonElement
(
"
btn_restart
"
);
this
.
g_cartoon
.
subscribeTouchEvent
(
btnLeft
.
key
,
()
=>
{
if
(
btnLeft
.
disable
)
{
if
(
btnLeft
.
disable
||
!
this
.
checkClickEnable
()
)
{
return
}
this
.
g_cartoon
.
playAudio
(
"
sm_btn
"
);
...
...
@@ -525,7 +534,7 @@ export default class GameLogic {
})
this
.
g_cartoon
.
subscribeTouchEvent
(
btnRight
.
key
,
()
=>
{
if
(
btnRight
.
disable
)
{
if
(
btnRight
.
disable
||
!
this
.
checkClickEnable
()
)
{
return
}
this
.
g_cartoon
.
playAudio
(
"
sm_btn
"
);
...
...
@@ -543,7 +552,7 @@ export default class GameLogic {
})
this
.
g_cartoon
.
subscribeTouchEvent
(
btnRestart
.
key
,
()
=>
{
if
(
btnRestart
.
disable
)
{
if
(
btnRestart
.
disable
||
!
this
.
checkClickEnable
()
)
{
return
}
jelly
(
btnRestart
.
node
)
...
...
@@ -557,12 +566,12 @@ export default class GameLogic {
const
btnRight
=
this
.
g_cartoon
.
getCartoonElement
(
"
btn_right
"
);
const
btnRestart
=
this
.
g_cartoon
.
getCartoonElement
(
"
btn_restart
"
);
console
.
log
(
"
Check button disab
e
"
+
this
.
m_currentQuestion
)
// console.log("Check button disabl
e " + this.m_currentQuestion)
if
(
this
.
m_currentQuestion
<=
-
1
)
{
btnRestart
.
node
.
opacity
=
128
;
btnRestart
.
disable
=
true
;
console
.
log
(
"
Disable restart
"
)
//
console.log("Disable restart")
}
else
{
btnRestart
.
node
.
opacity
=
255
;
btnRestart
.
disable
=
false
;
...
...
@@ -571,7 +580,7 @@ export default class GameLogic {
if
(
this
.
m_currentQuestion
<=
0
)
{
btnLeft
.
node
.
opacity
=
128
;
btnLeft
.
disable
=
true
;
console
.
log
(
"
Disable left
"
)
//
console.log("Disable left")
}
else
{
btnLeft
.
node
.
opacity
=
255
;
btnLeft
.
disable
=
false
;
...
...
@@ -580,7 +589,7 @@ export default class GameLogic {
if
(
this
.
m_currentQuestion
>=
this
.
g_formData
.
dataArray
.
length
-
1
)
{
btnRight
.
node
.
opacity
=
128
;
btnRight
.
disable
=
true
;
console
.
log
(
"
Disable right
"
)
//
console.log("Disable right")
}
else
{
btnRight
.
node
.
opacity
=
255
;
btnRight
.
disable
=
false
;
...
...
@@ -698,13 +707,13 @@ export default class GameLogic {
disableClick
(
eventName
)
{
this
.
g_enableClick
=
false
;
this
.
g_disableClickEventName
=
eventName
//
console.log(`Click disabled! [${eventName}]`)
console
.
log
(
`Click disabled! [
${
eventName
}
]`
)
}
enableClick
(
eventName
)
{
this
.
g_enableClick
=
true
;
this
.
g_disableClickEventName
=
""
//
console.log(`Click enabled! [${eventName}]`)
console
.
log
(
`Click enabled! [
${
eventName
}
]`
)
}
}
play/assets/tmpGame/script/Scene.js
View file @
26662d28
...
...
@@ -104,7 +104,7 @@ cc.Class({
// const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","bgMusic":"","titleText":"TEstd","questionAudio_url":"","dataArray":[{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/06cc843598a912921f6ca3acfde6220b.png","audio_url":"http://staging-teach.cdn.ireadabc.com/3b5540cc95a006dff8c41dba7537075a.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/571974922f6678111348a5643dba7e20.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/78579114773af12a7aec6723e3b9d475.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/c99e82e1c3f087c6dc0469e30c624f70.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/5b45c89ac9e899d76522767219b1346b.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/2e28eae8f0e0f01193da6f3677379ed3.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/fad2dac4f8b59a185dc30d42617c2ca8.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/6c3fca11052464102407f173e4a83db9.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/ec82c796af801486548ae98623f614d2.png"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/ac4b9422df1556f80ac5c3058cd3d670.png"}]}}'
// const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","bgMusic":"http://staging-teach.cdn.ireadabc.com/ad58bae62ea02cf215ce7dee22df306f.mp3","titleText":"TEstd","questionAudio_url":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3","dataArray":[{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/06cc843598a912921f6ca3acfde6220b.png","audio_url":"http://staging-teach.cdn.ireadabc.com/3b5540cc95a006dff8c41dba7537075a.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/571974922f6678111348a5643dba7e20.png","audio_url":"http://staging-teach.cdn.ireadabc.com/ae7c0930a45d0ffc9f13182298e2be71.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/78579114773af12a7aec6723e3b9d475.png","audio_url":"http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/c99e82e1c3f087c6dc0469e30c624f70.png","audio_url":"http://staging-teach.cdn.ireadabc.com/135c628899396df62c14567f46d61f3f.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/5b45c89ac9e899d76522767219b1346b.png","audio_url":"http://staging-teach.cdn.ireadabc.com/3b5540cc95a006dff8c41dba7537075a.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/2e28eae8f0e0f01193da6f3677379ed3.png","audio_url":"http://staging-teach.cdn.ireadabc.com/cb0ac1d1bcdfdaf768f0a06d3fff37a3.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/fad2dac4f8b59a185dc30d42617c2ca8.png","audio_url":"http://staging-teach.cdn.ireadabc.com/9df3f14bc88bcffc49b6717c40428ed8.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/6c3fca11052464102407f173e4a83db9.png","audio_url":"http://staging-teach.cdn.ireadabc.com/d5a5ac2f45431a8a15492cb9f78e0396.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/ec82c796af801486548ae98623f614d2.png","audio_url":"http://staging-teach.cdn.ireadabc.com/fb08783926362bf64232e2ec6966011d.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/ac4b9422df1556f80ac5c3058cd3d670.png","audio_url":"http://staging-teach.cdn.ireadabc.com/fb08783926362bf64232e2ec6966011d.mp3"}]}}'
// const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","bgMusic":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3","titleText":"TEstd","questionAudio_url":"http://staging-teach.cdn.ireadabc.com/2bf96923b83ee0c5f20930386ce07384.mp3","dataArray":[{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/06cc843598a912921f6ca3acfde6220b.png","audio_url":"http://staging-teach.cdn.ireadabc.com/3b5540cc95a006dff8c41dba7537075a.mp3"},{"text":"","image_url":"http://staging-teach.cdn.ireadabc.com/571974922f6678111348a5643dba7e20.png","audio_url":"http://staging-teach.cdn.ireadabc.com/ae7c0930a45d0ffc9f13182298e2be71.mp3"}]}}'
// const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","theme":"A","border_image_url":"
http://staging-teach.cdn.ireadabc.com/c3e8520418444ad2ee7689510f98de9b.png","video_image_url":"http://staging-teach.cdn.ireadabc.com/06bb65fb7a3a03d095587b5cc2efc65f.png","text_image_url":"http://staging-teach.cdn.ireadabc.com/08a2a49e8e1e8e1dc53fb57ad8a4cb44.png","dataArray":[{"video_url":"http://staging-teach.cdn.ireadabc.com/f25bb33cdb266345667a1bec58818175.mp4","textDragonBones":{"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/b095932007653f7aa4514570af991342.png","name":"word_tex.png"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/830c92d3d3c73353cf43f03a0051123f.json","name":"dragon_tex.json"},"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/e1f26dedb60960b07f90bd42e5478ba6.json","name":"dragon_ske.json"}},"rightDragonBones":{"skeJsonData":{"url":"","name":""},"texJsonData":{"url":"","name":""},"texPngData":{"url":"","name":""}},"rightType":"image","image_url":"http://staging-teach.cdn.ireadabc.com/3aa79777f6bb704604a502c0ab05fcf0.png"},{"video_url":"http://staging-teach.cdn.ireadabc.com/82438e44e9e106cfa43d1fd62a24d61b.mp4","textDragonBones":{"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/b095932007653f7aa4514570af991342.png","name":"word_tex.png"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/4e2458f5632fbfdf6c5a1c66f8c77fe3.json","name":"word_tex.json"},"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c83f14aeee5b533cb582887f5122bcef.json","name":"word_ske.json"}},"rightDragonBones":{"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/ccc42a2a6830dd5bddc67e727ebf717b.png","name":"dragon_tex.png"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/830c92d3d3c73353cf43f03a0051123f.json","name":"dragon_tex.json"},"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/e1f26dedb60960b07f90bd42e5478ba6.json","name":"dragon_ske.json"}},"rightType":"dragonBones"}]},"border_image_url":"http://staging-teach.cdn.ireadabc.com/56009acbe3fa82935a9026ba38ee1155.jpg","video_image_url":"http://staging-teach.cdn.ireadabc.com/3e00d8db68a4d285deac9b42a2fdb02a.jpg","text_image_url":"http://staging-teach.cdn.ireadabc.com/556a588389ff7cd2aa6ca13d492cc7ce.png"
}'
// const dataJson = '{"contentObj":{"version":"1.0","key":"DataKey_Sbx_Pronunciation","theme":"A","border_image_url":"
","video_image_url":"","text_image_url":"","dataArray":[{"video_url":"http://staging-teach.cdn.ireadabc.com/f8476aa86cfb6ea4d1fbb69578f606d7.mp4","textDragonBones":{"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/b095932007653f7aa4514570af991342.png","name":"word_tex.png"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/4e2458f5632fbfdf6c5a1c66f8c77fe3.json","name":"word_tex.json"},"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c83f14aeee5b533cb582887f5122bcef.json","name":"word_ske.json"}},"rightDragonBones":{"skeJsonData":{"url":"","name":""},"texJsonData":{"url":"","name":""},"texPngData":{"url":"","name":""}},"rightType":"image","image_url":"http://staging-teach.cdn.ireadabc.com/b095932007653f7aa4514570af991342.png"},{"video_url":"http://staging-teach.cdn.ireadabc.com/f8476aa86cfb6ea4d1fbb69578f606d7.mp4","textDragonBones":{"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/b095932007653f7aa4514570af991342.png","name":"word_tex.png"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/4e2458f5632fbfdf6c5a1c66f8c77fe3.json","name":"word_tex.json"},"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c83f14aeee5b533cb582887f5122bcef.json","name":"word_ske.json"}},"rightDragonBones":{"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/b095932007653f7aa4514570af991342.png","name":"word_tex.png"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/4e2458f5632fbfdf6c5a1c66f8c77fe3.json","name":"word_tex.json"},"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/c83f14aeee5b533cb582887f5122bcef.json","name":"word_ske.json"}},"rightType":"dragonBones"}]}
}'
const
dataJson
=
'
{ "contentObj": { "version": "1.0", "key": "DataKey_Sbx_Pronunciation", "bgMusic": "", "titleText": "", "questionAudio_url": "", "birdDragonBones_1": {}, "birdDragonBones_2": {}, "birdDragonBones_audio": {}, "dataArray": [], "theme": "A" }, "border_image_url": "", "video_image_url": "", "text_image_url": "" }
'
const
data
=
JSON
.
parse
(
dataJson
);
return
data
;
...
...
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