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
3d22ca50
Commit
3d22ca50
authored
Dec 10, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix
parent
fc5f6b3c
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
491 additions
and
193 deletions
+491
-193
Scene.fire
play/assets/tmpGame/scene/Scene.fire
+173
-76
Cartoon.js
play/assets/tmpGame/script/Cartoon.js
+12
-12
GameLogic.js
play/assets/tmpGame/script/GameLogic.js
+76
-29
Scene.js
play/assets/tmpGame/script/Scene.js
+2
-2
index.html
publish/index.html
+228
-74
No files found.
play/assets/tmpGame/scene/Scene.fire
View file @
3d22ca50
This diff is collapsed.
Click to expand it.
play/assets/tmpGame/script/Cartoon.js
View file @
3d22ca50
...
@@ -167,8 +167,11 @@ export default class Cartoon {
...
@@ -167,8 +167,11 @@ export default class Cartoon {
})
})
}
}
stopVideo
(
videoPlayer
)
{
videoPlayer
.
stop
()
}
playVideo
(
videoPlayer
,
callback
)
{
playVideo
(
videoPlayer
,
callback
)
{
console
.
log
(
videoPlayer
)
if
(
videoPlayer
&&
videoPlayer
.
isPlaying
)
{
if
(
videoPlayer
&&
videoPlayer
.
isPlaying
)
{
videoPlayer
.
stop
()
videoPlayer
.
stop
()
}
}
...
@@ -347,13 +350,6 @@ class DragonBones {
...
@@ -347,13 +350,6 @@ class DragonBones {
cc
.
loader
.
load
(
image
,
(
error
,
texture
)
=>
{
cc
.
loader
.
load
(
image
,
(
error
,
texture
)
=>
{
cc
.
loader
.
load
({
url
:
atlas
,
type
:
'
txt
'
},
(
error
,
atlasJson
)
=>
{
cc
.
loader
.
load
({
url
:
atlas
,
type
:
'
txt
'
},
(
error
,
atlasJson
)
=>
{
cc
.
loader
.
load
({
url
:
ske
,
type
:
'
txt
'
},
(
error
,
dragonBonesJson
)
=>
{
cc
.
loader
.
load
({
url
:
ske
,
type
:
'
txt
'
},
(
error
,
dragonBonesJson
)
=>
{
// cc.loader.loadRes(image, (error, texture) => {
// console.log(error)
// cc.loader.loadRes(atlas, (error, atlasJson) => {
// console.log(error)
// cc.loader.loadRes(ske, (error, dragonBonesJson) => {
// console.log(error)
// console.log(atlasJson)
const
atlas
=
new
dragonBones
.
DragonBonesAtlasAsset
();
const
atlas
=
new
dragonBones
.
DragonBonesAtlasAsset
();
atlas
.
atlasJson
=
(
atlasJson
);
atlas
.
atlasJson
=
(
atlasJson
);
atlas
.
texture
=
texture
;
atlas
.
texture
=
texture
;
...
@@ -396,14 +392,14 @@ class DragonBones {
...
@@ -396,14 +392,14 @@ class DragonBones {
})
})
}
}
if
(
callback
)
{
callback
(
this
)
}
let
sx
=
parentNode
.
width
/
animaNode
.
width
;
let
sx
=
parentNode
.
width
/
animaNode
.
width
;
let
sy
=
parentNode
.
height
/
animaNode
.
height
;
let
sy
=
parentNode
.
height
/
animaNode
.
height
;
animaNode
.
setScale
(
Math
.
min
(
sx
,
sy
));
animaNode
.
setScale
(
Math
.
min
(
sx
,
sy
));
if
(
callback
)
{
callback
(
this
)
}
});
});
});
});
});
});
...
@@ -416,6 +412,10 @@ class DragonBones {
...
@@ -416,6 +412,10 @@ class DragonBones {
}
}
}
}
stopDragonBones
()
{
this
.
_animationLoaded
.
armature
().
animation
.
stop
();
}
showDragonBones
(
times
=
1
,
animaName
,
callBack
)
{
showDragonBones
(
times
=
1
,
animaName
,
callBack
)
{
let
animaNameIndex
=
this
.
_animationLoaded
.
animaNames
.
indexOf
(
animaName
)
let
animaNameIndex
=
this
.
_animationLoaded
.
animaNames
.
indexOf
(
animaName
)
if
(
this
.
_animationLoaded
&&
this
.
_animationLoaded
.
animaNames
.
length
>
0
)
{
if
(
this
.
_animationLoaded
&&
this
.
_animationLoaded
.
animaNames
.
length
>
0
)
{
...
...
play/assets/tmpGame/script/GameLogic.js
View file @
3d22ca50
...
@@ -98,7 +98,11 @@ export default class GameLogic {
...
@@ -98,7 +98,11 @@ export default class GameLogic {
}
}
initBg
()
{
initBg
()
{
console
.
log
(
this
.
g_formData
.
theme
)
const
bgBubble
=
cc
.
find
(
'
Canvas/bgMain/bubble
'
);
bgBubble
.
scale
=
this
.
g_systemOption
.
mapScaleMin
;
// bgBubble.width = cc.winSize.width
// bgBubble.height = cc.winSize.height
const
bgNode_A
=
cc
.
find
(
'
Canvas/bgMain/bg_A
'
);
const
bgNode_A
=
cc
.
find
(
'
Canvas/bgMain/bg_A
'
);
// bgNode_A.scale = this.g_systemOption.mapScaleMin;
// bgNode_A.scale = this.g_systemOption.mapScaleMin;
bgNode_A
.
width
=
cc
.
winSize
.
width
bgNode_A
.
width
=
cc
.
winSize
.
width
...
@@ -242,30 +246,43 @@ export default class GameLogic {
...
@@ -242,30 +246,43 @@ export default class GameLogic {
}
}
}
}
stopCurrentPlaying
()
{
let
rightDragon
=
this
.
g_cartoon
.
getCartoonElement
(
"
rightDragonContainer
"
)
let
videoContainer
=
this
.
g_cartoon
.
getCartoonElement
(
"
video_container_video
"
)
let
textContainer
=
this
.
g_cartoon
.
getCartoonElement
(
"
textDragonContainer
"
)
textContainer
.
dragonBones
.
stopDragonBones
()
rightDragon
.
dragonBones
.
stopDragonBones
()
this
.
g_cartoon
.
stopVideo
(
videoContainer
.
node
.
getComponent
(
cc
.
VideoPlayer
))
this
.
g_cartoon
.
stopAllAudio
()
}
playCurrentQuestion
()
{
playCurrentQuestion
()
{
const
play
=
()
=>
{
const
play
=
()
=>
{
let
rightDragon
=
this
.
g_cartoon
.
getCartoonElement
(
"
rightDragonContainer
"
)
let
rightDragon
=
this
.
g_cartoon
.
getCartoonElement
(
"
rightDragonContainer
"
)
var
container
=
this
.
g_cartoon
.
getCartoonElement
(
"
video_container_video
"
)
var
container
=
this
.
g_cartoon
.
getCartoonElement
(
"
video_container_video
"
)
this
.
g_cartoon
.
getCartoonElement
(
"
textDragonContainer
"
).
play
()
this
.
g_cartoon
.
getCartoonElement
(
"
textDragonContainer
"
).
play
()
if
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
text_audio_url
)
{
if
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
text_audio_url
)
{
this
.
g_cartoon
.
playAudio
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
text_audio_url
)
this
.
g_cartoon
.
playAudio
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
text_audio_url
)
}
}
this
.
g_cartoon
.
playVideo
(
container
.
node
.
getComponent
(
cc
.
VideoPlayer
),
()
=>
{
this
.
g_cartoon
.
playVideo
(
container
.
node
.
getComponent
(
cc
.
VideoPlayer
),
()
=>
{
rightDragon
.
play
()
rightDragon
.
play
()
console
.
log
(
"
ADV
"
)
if
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
right_audio_url
)
{
if
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
right_audio_url
)
{
this
.
g_cartoon
.
playAudio
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
right_audio_url
)
this
.
g_cartoon
.
playAudio
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
right_audio_url
)
}
}
})
})
}
}
if
(
this
.
m_firstEnter
)
{
if
(
!
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
played
)
{
this
.
m_firstEnter
=
fals
e
;
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
played
=
tru
e
;
this
.
g_cartoon
.
playAudio
(
"
sm_join
"
,
()
=>
{
this
.
g_cartoon
.
playAudio
(
"
sm_join
"
,
()
=>
{
this
.
stopCurrentPlaying
();
play
()
play
()
})
})
}
else
{
}
else
{
this
.
stopCurrentPlaying
();
play
()
play
()
}
}
...
@@ -302,14 +319,20 @@ export default class GameLogic {
...
@@ -302,14 +319,20 @@ export default class GameLogic {
}
}
}
}
textDragon
.
setDragonBones
=
(
dragon
)
=>
{
textDragon
.
setDragonBones
=
(
dragon
,
callback
)
=>
{
if
(
dragon
&&
dragon
.
texPngData
.
url
&&
dragon
.
skeJsonData
.
url
&&
dragon
.
texJsonData
.
url
)
{
if
(
dragon
&&
dragon
.
texPngData
.
url
&&
dragon
.
skeJsonData
.
url
&&
dragon
.
texJsonData
.
url
)
{
textDragon
.
dragonBones
.
setDragonBones
(
dragon
,
null
,
(
handle
)
=>
{
textDragon
.
dragonBones
.
setDragonBones
(
dragon
,
null
,
(
handle
)
=>
{
textDragon
.
dragonBonesLoaded
=
handle
;
textDragon
.
dragonBonesLoaded
=
handle
;
if
(
callback
)
{
callback
()
}
})
})
}
else
{
}
else
{
textDragon
.
dragonBones
.
deleteDragonBones
()
textDragon
.
dragonBones
.
deleteDragonBones
()
textDragon
.
dragonBonesLoaded
=
null
;
textDragon
.
dragonBonesLoaded
=
null
;
if
(
callback
)
{
callback
()
}
}
}
}
}
...
@@ -317,12 +340,12 @@ export default class GameLogic {
...
@@ -317,12 +340,12 @@ export default class GameLogic {
rightDragon
.
node
.
opacity
=
255
;
rightDragon
.
node
.
opacity
=
255
;
rightDragon
.
show
=
(
callBack
)
=>
{
rightDragon
.
show
=
(
callBack
)
=>
{
if
(
rightDragon
.
node
.
opacity
==
255
)
{
if
(
rightDragon
.
node
.
opacity
==
255
)
{
if
(
call
B
ack
)
{
if
(
call
b
ack
)
{
callback
()
callback
()
}
}
}
else
{
}
else
{
this
.
g_cartoon
.
tweenChange
(
rightDragon
.
node
,
{
opacity
:
255
},
0.3
,
()
=>
{
this
.
g_cartoon
.
tweenChange
(
rightDragon
.
node
,
{
opacity
:
255
},
0.3
,
()
=>
{
if
(
call
B
ack
)
{
if
(
call
b
ack
)
{
callback
()
callback
()
}
}
});
});
...
@@ -338,7 +361,7 @@ export default class GameLogic {
...
@@ -338,7 +361,7 @@ export default class GameLogic {
}
}
}
}
rightDragon
.
setDragonBones
=
(
dragon
)
=>
{
rightDragon
.
setDragonBones
=
(
dragon
,
callback
)
=>
{
if
(
dragon
&&
dragon
.
texPngData
.
url
&&
dragon
.
skeJsonData
.
url
&&
dragon
.
texJsonData
.
url
)
{
if
(
dragon
&&
dragon
.
texPngData
.
url
&&
dragon
.
skeJsonData
.
url
&&
dragon
.
texJsonData
.
url
)
{
rightDragon
.
dragonBones
.
setDragonBones
(
dragon
,
null
,
(
handle
)
=>
{
rightDragon
.
dragonBones
.
setDragonBones
(
dragon
,
null
,
(
handle
)
=>
{
// let sx = 498 / handle._animationLoaded.node.width;
// let sx = 498 / handle._animationLoaded.node.width;
...
@@ -354,10 +377,16 @@ export default class GameLogic {
...
@@ -354,10 +377,16 @@ export default class GameLogic {
// }, ()=>{
// }, ()=>{
// // handle.showDragonBones();
// // handle.showDragonBones();
// })
// })
if
(
callback
)
{
callback
()
}
})
})
}
else
{
}
else
{
rightDragon
.
dragonBones
.
deleteDragonBones
()
rightDragon
.
dragonBones
.
deleteDragonBones
()
rightDragon
.
dragonBonesLoaded
=
null
;
rightDragon
.
dragonBonesLoaded
=
null
;
if
(
callback
)
{
callback
()
}
}
}
}
}
}
}
...
@@ -380,22 +409,34 @@ export default class GameLogic {
...
@@ -380,22 +409,34 @@ export default class GameLogic {
let
textDragon
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
textDragonBones
let
textDragon
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
textDragonBones
let
rightDragon
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
rightDragonBones
let
rightDragon
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
rightDragonBones
this
.
g_cartoon
.
getCartoonElement
(
"
textDragonContainer
"
).
setDragonBones
(
textDragon
)
this
.
g_cartoon
.
getCartoonElement
(
"
rightDragonContainer
"
).
setDragonBones
(
rightDragon
)
let
p1
=
new
Promise
((
resolve
,
reject
)
=>
{
this
.
g_cartoon
.
getCartoonElement
(
"
textDragonContainer
"
).
setDragonBones
(
textDragon
,
()
=>
{
resolve
()
})
})
let
p2
=
new
Promise
((
resolve
,
reject
)
=>
{
this
.
g_cartoon
.
getCartoonElement
(
"
rightDragonContainer
"
).
setDragonBones
(
rightDragon
,
()
=>
{
resolve
()
})
})
let
video
=
this
.
g_cartoon
.
getCartoonElement
(
"
video_container_video
"
)
let
video
=
this
.
g_cartoon
.
getCartoonElement
(
"
video_container_video
"
)
let
p3
=
new
Promise
((
resolve
,
reject
)
=>
{
if
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
video_url
)
{
if
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
video_url
)
{
video
.
node
.
active
=
true
;
video
.
node
.
active
=
true
;
this
.
g_cartoon
.
getVideo
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
video_url
).
then
((
clip
=>
{
this
.
g_cartoon
.
getVideo
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
video_url
).
then
((
clip
=>
{
video
.
node
.
getComponent
(
cc
.
VideoPlayer
).
clip
=
clip
video
.
node
.
getComponent
(
cc
.
VideoPlayer
).
clip
=
clip
this
.
playCurrentQuestion
()
resolve
()
}))
}))
}
else
{
}
else
{
video
.
node
.
active
=
false
;
video
.
node
.
active
=
false
;
this
.
playCurrentQuestion
()
resolve
()
}
}
})
return
true
;
return
Promise
.
all
([
p1
,
p2
,
p3
])
}
}
initBottomButtons
()
{
initBottomButtons
()
{
...
@@ -409,14 +450,17 @@ export default class GameLogic {
...
@@ -409,14 +450,17 @@ export default class GameLogic {
}
}
this
.
g_cartoon
.
playAudio
(
"
sm_btn
"
);
this
.
g_cartoon
.
playAudio
(
"
sm_btn
"
);
this
.
disableClick
(
"
btn_left
"
)
this
.
disableClick
(
"
btn_left
"
)
this
.
stopCurrentPlaying
();
jelly
(
btnLeft
.
node
)
jelly
(
btnLeft
.
node
)
this
.
showMaskLayer
(()
=>
{
this
.
showMaskLayer
(()
=>
{
this
.
loadQuestion
(
false
)
this
.
loadQuestion
(
false
)
.
then
(()
=>
{
this
.
hideMaskLayer
(()
=>
{
this
.
hideMaskLayer
(()
=>
{
this
.
playCurrentQuestion
()
this
.
enableClick
(
"
btn_left
"
)
this
.
enableClick
(
"
btn_left
"
)
})
})
})
})
})
})
})
this
.
g_cartoon
.
subscribeTouchEvent
(
btnRight
.
key
,
()
=>
{
this
.
g_cartoon
.
subscribeTouchEvent
(
btnRight
.
key
,
()
=>
{
if
(
btnRight
.
disable
)
{
if
(
btnRight
.
disable
)
{
...
@@ -424,14 +468,17 @@ export default class GameLogic {
...
@@ -424,14 +468,17 @@ export default class GameLogic {
}
}
this
.
g_cartoon
.
playAudio
(
"
sm_btn
"
);
this
.
g_cartoon
.
playAudio
(
"
sm_btn
"
);
this
.
disableClick
(
"
btn_right
"
)
this
.
disableClick
(
"
btn_right
"
)
this
.
stopCurrentPlaying
();
jelly
(
btnRight
.
node
)
jelly
(
btnRight
.
node
)
this
.
showMaskLayer
(()
=>
{
this
.
showMaskLayer
(()
=>
{
this
.
loadQuestion
(
true
)
this
.
loadQuestion
(
true
)
.
then
(()
=>
{
this
.
hideMaskLayer
(()
=>
{
this
.
hideMaskLayer
(()
=>
{
this
.
playCurrentQuestion
()
this
.
enableClick
(
"
btn_right
"
)
this
.
enableClick
(
"
btn_right
"
)
})
})
})
})
})
})
})
this
.
g_cartoon
.
subscribeTouchEvent
(
btnRestart
.
key
,
()
=>
{
this
.
g_cartoon
.
subscribeTouchEvent
(
btnRestart
.
key
,
()
=>
{
if
(
btnRestart
.
disable
)
{
if
(
btnRestart
.
disable
)
{
...
...
play/assets/tmpGame/script/Scene.js
View file @
3d22ca50
This diff is collapsed.
Click to expand it.
publish/index.html
View file @
3d22ca50
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