Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
op_09
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
op_09
Commits
93afe146
Commit
93afe146
authored
Sep 17, 2021
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 除了猫崽子以外的基本完成
parent
6b2a6207
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
1003 additions
and
54 deletions
+1003
-54
boxJump.mp3
play/assets/op_09/audios/boxJump.mp3
+0
-0
boxJump.mp3.meta
play/assets/op_09/audios/boxJump.mp3.meta
+7
-0
btn.mp3
play/assets/op_09/audios/btn.mp3
+0
-0
flyBack.mp3
play/assets/op_09/audios/flyBack.mp3
+0
-0
flyBack.mp3.meta
play/assets/op_09/audios/flyBack.mp3.meta
+7
-0
flyBackAll.mp3
play/assets/op_09/audios/flyBackAll.mp3
+0
-0
flyBackAll.mp3.meta
play/assets/op_09/audios/flyBackAll.mp3.meta
+7
-0
jumpAll.mp3
play/assets/op_09/audios/jumpAll.mp3
+0
-0
jumpAll.mp3.meta
play/assets/op_09/audios/jumpAll.mp3.meta
+7
-0
next.mp3
play/assets/op_09/audios/next.mp3
+0
-0
next.mp3.meta
play/assets/op_09/audios/next.mp3.meta
+7
-0
submit.mp3
play/assets/op_09/audios/submit.mp3
+0
-0
submit.mp3.meta
play/assets/op_09/audios/submit.mp3.meta
+7
-0
op_09.fire
play/assets/op_09/scene/op_09.fire
+772
-8
op_09.js
play/assets/op_09/scene/op_09.js
+132
-11
defaultData.js
play/assets/op_09/script/defaultData.js
+55
-33
btn_next.png.meta
play/assets/op_09/textures/btn_next.png.meta
+1
-1
btn_submit.png.meta
play/assets/op_09/textures/btn_submit.png.meta
+1
-1
No files found.
play/assets/op_09/audios/boxJump.mp3
0 → 100644
View file @
93afe146
File added
play/assets/op_09/audios/b
tn
.mp3.meta
→
play/assets/op_09/audios/b
oxJump
.mp3.meta
View file @
93afe146
{
"ver": "2.0.1",
"uuid": "
f0680ae0-c079-45ef-abd7-9e63d90b982b
",
"uuid": "
a544c1e7-32f5-4754-95a2-823398db0dcc
",
"downloadMode": 0,
"duration": 0.
130612
,
"duration": 0.
287347
,
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/audios/btn.mp3
deleted
100644 → 0
View file @
6b2a6207
File deleted
play/assets/op_09/audios/flyBack.mp3
0 → 100644
View file @
93afe146
File added
play/assets/op_09/audios/flyBack.mp3.meta
0 → 100644
View file @
93afe146
{
"ver": "2.0.1",
"uuid": "293ae196-a9b5-4da0-a0b6-597baa25f7b1",
"downloadMode": 0,
"duration": 0.365714,
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/audios/flyBackAll.mp3
0 → 100644
View file @
93afe146
File added
play/assets/op_09/audios/flyBackAll.mp3.meta
0 → 100644
View file @
93afe146
{
"ver": "2.0.1",
"uuid": "b733b7d3-4082-4320-9fe0-2ce28088b687",
"downloadMode": 0,
"duration": 0.966531,
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/audios/jumpAll.mp3
0 → 100755
View file @
93afe146
File added
play/assets/op_09/audios/jumpAll.mp3.meta
0 → 100644
View file @
93afe146
{
"ver": "2.0.1",
"uuid": "e87d3f15-54b2-4a37-9793-9923fa34fda9",
"downloadMode": 0,
"duration": 0.626939,
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/audios/next.mp3
0 → 100644
View file @
93afe146
File added
play/assets/op_09/audios/next.mp3.meta
0 → 100644
View file @
93afe146
{
"ver": "2.0.1",
"uuid": "d9be9283-652e-44da-98d6-680406e71a03",
"downloadMode": 0,
"duration": 0.168,
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/audios/submit.mp3
0 → 100644
View file @
93afe146
File added
play/assets/op_09/audios/submit.mp3.meta
0 → 100644
View file @
93afe146
{
"ver": "2.0.1",
"uuid": "7bf9c308-8dd5-411d-8770-ddc8341386d0",
"downloadMode": 0,
"duration": 0.39185,
"subMetas": {}
}
\ No newline at end of file
play/assets/op_09/scene/op_09.fire
View file @
93afe146
...
...
@@ -17,7 +17,10 @@
"__id__": 2
},
{
"__id__": 25
"__id__": 29
},
{
"__id__": 31
}
],
"_active": false,
...
...
@@ -81,13 +84,13 @@
"_active": true,
"_components": [
{
"__id__": 2
2
"__id__": 2
6
},
{
"__id__": 2
3
"__id__": 2
7
},
{
"__id__": 2
4
"__id__": 2
8
}
],
"_prefab": null,
...
...
@@ -261,12 +264,15 @@
},
{
"__id__": 17
},
{
"__id__": 21
}
],
"_active": true,
"_components": [
{
"__id__": 2
1
"__id__": 2
5
}
],
"_prefab": null,
...
...
@@ -892,7 +898,7 @@
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor":
770
,
"_srcBlendFactor":
1
,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "b9d7ec09-fa5f-4f90-be2c-e8d035b0f74d"
...
...
@@ -1006,6 +1012,201 @@
"_N$target": null,
"_id": "1egULsam1ELrvvvZ9tKrhx"
},
{
"__type__": "cc.Node",
"_name": "btnNext",
"_objFlags": 0,
"_parent": {
"__id__": 5
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 22
},
{
"__id__": 23
},
{
"__id__": 24
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 209,
"height": 146
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
883.5,
677,
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": "e4pZtT6WpEAb1mKWJ2eaDj"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 1,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "e666ed9c-0ebf-4802-8d58-7473ddde1634"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "52MkAzwH5E0afEe1YaEHhb"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 33,
"_left": 0,
"_right": 100,
"_top": 50,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "63Aaxs3kZP/75sBEZt4m03"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "8dKwluh+JP2InucTdb0dBO"
},
{
"__type__": "cc.Widget",
"_name": "",
...
...
@@ -1098,7 +1299,7 @@
"_active": true,
"_components": [
{
"__id__":
26
"__id__":
30
}
],
"_prefab": null,
...
...
@@ -1154,7 +1355,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
5
"__id__": 2
9
},
"_enabled": true,
"_materials": [
...
...
@@ -1180,5 +1381,568 @@
"_isTrimmedMode": true,
"_atlas": null,
"_id": "85SBLHTg9Bd6l76lAmLw0R"
},
{
"__type__": "cc.Node",
"_name": "audios",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 32
},
{
"__id__": 34
},
{
"__id__": 36
},
{
"__id__": 38
},
{
"__id__": 40
},
{
"__id__": 42
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_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": "5dI9hJivRIqKNCjAoCExuh"
},
{
"__type__": "cc.Node",
"_name": "next",
"_objFlags": 0,
"_parent": {
"__id__": 31
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 33
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_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": "b9j0zYYwdFrLYcVmbZXgCV"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
},
"_enabled": true,
"_clip": {
"__uuid__": "d9be9283-652e-44da-98d6-680406e71a03"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "e46L3qDBNHjYeOa6ZcLH8X"
},
{
"__type__": "cc.Node",
"_name": "boxJump",
"_objFlags": 0,
"_parent": {
"__id__": 31
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 35
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_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": "ddi+ZKiDNNGb9k1mixV4wc"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 34
},
"_enabled": true,
"_clip": {
"__uuid__": "a544c1e7-32f5-4754-95a2-823398db0dcc"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "daFnU9UOJARav8Vf9hJAo1"
},
{
"__type__": "cc.Node",
"_name": "jumpAll",
"_objFlags": 0,
"_parent": {
"__id__": 31
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 37
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_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": "c77s+++3tDKaHx8yqtWvLZ"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 36
},
"_enabled": true,
"_clip": {
"__uuid__": "e87d3f15-54b2-4a37-9793-9923fa34fda9"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "0cRPeVk2NCGYbHzN79XxO/"
},
{
"__type__": "cc.Node",
"_name": "submit",
"_objFlags": 0,
"_parent": {
"__id__": 31
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 39
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_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": "58B7xWKtROo4zV7jgIUUkE"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 38
},
"_enabled": true,
"_clip": {
"__uuid__": "7bf9c308-8dd5-411d-8770-ddc8341386d0"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "bep8AtUmNNkIH/rUHMwipt"
},
{
"__type__": "cc.Node",
"_name": "flyBack",
"_objFlags": 0,
"_parent": {
"__id__": 31
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 41
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_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": "15ewxNucZNwJQXDVDKbF6T"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 40
},
"_enabled": true,
"_clip": {
"__uuid__": "293ae196-a9b5-4da0-a0b6-597baa25f7b1"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "a2FeuXyVFGAqlwvcW2N3r4"
},
{
"__type__": "cc.Node",
"_name": "flyBackAll",
"_objFlags": 0,
"_parent": {
"__id__": 31
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 43
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_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": "0aTsq7A7JKCaoXs0NT/B0x"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 42
},
"_enabled": true,
"_clip": {
"__uuid__": "b733b7d3-4082-4320-9fe0-2ce28088b687"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "7bKZ3GoTpIhq7k4bqrsVb4"
}
]
\ No newline at end of file
play/assets/op_09/scene/op_09.js
View file @
93afe146
import
{
onHomeworkFinish
}
from
"
../script/util
"
;
import
{
onHomeworkFinish
,
randomSortByArr
}
from
"
../script/util
"
;
import
{
defaultData
}
from
"
../script/defaultData
"
;
cc
.
Class
({
...
...
@@ -150,7 +150,9 @@ cc.Class({
},
initView
()
{
this
.
jumpToQuestion
(
this
.
status
.
currentQuestionIdx
);
this
.
coolCatSpeakStart
(()
=>
{
this
.
jumpToQuestion
(
this
.
status
.
currentQuestionIdx
);
});
},
jumpToQuestion
(
questionIdx
)
{
...
...
@@ -162,13 +164,21 @@ cc.Class({
const
optionNum
=
this
.
data
.
question_arr
[
questionIdx
].
option_arr
.
length
;
const
maxOptionHeight
=
500
;
const
maxOptionWidth
=
canvasWidth
/
optionNum
;
this
.
data
.
question_arr
[
questionIdx
].
option_arr
.
forEach
(
async
(
option
,
idx
)
=>
{
const
arr
=
randomSortByArr
(
this
.
data
.
question_arr
[
questionIdx
].
option_arr
);
arr
.
forEach
(
async
(
option
,
idx
)
=>
{
const
optionNode
=
await
this
.
createOption
(
option
);
optionNode
.
name
=
`option_
${
idx
}
`
;
optionNode
.
x
=
(
maxOptionWidth
)
*
(
idx
+
0.5
)
-
canvasWidth
/
2
-
box
.
x
;
optionNode
.
x
=
canvasWidth
+
idx
*
maxOptionWidth
;
optionNode
.
y
=
canvasHeight
/
2
-
box
.
y
-
300
;
optionNode
.
scale
=
Math
.
min
(
1
,
(
maxOptionWidth
-
10
)
/
optionNode
.
width
,
maxOptionHeight
/
optionNode
.
height
);
optionNode
.
parent
=
box
;
const
targetX
=
(
maxOptionWidth
)
*
(
idx
+
0.5
)
-
canvasWidth
/
2
-
box
.
x
;
const
time
=
(
optionNode
.
x
-
targetX
)
/
1000
;
cc
.
tween
(
optionNode
)
.
to
(
time
,
{
x
:
targetX
},
cc
.
easing
.
quadIn
)
.
start
();
});
},
...
...
@@ -179,41 +189,64 @@ cc.Class({
resolve
(
optionNode
);
});
optionNode
.
optionData
=
optionData
;
optionNode
.
optionData
.
selected
=
false
;
const
box
=
cc
.
find
(
'
Canvas/bg/box
'
);
optionNode
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
(
event
)
=>
{
if
(
optionNode
.
optionData
.
selected
)
{
return
;
}
const
location
=
event
.
getLocation
();
optionNode
.
startLocation
=
location
;
optionNode
.
startPos
=
{
x
:
optionNode
.
x
,
y
:
optionNode
.
y
}
const
selectedNum
=
box
.
children
.
filter
(
child
=>
child
.
optionData
.
selected
==
true
).
length
;
optionNode
.
zIndex
=
selectedNum
;
this
.
optionJump
(
optionNode
);
this
.
playAudioByUrl
(
optionNode
.
optionData
.
audio_url
);
});
optionNode
.
on
(
cc
.
Node
.
EventType
.
TOUCH_MOVE
,
(
event
)
=>
{
if
(
optionNode
.
optionData
.
selected
)
{
return
;
}
const
location
=
event
.
getLocation
();
optionNode
.
x
=
optionNode
.
startPos
.
x
+
(
location
.
x
-
optionNode
.
startLocation
.
x
);
optionNode
.
y
=
optionNode
.
startPos
.
y
+
(
location
.
y
-
optionNode
.
startLocation
.
y
);
});
optionNode
.
on
(
cc
.
Node
.
EventType
.
TOUCH_END
,
(
event
)
=>
{
const
box
=
cc
.
find
(
'
Canvas/bg/box
'
);
if
(
optionNode
.
optionData
.
selected
)
{
return
;
}
const
rectOption
=
optionNode
.
getBoundingBox
();
if
(
!
cc
.
Intersection
.
rectRect
(
box
,
rectOption
))
{
optionNode
.
x
=
optionNode
.
startPos
.
x
;
optionNode
.
y
=
optionNode
.
startPos
.
y
;
cc
.
tween
(
optionNode
)
.
to
(
0.05
,
{
x
:
optionNode
.
startPos
.
x
,
y
:
optionNode
.
startPos
.
y
},
cc
.
easing
.
quadOut
)
.
start
();
this
.
playEffect
(
'
flyBack
'
);
return
;
}
cc
.
tween
(
optionNode
)
.
to
(
0.2
,
{
x
:
0
,
y
:
0
},
cc
.
easing
.
quadOut
)
.
to
(
0.2
,
{
x
:
0
,
y
:
10
0
},
cc
.
easing
.
quadOut
)
.
start
();
this
.
boxJump
();
optionNode
.
optionData
.
selected
=
true
;
});
return
optionNode
;
});
// optionData.audio_url
// optionData.is_right
},
optionJump
(
node
)
{
...
...
@@ -234,23 +267,102 @@ cc.Class({
initListener
()
{
const
btnSubmit
=
cc
.
find
(
'
Canvas/bg/btnSubmit
'
);
btnSubmit
.
on
(
'
click
'
,
()
=>
{
this
.
optionJump
(
btnSubmit
);
this
.
playEffect
(
'
submit
'
);
const
box
=
cc
.
find
(
'
Canvas/bg/box
'
);
if
(
box
.
children
.
every
(
child
=>
child
.
optionData
.
selected
==
child
.
optionData
.
is_right
))
{
this
.
onAnswerRight
();
}
else
{
this
.
onAnswerWrong
();
if
(
!
this
.
status
.
wrongOnce
)
{
this
.
status
.
wrongOnce
=
true
;
this
.
onAnswerWrong
();
}
else
{
this
.
onAnswerWrongTwice
();
}
}
});
const
btnNext
=
cc
.
find
(
'
Canvas/bg/btnNext
'
);
btnNext
.
on
(
'
click
'
,
()
=>
{
this
.
optionJump
(
btnNext
);
});
},
onAnswerRight
()
{
this
.
nextQuestion
();
},
onAnswerWrong
()
{
const
box
=
cc
.
find
(
'
Canvas/bg/box
'
);
box
.
children
.
filter
(
child
=>
child
.
optionData
.
selected
)
.
forEach
(
child
=>
{
child
.
optionData
.
selected
=
false
;
cc
.
tween
(
child
)
.
to
(
0.2
,
{
x
:
child
.
startPos
.
x
,
y
:
child
.
startPos
.
y
})
.
start
();
});
this
.
playEffect
(
'
flyBackAll
'
);
},
onAnswerWrongTwice
()
{
this
.
nextQuestion
();
this
.
playEffect
(
'
jumpAll
'
);
},
nextQuestion
()
{
const
box
=
cc
.
find
(
'
Canvas/bg/box
'
);
box
.
children
.
forEach
(
child
=>
{
cc
.
tween
(
child
)
.
to
(
0.1
,
{
scaleX
:
0
,
scaleY
:
0
})
.
removeSelf
()
.
start
();
});
this
.
status
.
currentQuestionIdx
++
;
this
.
status
.
wrongOnce
=
false
;
if
(
this
.
status
.
currentQuestionIdx
<
this
.
data
.
question_arr
.
length
)
{
setTimeout
(()
=>
{
this
.
jumpToQuestion
(
this
.
status
.
currentQuestionIdx
);
},
0.1
*
1000
);
}
else
{
this
.
submitBtnMoveOut
();
this
.
showNextBtn
();
}
},
boxJump
()
{
const
boxBehind
=
cc
.
find
(
'
Canvas/bg/box_behind
'
);
const
boxFront
=
cc
.
find
(
'
Canvas/bg/box_front
'
);
this
.
playEffect
(
'
boxJump
'
);
cc
.
tween
(
boxFront
)
.
to
(
0.1
,
{
scaleX
:
1.02
,
scaleY
:
1.02
})
.
to
(
0.1
,
{
scaleX
:
1.0
,
scaleY
:
1.0
})
.
start
();
cc
.
tween
(
boxBehind
)
.
to
(
0.1
,
{
scaleX
:
1.02
,
scaleY
:
1.02
})
.
to
(
0.1
,
{
scaleX
:
1.0
,
scaleY
:
1.0
})
.
start
();
},
coolCatSpeakStart
(
cb
)
{
cb
();
},
submitBtnMoveOut
()
{
const
submitBtn
=
cc
.
find
(
'
Canvas/bg/btnSubmit
'
);
cc
.
tween
(
submitBtn
)
.
by
(
1
,
{
y
:
-
submitBtn
.
height
})
.
start
();
},
showNextBtn
()
{
const
btnNext
=
cc
.
find
(
'
Canvas/bg/btnNext
'
);
btnNext
.
active
=
true
;
},
...
...
@@ -280,6 +392,15 @@ cc.Class({
});
},
playEffect
(
name
,
cb
)
{
const
audioNode
=
cc
.
find
(
`audios/
${
name
}
`
);
const
audioClip
=
audioNode
.
getComponent
(
cc
.
AudioSource
).
clip
;
const
audioId
=
cc
.
audioEngine
.
playEffect
(
audioClip
,
false
,
0.8
);
if
(
cb
)
{
cc
.
audioEngine
.
setFinishCallback
(
audioId
,
cb
);
}
},
playAudioByUrl
(
audio_url
,
cb
=
null
)
{
if
(
!
audio_url
)
{
if
(
cb
)
{
...
...
play/assets/op_09/script/defaultData.js
View file @
93afe146
export
const
defaultData
=
{
question_arr
:
[{
question_audio_url
:
''
,
option_arr
:
[{
//选项 (多选)
pic_url
:
'
http://staging-teach.cdn.ireadabc.com/994b3fce7a503cdb428fa0f735851d98.jpeg
'
,
// 图片路径
audio_url
:
''
,
//音频路径
is_right
:
true
,
//是否正确
},
{
pic_url
:
'
http://staging-teach.cdn.ireadabc.com/213871779bc2404f84bfa94672dd0e74.jpg
'
,
// 图片路径
audio_url
:
''
,
is_right
:
false
,
},
{
pic_url
:
'
http://staging-teach.cdn.ireadabc.com/213871779bc2404f84bfa94672dd0e74.jpg
'
,
// 图片路径
audio_url
:
''
,
is_right
:
false
,
},
{
pic_url
:
'
http://staging-teach.cdn.ireadabc.com/994b3fce7a503cdb428fa0f735851d98.jpeg
'
,
// 图片路径
audio_url
:
''
,
is_right
:
false
,
},
{
pic_url
:
'
http://staging-teach.cdn.ireadabc.com/994b3fce7a503cdb428fa0f735851d98.jpeg
'
,
// 图片路径
audio_url
:
''
,
is_right
:
false
,
}]
},
{
question_audio_url
:
''
,
option_arr
:
[{
//选项 (多选)
pic_url
:
''
,
// 图片路径
audio_url
:
''
,
//音频路径
is_right
:
true
,
//是否正确
},
{
pic_url
:
''
,
audio_url
:
''
,
is_right
:
false
,
"
question_arr
"
:
[{
"
question_audio_url
"
:
""
,
"
option_arr
"
:
[{
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/251667ae3d4921582392f6bc42bd2a96.png
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/3c070a33d021725219ab7eec9e60cb39.mp3
"
,
"
is_right
"
:
false
},
{
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/48ecba3519b1d58a1fa434ae694fc831.png
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/736c616e8b66a3ae03c8e8636ca46f0f.mp3
"
,
"
is_right
"
:
false
},
{
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/b1f05766a01d797c00839a5554c00050.png
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/2b5058e2cf41b152c44ef13cba898455.mp3
"
,
"
is_right
"
:
false
},
{
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/1d74d3c390aa740bc2c91537fcefed61.png
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/b4e6f8abf69975813c2a44d1b5d3d9e0.mp3
"
,
"
is_right
"
:
true
},
{
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/5aebe09b50932e725006a1a28741f3d4.png
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/90e185c3f3e3872044d6370c3ae11e3e.mp3
"
,
"
is_right
"
:
true
}],
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/d3e30a65afd6269dfc5cb2b17b21f872.mp3
"
},
{
"
question_audio_url
"
:
""
,
"
option_arr
"
:
[{
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/5ba43828aef85c585743a0c898b43c42.png
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/79a67cfeb1fee086076bc7f46e1524f1.mp3
"
,
"
is_right
"
:
true
},
{
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/f0bcd7fa36f501fd16e5ea3b74d0eb57.png
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/baae6b4c92d8a95e184d6d18542e0d21.mp3
"
,
"
is_right
"
:
true
},
{
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/c6bfc85fcd5fd0640e216ed3da2a3886.png
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/2b5058e2cf41b152c44ef13cba898455.mp3
"
,
"
is_right
"
:
false
},
{
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/d69dee492fd35b3c066207c3fc8e3258.png
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/b75df34ef55bd1c6e3a799f1dac87fec.mp3
"
,
"
is_right
"
:
false
},
{
"
pic_url
"
:
"
http://staging-teach.cdn.ireadabc.com/44464e706225cfe43e918bf1167a2ac1.png
"
,
"
audio_url
"
:
"
http://staging-teach.cdn.ireadabc.com/89060c9eddd5f0f67908cce77ee74f94.mp3
"
,
"
is_right
"
:
false
}]
}]
}
\ No newline at end of file
play/assets/op_09/textures/btn_next.png.meta
View file @
93afe146
...
...
@@ -4,7 +4,7 @@
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha":
fals
e,
"premultiplyAlpha":
tru
e,
"genMipmaps": false,
"packable": true,
"width": 209,
...
...
play/assets/op_09/textures/btn_submit.png.meta
View file @
93afe146
...
...
@@ -4,7 +4,7 @@
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha":
fals
e,
"premultiplyAlpha":
tru
e,
"genMipmaps": false,
"packable": true,
"width": 244,
...
...
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