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
0b690fc9
Commit
0b690fc9
authored
Dec 13, 2020
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add right image
parent
288e0210
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
221 additions
and
51 deletions
+221
-51
form.component.html
form/src/app/form/form.component.html
+20
-1
Scene.fire
play/assets/tmpGame/scene/Scene.fire
+136
-41
GameLogic.js
play/assets/tmpGame/script/GameLogic.js
+64
-8
Scene.js
play/assets/tmpGame/script/Scene.js
+1
-1
No files found.
form/src/app/form/form.component.html
View file @
0b690fc9
...
...
@@ -77,6 +77,25 @@
</div>
</div>
<div
style=
"display: flex; margin-bottom: 10px;"
>
<div
style=
"flex:1"
>
右侧显示类型
</div>
<div
style=
"flex:5"
>
<nz-select
[(
ngModel
)]="
item
.
rightType
"
(
ngModelChange
)="
saveItem
()"
style=
"width: 70%;"
>
<nz-option
nzValue=
"image"
nzLabel=
"图片"
></nz-option>
<nz-option
nzValue=
"dragonBones"
nzLabel=
"骨骼动画"
></nz-option>
</nz-select>
</div>
</div>
<div
*
ngIf=
"item.rightType=='image'"
style=
"display: flex; margin-bottom: 10px;"
>
<div
style=
"flex:1"
></div>
<div
style=
"flex:5"
>
<app-upload-image-with-preview
style=
"width: 100%;"
[
picUrl
]="
item
.
image_url
"
(
imageUploaded
)="
onImageUploadSuccessByItem
($
event
,
item
,
'
image_url
')"
></app-upload-image-with-preview>
</div>
</div>
<div
style=
"display: flex; margin-bottom: 10px;"
>
<h3
style=
"text-align: center; width: 100%;"
>
骨骼动画
</h3>
</div>
...
...
@@ -99,7 +118,7 @@
<app-audio-recorder
[
audioUrl
]="
item
.
text_audio_url
"
(
audioUploaded
)="
onAudioUploadSuccessByItem
($
event
,
item
,
'
text_audio_url
')"
></app-audio-recorder>
</div>
</div>
<div
style=
"display: flex; margin-bottom: 10px;"
>
<div
*
ngIf=
"item.rightType=='dragonBones'"
style=
"display: flex; margin-bottom: 10px;"
>
<div
style=
"flex:1"
>
右侧
</div>
...
...
play/assets/tmpGame/scene/Scene.fire
View file @
0b690fc9
...
...
@@ -17,7 +17,7 @@
"__id__": 2
},
{
"__id__": 5
3
"__id__": 5
5
}
],
"_active": false,
...
...
@@ -87,22 +87,22 @@
"__id__": 27
},
{
"__id__": 3
1
"__id__": 3
3
},
{
"__id__": 4
3
"__id__": 4
5
}
],
"_active": true,
"_components": [
{
"__id__": 5
0
"__id__": 5
2
},
{
"__id__": 5
1
"__id__": 5
3
},
{
"__id__": 5
2
"__id__": 5
4
}
],
"_prefab": null,
...
...
@@ -192,7 +192,7 @@
"array": [
0,
0,
4
24.5051021696379
,
4
16.55821922031504
,
0,
0,
0,
...
...
@@ -1361,6 +1361,9 @@
},
{
"__id__": 30
},
{
"__id__": 31
}
],
"_active": true,
...
...
@@ -1565,6 +1568,98 @@
"groupIndex": 0,
"_id": "c65g142Q1Ot5hUwPHKrILy"
},
{
"__type__": "cc.Node",
"_name": "imageContainer",
"_objFlags": 0,
"_parent": {
"__id__": 27
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 32
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 430,
"height": 550
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "b1ZXtbHKpCr6ihuZ+7oeUC"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 31
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "e2ZFRUdmBIJb8BBei1XYXs"
},
{
"__type__": "cc.Node",
"_name": "res",
...
...
@@ -1574,13 +1669,13 @@
},
"_children": [
{
"__id__": 3
2
"__id__": 3
4
},
{
"__id__": 3
5
"__id__": 3
7
},
{
"__id__":
38
"__id__":
40
}
],
"_active": false,
...
...
@@ -1638,11 +1733,11 @@
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 3
1
"__id__": 3
3
},
"_children": [
{
"__id__": 3
3
"__id__": 3
5
}
],
"_active": true,
...
...
@@ -1700,13 +1795,13 @@
"_name": "Comic Sans MS",
"_objFlags": 0,
"_parent": {
"__id__": 3
2
"__id__": 3
4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
4
"__id__": 3
6
}
],
"_prefab": null,
...
...
@@ -1762,7 +1857,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
3
"__id__": 3
5
},
"_enabled": true,
"_materials": [],
...
...
@@ -1794,11 +1889,11 @@
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 3
1
"__id__": 3
3
},
"_children": [
{
"__id__": 3
6
"__id__": 3
8
}
],
"_active": true,
...
...
@@ -1856,13 +1951,13 @@
"_name": "black",
"_objFlags": 0,
"_parent": {
"__id__": 3
5
"__id__": 3
7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
7
"__id__": 3
9
}
],
"_prefab": null,
...
...
@@ -1918,7 +2013,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
6
"__id__": 3
8
},
"_enabled": true,
"_materials": [],
...
...
@@ -1946,14 +2041,14 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 3
1
"__id__": 3
3
},
"_children": [
{
"__id__":
39
"__id__":
41
},
{
"__id__": 4
1
"__id__": 4
3
}
],
"_active": true,
...
...
@@ -2011,13 +2106,13 @@
"_name": "sm_btn",
"_objFlags": 0,
"_parent": {
"__id__":
38
"__id__":
40
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
0
"__id__": 4
2
}
],
"_prefab": null,
...
...
@@ -2073,7 +2168,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
39
"__id__":
41
},
"_enabled": true,
"_clip": {
...
...
@@ -2091,13 +2186,13 @@
"_name": "sm_join",
"_objFlags": 0,
"_parent": {
"__id__":
38
"__id__":
40
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
2
"__id__": 4
4
}
],
"_prefab": null,
...
...
@@ -2153,7 +2248,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
1
"__id__": 4
3
},
"_enabled": true,
"_clip": {
...
...
@@ -2174,14 +2269,14 @@
"__id__": 2
},
"_children": [
{
"__id__": 44
},
{
"__id__": 46
},
{
"__id__": 48
},
{
"__id__": 50
}
],
"_active": true,
...
...
@@ -2239,13 +2334,13 @@
"_name": "btn_right",
"_objFlags": 0,
"_parent": {
"__id__": 4
3
"__id__": 4
5
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
5
"__id__": 4
7
}
],
"_prefab": null,
...
...
@@ -2301,7 +2396,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
4
"__id__": 4
6
},
"_enabled": true,
"_materials": [
...
...
@@ -2333,13 +2428,13 @@
"_name": "btn_left",
"_objFlags": 0,
"_parent": {
"__id__": 4
3
"__id__": 4
5
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
7
"__id__": 4
9
}
],
"_prefab": null,
...
...
@@ -2395,7 +2490,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
6
"__id__": 4
8
},
"_enabled": true,
"_materials": [
...
...
@@ -2427,13 +2522,13 @@
"_name": "btn_restart",
"_objFlags": 0,
"_parent": {
"__id__": 4
3
"__id__": 4
5
},
"_children": [],
"_active": true,
"_components": [
{
"__id__":
49
"__id__":
51
}
],
"_prefab": null,
...
...
@@ -2489,7 +2584,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
48
"__id__":
50
},
"_enabled": true,
"_materials": [
...
...
play/assets/tmpGame/script/GameLogic.js
View file @
0b690fc9
...
...
@@ -43,6 +43,7 @@ export default class GameLogic {
this
.
addEventListener
();
this
.
initBottomButtons
();
this
.
initDragonContainers
();
this
.
initRightImageContainer
();
if
(
!
this
.
loadQuestion
(
true
))
{
const
btnRestart
=
this
.
g_cartoon
.
getCartoonElement
(
"
btn_restart
"
);
if
(
this
.
m_currentQuestion
<=
-
1
)
{
...
...
@@ -62,7 +63,9 @@ export default class GameLogic {
initNodes
()
{
this
.
g_cartoon
.
initCartoonElement
(
"
bgMain
"
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/bgMain`
))
this
.
g_cartoon
.
initCartoonElement
(
"
textDragonContainer
"
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/text_container/DB`
))
this
.
g_cartoon
.
initCartoonElement
(
"
rightDragonContainer
"
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/right_container/dragonBones`
))
this
.
g_cartoon
.
initCartoonElement
(
"
rightDragonContainer
"
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/right_container/dragonBones`
))
this
.
g_cartoon
.
initCartoonElement
(
"
rightImageContainer
"
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/right_container/imageContainer`
))
this
.
g_cartoon
.
initCartoonElement
(
`video_container`
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/video_container`
));
this
.
g_cartoon
.
initCartoonElement
(
`video_container_video`
,
this
.
g_cartoon
.
getNodeByPath
(
`Canvas/video_container/video`
));
...
...
@@ -250,9 +253,13 @@ export default class GameLogic {
let
rightDragon
=
this
.
g_cartoon
.
getCartoonElement
(
"
rightDragonContainer
"
)
let
videoContainer
=
this
.
g_cartoon
.
getCartoonElement
(
"
video_container_video
"
)
let
textContainer
=
this
.
g_cartoon
.
getCartoonElement
(
"
textDragonContainer
"
)
var
rightType
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
rightType
textContainer
.
dragonBones
.
stopDragonBones
()
rightDragon
.
dragonBones
.
stopDragonBones
()
if
(
rightType
!=
"
image
"
)
{
rightDragon
.
dragonBones
.
stopDragonBones
()
}
this
.
g_cartoon
.
stopVideo
(
videoContainer
.
node
.
getComponent
(
cc
.
VideoPlayer
))
this
.
g_cartoon
.
stopAllAudio
()
}
...
...
@@ -260,7 +267,9 @@ export default class GameLogic {
playCurrentQuestion
()
{
const
play
=
()
=>
{
let
rightDragon
=
this
.
g_cartoon
.
getCartoonElement
(
"
rightDragonContainer
"
)
let
rightImageContainer
=
this
.
g_cartoon
.
getCartoonElement
(
"
rightImageContainer
"
)
var
container
=
this
.
g_cartoon
.
getCartoonElement
(
"
video_container_video
"
)
var
rightType
=
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
rightType
this
.
g_cartoon
.
getCartoonElement
(
"
textDragonContainer
"
).
play
()
if
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
text_audio_url
)
{
...
...
@@ -268,7 +277,11 @@ export default class GameLogic {
}
this
.
g_cartoon
.
playVideo
(
container
.
node
.
getComponent
(
cc
.
VideoPlayer
),
()
=>
{
rightDragon
.
play
()
if
(
rightType
==
"
image
"
)
{
rightImageContainer
.
play
()
}
else
{
rightDragon
.
play
()
}
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
)
}
...
...
@@ -391,6 +404,38 @@ export default class GameLogic {
}
}
initRightImageContainer
()
{
let
imageContainer
=
this
.
g_cartoon
.
getCartoonElement
(
"
rightImageContainer
"
);
imageContainer
.
node
.
active
=
false
;
imageContainer
.
setImage
=
(
image_url
,
callback
)
=>
{
this
.
getSpriteFrimeByUrl
(
image_url
).
then
(
sf
=>
{
let
rect
=
sf
.
getRect
()
let
sx
=
400
/
rect
.
width
;
let
sy
=
400
/
rect
.
height
;
let
s
=
Math
.
min
(
sx
,
sy
);
imageContainer
.
node
.
setScale
(
s
,
s
)
imageContainer
.
node
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
sf
;
imageContainer
.
node
.
active
=
true
;
if
(
callback
)
{
callback
(
sf
)
}
})
}
imageContainer
.
play
=
(
callback
)
=>
{
let
sx
=
imageContainer
.
node
.
scaleX
let
sy
=
imageContainer
.
node
.
scaleY
this
.
g_cartoon
.
tweenChange
(
imageContainer
.
node
,
{
scaleX
:
sx
*
1.08
,
scaleY
:
sy
*
1.08
},
0.3
,
()
=>
{
this
.
g_cartoon
.
tweenChange
(
imageContainer
.
node
,
{
scaleX
:
sx
,
scaleY
:
sy
},
0.4
,
()
=>
{
})
})
}
}
loadQuestion
(
isNext
)
{
if
(
isNext
)
{
this
.
m_currentQuestion
++
;
...
...
@@ -416,12 +461,23 @@ export default class GameLogic {
})
})
let
p2
=
new
Promise
((
resolve
,
reject
)
=>
{
this
.
g_cartoon
.
getCartoonElement
(
"
rightDragonContainer
"
).
setDragonBones
(
rightDragon
,
()
=>
{
resolve
()
let
p2
=
null
if
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
rightType
==
"
image
"
)
{
p2
=
new
Promise
((
resolve
,
reject
)
=>
{
this
.
g_cartoon
.
getCartoonElement
(
"
rightImageContainer
"
).
setImage
(
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
].
image_url
,
()
=>
{
resolve
()
})
})
})
}
else
{
p2
=
new
Promise
((
resolve
,
reject
)
=>
{
this
.
g_cartoon
.
getCartoonElement
(
"
rightDragonContainer
"
).
setDragonBones
(
rightDragon
,
()
=>
{
resolve
()
})
})
}
this
.
g_formData
.
dataArray
[
this
.
m_currentQuestion
]
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
)
{
...
...
play/assets/tmpGame/script/Scene.js
View file @
0b690fc9
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