Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PU21
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
PU21
Commits
83de2984
Commit
83de2984
authored
May 13, 2021
by
jeff
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
d39ff12f
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
715 additions
and
285 deletions
+715
-285
angular.json
form/angular.json
+5
-2
custom-action.component.html
...src/app/common/custom-action/custom-action.component.html
+6
-5
custom-action.component.ts
form/src/app/common/custom-action/custom-action.component.ts
+3
-1
BRLNSDB.TTF
form/src/app/common/custom-hot-zone-mini/BRLNSDB.TTF
+0
-0
custom-hot-zone-mini.component.html
.../custom-hot-zone-mini/custom-hot-zone-mini.component.html
+2
-2
custom-hot-zone-mini.component.scss
.../custom-hot-zone-mini/custom-hot-zone-mini.component.scss
+4
-0
custom-hot-zone-mini.component.ts
...on/custom-hot-zone-mini/custom-hot-zone-mini.component.ts
+44
-46
form.component.html
form/src/app/form/form.component.html
+1
-1
form.component.ts
form/src/app/form/form.component.ts
+14
-9
hitItem.prefab
play/assets/scene/prefab/hitItem.prefab
+6
-33
picItem.prefab
play/assets/scene/prefab/picItem.prefab
+132
-0
picItem.prefab.meta
play/assets/scene/prefab/picItem.prefab.meta
+8
-0
wordsItem.prefab
play/assets/scene/prefab/wordsItem.prefab
+16
-46
hitItem.js
play/assets/scene/scene/hitItem.js
+19
-36
picItem.js
play/assets/scene/scene/picItem.js
+19
-0
picItem.js.meta
play/assets/scene/scene/picItem.js.meta
+9
-0
picNode.js
play/assets/scene/scene/picNode.js
+9
-3
scene.fire
play/assets/scene/scene/scene.fire
+383
-82
scene.js
play/assets/scene/scene/scene.js
+14
-4
wordsItem.js
play/assets/scene/scene/wordsItem.js
+20
-14
btn_laba.png.meta
play/assets/scene/textures/btn_laba.png.meta
+1
-1
No files found.
form/angular.json
View file @
83de2984
...
...
@@ -128,5 +128,8 @@
}
}
},
"defaultProject"
:
"ng-template-generator"
}
"defaultProject"
:
"ng-template-generator"
,
"cli"
:
{
"analytics"
:
"06333645-37f7-4fd6-9eb2-94a40b76c96a"
}
}
\ No newline at end of file
form/src/app/common/custom-action/custom-action.component.html
View file @
83de2984
...
...
@@ -91,13 +91,14 @@
</div>
</div>
<div
*
ngIf=
'audio'
>
<nz-divider
style=
"margin-top: 10px;"
></nz-divider>
<h4>
音频设置
</h4>
<h4>
音频设置
</h4>
<app-audio-recorder
style=
"margin: auto"
[
audioUrl
]="
item
?.
audio_url
"
(
audioUploaded
)="
onItemAudioUploadSuccess
($
event
,
item
)"
></app-audio-recorder>
<app-audio-recorder
style=
"margin: auto"
[
audioUrl
]="
item
?.
audio_url
"
(
audioUploaded
)="
onItemAudioUploadSuccess
($
event
,
item
)"
></app-audio-recorder>
</div>
</div>
...
...
form/src/app/common/custom-action/custom-action.component.ts
View file @
83de2984
...
...
@@ -21,7 +21,9 @@ export class CustomActionComponent implements OnDestroy, OnChanges {
@
Input
()
type
=
'
text
'
@
Input
()
audio
=
true
@
Output
()
save
=
new
EventEmitter
();
...
...
form/src/app/common/custom-hot-zone-mini/BRLNSDB.TTF
0 → 100644
View file @
83de2984
File added
form/src/app/common/custom-hot-zone-mini/custom-hot-zone-mini.component.html
View file @
83de2984
...
...
@@ -19,7 +19,7 @@
<div>
<h5>
题干音频
</h5>
<div
style=
"display: flex;align-items: center; margin-top: 5px"
>
<app-audio-recorder
style=
"margin: auto"
[
audioUrl
]="
bgAudioUrl
"
<app-audio-recorder
style=
"margin: auto"
[
audioUrl
]="
bg
Item
?.
bg
AudioUrl
"
(
audioUploaded
)="
onBgAudioUploadSuucess
($
event
)"
></app-audio-recorder>
</div>
</div>
...
...
@@ -96,7 +96,7 @@
<div
*
ngIf=
"customTypeGroupArr[it.gIdx]?.action"
style=
"display: flex;align-items: center; margin-top: 5px"
>
<app-custom-action
style=
"margin: auto"
[
item
]="
it
?
it
['
actionData_
'
+
it
.
gIdx
]
:
{}"
[
type
]="
customTypeGroupArr
[
it
.
gIdx
].
action
.
type
"
[
option
]="
customTypeGroupArr
[
it
.
gIdx
].
action
.
option
"
(
save
)="
onSaveCustomAction
($
event
,
it
)"
>
(
save
)="
onSaveCustomAction
($
event
,
it
)"
[
audio
]
='
customTypeGroupArr
[
it
.
gIdx
].
action
.
audio
'
>
>
</app-custom-action>
</div>
...
...
form/src/app/common/custom-hot-zone-mini/custom-hot-zone-mini.component.scss
View file @
83de2984
@font-face
{
font-family
:
'font'
;
src
:
url('BRLNSDB.TTF')
;
}
.p-image-children-editor
{
width
:
100%
;
...
...
form/src/app/common/custom-hot-zone-mini/custom-hot-zone-mini.component.ts
View file @
83de2984
...
...
@@ -153,7 +153,7 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
this
.
initListener
();
this
.
init
();
//
this.init();
this
.
update
();
this
.
refresh
();
...
...
@@ -233,20 +233,6 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
}
addBtnClick
()
{
// this.imgArr.push({});
// this.hotZoneArr.push({});
const
item
=
this
.
getHotZoneItem
();
this
.
hotZoneArr
.
push
(
item
);
this
.
refreshItem
(
item
);
this
.
refreshHotZoneId
();
console
.
log
(
item
)
}
deleteBtnClick
(
index
)
{
const
item
=
this
.
hotZoneArr
.
splice
(
index
,
1
)[
0
];
...
...
@@ -364,7 +350,7 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
if
(
saveData
)
{
let
picUrl
=
saveData
.
pic_url
;
const
actionData
=
saveData
[
'
actionData_
'
+
item
.
gIdx
];
const
actionData
=
saveData
[
'
actionData_
'
];
if
(
actionData
&&
actionData
.
type
==
'
pic
'
)
{
picUrl
=
actionData
.
pic_url
;
}
...
...
@@ -428,7 +414,7 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
textLabel
.
text
=
saveData
.
text
}
this
.
setActionFont
(
textLabel
,
saveData
[
'
actionData_
'
+
item
.
gIdx
]);
this
.
setActionFont
(
textLabel
,
saveData
[
'
actionData_
'
]);
textLabel
.
refreshSize
();
}
...
...
@@ -515,6 +501,19 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
this
.
refresh
();
}
addBtnClick
()
{
// this.imgArr.push({});
// this.hotZoneArr.push({});
const
item
=
this
.
getHotZoneItem
();
this
.
hotZoneArr
.
push
(
item
);
this
.
refreshCustomItem
(
item
)
this
.
refreshHotZoneId
();
}
deleteItem
(
e
,
i
)
{
// this.imgArr.splice(i , 1);
// this.refreshImageId();
...
...
@@ -524,30 +523,6 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
this
.
refresh
();
}
// radioChange(e, item) {
// item.itemType = e;
// this.refreshItem(item);
// this.refresh();
// // console.log(' in radioChange e: ', e);
// }
customRadioChange
(
e
,
item
)
{
console
.
log
(
'
in customRadioChange
'
,
e
);
item
.
gIdx
=
-
1
;
setTimeout
(()
=>
{
item
.
gIdx
=
e
;
this
.
refreshCustomItem
(
item
);
this
.
refresh
();
},
1
);
// const curGroup = this.customTypeGroupArr[e];
}
refreshCustomItem
(
item
)
{
this
.
hideHotZoneItem
(
item
);
const
group
=
this
.
customTypeGroupArr
[
item
.
gIdx
];
...
...
@@ -585,6 +560,30 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
}
// radioChange(e, item) {
// item.itemType = e;
// this.refreshItem(item);
// this.refresh();
// // console.log(' in radioChange e: ', e);
// }
customRadioChange
(
e
,
item
)
{
console
.
log
(
'
in customRadioChange
'
,
e
);
item
.
gIdx
=
-
1
;
setTimeout
(()
=>
{
item
.
gIdx
=
e
;
this
.
refreshCustomItem
(
item
);
this
.
refresh
();
},
1
);
// const curGroup = this.customTypeGroupArr[e];
}
setItemIsAnimaStyle
(
item
,
isAnimal
)
{
}
...
...
@@ -598,7 +597,7 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
showItemLabel
(
item
)
{
item
.
textLabel
.
visible
=
true
;
item
.
itemType
=
'
text
'
;
this
.
showArrowTop
(
item
,
true
)
this
.
showArrowTop
(
item
)
}
showItemRect
(
item
,
isShowArrowTop
=
true
)
{
...
...
@@ -1140,7 +1139,7 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
useBorder
:
hotZoneArr
[
i
].
useBorder
};
hotZoneItem
[
'
actionData_
'
+
hotZoneItem
.
gIdx
]
=
hotZoneArr
[
i
][
'
actionData_
'
+
hotZoneArr
[
i
].
gIdx
]
hotZoneItem
[
'
actionData_
'
]
=
hotZoneArr
[
i
][
'
actionData_
'
]
if
(
this
.
hotZoneFontObj
)
{
...
...
@@ -1173,8 +1172,7 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
console
.
log
(
'
hotZoneItemArr:
'
,
hotZoneItemArr
);
// return { bgItem, hotZoneItemArr };
return
{
hotZoneItemArr
,
bgAudioUrl
:
this
.
bgAudioUrl
};
return
{
bgItem
,
hotZoneItemArr
};
}
saveText
(
item
)
{
...
...
@@ -1186,7 +1184,7 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
onSaveCustomAction
(
e
,
item
)
{
const
data
=
e
;
item
[
'
actionData_
'
+
item
.
gIdx
]
=
data
;
item
[
'
actionData_
'
]
=
data
;
if
(
data
.
type
==
'
pic
'
)
{
let
picUrl
=
data
.
pic_url
;
...
...
form/src/app/form/form.component.html
View file @
83de2984
...
...
@@ -19,7 +19,7 @@
-->
<div
*
ngFor=
'let data of item ;index as i'
>
<span>
卡片{{i+1}}
</span>
<app-custom-hot-zone-mini
[
bg
AudioUrl
]="
data
.
bgAudioUrl
"
[
hotZoneItemArr
]="
data
.
hotZoneItemArr
"
<app-custom-hot-zone-mini
[
bg
Item
]="
data
.
bgItem
"
[
hotZoneItemArr
]="
data
.
hotZoneItemArr
"
[
customTypeGroupArr
]="
customTypeGroupArr
"
(
save
)="
saveHotZone
(
data
,
$
event
)"
(
del
)="
delHotZone
(
i
)"
>
</app-custom-hot-zone-mini>
</div>
...
...
form/src/app/form/form.component.ts
View file @
83de2984
...
...
@@ -19,23 +19,28 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
name
:
'
句子音频
'
,
action
:
{
type
:
'
text
'
,
audio
:
true
,
option
:
[
[
'
c
olor
'
,
'
#000000
'
],
[
'
s
ize
'
,
'
100
'
]
[
'
fontC
olor
'
,
'
#000000
'
],
[
'
fontS
ize
'
,
'
100
'
]
]
}
},
{
name
:
'
发音
区域
'
,
name
:
'
点击
区域
'
,
action
:
{
type
:
'
text
'
,
aduio
:
false
,
option
:
[
[
'
c
olor
'
,
'
#000000
'
],
[
'
s
ize
'
,
'
100
'
]
[
'
fontC
olor
'
,
'
#000000
'
],
[
'
fontS
ize
'
,
'
100
'
]
]
}
}
,
},
{
name
:
'
图片
'
,
pic
:
true
}
]
constructor
(
private
appRef
:
ApplicationRef
,
private
changeDetectorRef
:
ChangeDetectorRef
)
{
...
...
@@ -90,9 +95,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
/** 保存按钮 */
saveHotZone
(
group
,
e
)
{
console
.
log
(
'
e:
'
,
e
);
const
{
hotZoneItemArr
,
bgAudioUrl
}
=
e
;
const
{
hotZoneItemArr
,
bgItem
}
=
e
;
group
.
bg
AudioUrl
=
bgAudioUrl
;
group
.
bg
Item
=
bgItem
;
group
.
hotZoneItemArr
=
hotZoneItemArr
;
this
.
save
();
...
...
play/assets/scene/prefab/hitItem.prefab
View file @
83de2984
...
...
@@ -24,11 +24,11 @@
"_active": true,
"_components": [
{
"__id__":
6
"__id__":
5
}
],
"_prefab": {
"__id__":
7
"__id__":
6
},
"_opacity": 255,
"_color": {
...
...
@@ -89,13 +89,10 @@
"_components": [
{
"__id__": 3
},
{
"__id__": 4
}
],
"_prefab": {
"__id__":
5
"__id__":
4
},
"_opacity": 255,
"_color": {
...
...
@@ -179,33 +176,6 @@
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 18,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
...
...
@@ -228,6 +198,9 @@
"label": {
"__id__": 3
},
"tipClip": {
"__uuid__": "e0bcf4cc-35a7-4d61-b202-8dd49299c2c0"
},
"_id": ""
},
{
...
...
play/assets/scene/prefab/picItem.prefab
0 → 100644
View file @
83de2984
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "node",
"_objFlags": 0,
"_parent": null,
"_children": [],
"_active": true,
"_components": [
{
"__id__": 2
},
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 36
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 1
},
"_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": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "577b3ZhuUNJtLzUNX3CEf1G",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "85e73971-9396-4c2a-9fac-2b187fd99c48"
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
play/assets/scene/prefab/picItem.prefab.meta
0 → 100644
View file @
83de2984
{
"ver": "1.2.9",
"uuid": "85e73971-9396-4c2a-9fac-2b187fd99c48",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/scene/prefab/wordsItem.prefab
View file @
83de2984
...
...
@@ -21,17 +21,17 @@
"__id__": 2
},
{
"__id__":
6
"__id__":
5
}
],
"_active": true,
"_components": [
{
"__id__": 1
2
"__id__": 1
1
}
],
"_prefab": {
"__id__": 1
3
"__id__": 1
2
},
"_opacity": 255,
"_color": {
...
...
@@ -43,7 +43,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 64.
47
,
"width": 64.
51
,
"height": 55
},
"_anchorPoint": {
...
...
@@ -92,13 +92,10 @@
"_components": [
{
"__id__": 3
},
{
"__id__": 4
}
],
"_prefab": {
"__id__":
5
"__id__":
4
},
"_opacity": 255,
"_color": {
...
...
@@ -182,33 +179,6 @@
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 18,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
...
...
@@ -231,17 +201,17 @@
"_active": true,
"_components": [
{
"__id__":
7
"__id__":
6
},
{
"__id__":
8
"__id__":
7
},
{
"__id__":
9
"__id__":
8
}
],
"_prefab": {
"__id__": 1
1
"__id__": 1
0
},
"_opacity": 255,
"_color": {
...
...
@@ -265,8 +235,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
7
1.65
9,
-3.
917
,
7
8.80
9,
-3.
5
,
0,
0,
0,
...
...
@@ -295,7 +265,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
6
"__id__":
5
},
"_enabled": true,
"_materials": [
...
...
@@ -327,7 +297,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
6
"__id__":
5
},
"_enabled": true,
"_defaultClip": {
...
...
@@ -349,7 +319,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__":
6
"__id__":
5
},
"_enabled": true,
"_normalMaterial": null,
...
...
@@ -358,7 +328,7 @@
"zoomScale": 1.1,
"clickEvents": [
{
"__id__":
10
"__id__":
9
}
],
"_N$interactable": true,
...
...
@@ -449,7 +419,7 @@
"__id__": 3
},
"playAnim": {
"__id__":
8
"__id__":
7
},
"_id": ""
},
...
...
play/assets/scene/scene/hitItem.js
View file @
83de2984
...
...
@@ -5,64 +5,47 @@ cc.Class({
extends
:
cc
.
Component
,
properties
:
{
label
:
cc
.
Label
label
:
cc
.
Label
,
tipClip
:
cc
.
AudioClip
},
data
:
null
,
onLoad
()
{
},
onEnable
()
{
this
.
node
.
on
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onTouchStart
,
this
)
cc
.
systemEvent
.
on
(
'
changeAnswerState
'
,
this
.
onChangeState
,
this
)
},
onDisable
()
{
this
.
node
.
off
(
cc
.
Node
.
EventType
.
TOUCH_START
,
this
.
onTouchStart
,
this
)
cc
.
systemEvent
.
off
(
'
changeAnswerState
'
,
this
.
onChangeState
,
this
)
},
initWithData
(
data
)
{
initWithData
(
data
,
scale
)
{
this
.
data
=
data
let
rect
=
this
.
data
.
rect
this
.
node
.
x
=
rect
.
x
+
rect
.
width
/
2
this
.
node
.
y
=
-
rect
.
y
-
rect
.
height
/
2
this
.
node
.
x
=
rect
.
x
*
scale
this
.
node
.
y
=
-
rect
.
y
*
scale
this
.
node
.
width
=
rect
.
width
this
.
node
.
height
=
rect
.
height
this
.
label
=
data
.
text
this
.
audioId
=
null
this
.
node
.
scale
=
data
.
fontScale
?
data
.
fontScale
*
scale
:
scale
let
action
=
data
[
'
actionData_
'
]
this
.
label
.
string
=
action
.
text
?
action
.
text
:
''
this
.
label
.
node
.
active
=
false
let
option
=
action
.
changeOption
this
.
label
.
node
.
color
=
option
[
0
][
1
]
?
cc
.
color
(
option
[
0
][
1
])
:
cc
.
color
(
0
,
0
,
0
)
},
onTouchStart
()
{
if
(
this
.
audioId
)
return
if
(
this
.
data
)
{
let
url
=
this
.
data
.
audio_url
if
(
url
&&
url
!=
''
)
{
this
.
playAudio
(
url
)
this
.
tipsAnim
.
node
.
active
=
true
this
.
tipsAnim
.
play
()
}
cc
.
audioEngine
.
play
(
this
.
tipClip
)
}
},
/** 播放音乐 */
playAudio
(
url
)
{
cc
.
assetManager
.
loadRemote
(
url
,
(
err
,
audioClip
)
=>
{
if
(
err
)
return
cc
.
systemEvent
.
once
(
'
stopMusic
'
,
this
.
stopAudio
,
this
)
this
.
audioId
=
cc
.
audioEngine
.
play
(
audioClip
,
false
,
0.8
);
cc
.
audioEngine
.
setFinishCallback
(
this
.
audioId
,
this
.
stopAudio
.
bind
(
this
));
});
this
.
label
.
node
.
active
=
true
cc
.
audioEngine
.
play
(
this
.
tipClip
)
},
stopAudio
()
{
if
(
this
.
audioId
!=
null
)
{
cc
.
audioEngine
.
stop
(
this
.
audioId
)
this
.
audioId
=
null
cc
.
systemEvent
.
off
(
'
stopMusic
'
,
this
.
stopAudio
,
this
)
}
},
/** 音频id */
audioId
:
null
,
/** 改变答案显示状态 */
onChangeState
(
show
)
{
this
.
label
.
node
.
active
=
show
}
});
play/assets/scene/scene/picItem.js
0 → 100644
View file @
83de2984
const
tools
=
require
(
"
../script/tools
"
);
cc
.
Class
({
extends
:
cc
.
Component
,
properties
:
{
},
initWithData
(
data
,
scale
)
{
let
sprite
=
this
.
getComponent
(
cc
.
Sprite
)
tools
.
getSpriteFrimeByUrl
(
data
.
pic_url
,(
sp
)
=>
{
sprite
.
spriteFrame
=
sp
let
rect
=
data
.
rect
this
.
node
.
setPosition
(
rect
.
x
*
scale
,
-
rect
.
y
*
scale
)
this
.
node
.
width
=
rect
.
width
*
scale
this
.
node
.
height
=
rect
.
height
*
scale
})
}
});
play/assets/scene/scene/picItem.js.meta
0 → 100644
View file @
83de2984
{
"ver": "1.0.8",
"uuid": "577b3661-b943-49b4-bcd4-357dc211fd46",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/scene/scene/picNode.js
View file @
83de2984
...
...
@@ -5,7 +5,8 @@ cc.Class({
properties
:
{
hitPre
:
cc
.
Prefab
,
wordsPre
:
cc
.
Prefab
wordsPre
:
cc
.
Prefab
,
picPre
:
cc
.
Prefab
},
onLoad
()
{
...
...
@@ -54,17 +55,22 @@ cc.Class({
// this._hitItem.push(node)
// }
// })
let
rect
=
data
.
bgItem
.
rect
let
scale
=
1280
/
rect
.
width
let
node
for
(
let
one
of
data
.
hotZoneItemArr
)
{
if
(
one
.
gIdx
==
'
0
'
)
{
// 发音句子
node
=
cc
.
instantiate
(
this
.
wordsPre
)
comp
=
node
.
getComponent
(
'
wordsItem
'
)
}
else
{
}
else
if
(
one
.
gIdx
==
'
1
'
)
{
node
=
cc
.
instantiate
(
this
.
hitPre
)
comp
=
node
.
getComponent
(
'
hitItem
'
)
}
else
{
node
=
cc
.
instantiate
(
this
.
picPre
)
comp
=
node
.
getComponent
(
'
picItem
'
)
}
this
.
_items
.
addChild
(
node
)
comp
.
initWithData
(
one
)
comp
.
initWithData
(
one
,
scale
)
this
.
_hitItem
.
push
(
node
)
}
},
...
...
play/assets/scene/scene/scene.fire
View file @
83de2984
This diff is collapsed.
Click to expand it.
play/assets/scene/scene/scene.js
View file @
83de2984
...
...
@@ -20,6 +20,7 @@ cc.Class({
type
:
cc
.
Node
,
default
:
null
},
bgAudioNode
:
cc
.
Node
,
btnClip
:
cc
.
AudioClip
},
...
...
@@ -87,11 +88,11 @@ cc.Class({
},
onEnable
()
{
cc
.
systemEvent
.
on
(
'
playAudio
'
,
this
.
onPlayAudio
,
this
)
},
onDisable
()
{
cc
.
systemEvent
.
off
(
'
playAudio
'
,
this
.
onPlayAudio
,
this
)
},
...
...
@@ -100,7 +101,7 @@ cc.Class({
},
getDefaultData
()
{
const
dataJson
=
'
[{"hotZoneItemArr":[{"id":"1620866294132","index":0,"itemType":"text","fontScale":0.29296875,"imgScale":1,"mapScale":0.29296875,"gIdx":"0","rect":{"width":58.1,"height":11.72,"x":300.54,"y":305.15}},{"id":"1620866973543","index":1,"itemType":"text","fontScale":0.29296875,"imgScale":1,"mapScale":0.29296875,"gIdx":"1","rect":{"width":46.84,"height":11.72,"x":387.59,"y":236.14}}],"bgAudioUrl":"http://staging-teach.cdn.ireadabc.com/c8a7dd49a778b0b6dd509aac0ef437ff.mp3"
}]
'
const
dataJson
=
'
[{"hotZoneItemArr":[{"id":"1620886548676","index":0,"pic_url":"http://staging-teach.cdn.ireadabc.com/aa0d852ef05d9d8de158f10b4a727376.jpg","itemType":"text","fontScale":0.7859375,"imgScale":0.5236111111111111,"mapScale":0.7859375,"gIdx":"0","actionData_":{"type":"text","changeOption":[["fontColor","#000000"],["fontSize","100"]],"text":"I WANT Fly","audio_url":"http://staging-teach.cdn.ireadabc.com/bd0502e664d0d279ccbec4e22b60f051.mp3"},"rect":{"width":438.31,"height":78.59,"x":115.96,"y":149.2}}],"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/b90a006ba41723ec11970051e92f43e0.png","rect":{"x":167.89,"y":0,"width":670.22,"height":377}}
}]
'
const
data
=
JSON
.
parse
(
dataJson
);
return
data
;
},
...
...
@@ -270,8 +271,17 @@ cc.Class({
console
.
log
(
'
数据错误
'
)
return
}
if
(
data
.
bgAudioUrl
&&
data
.
bgAudioUrl
!=
''
)
{
this
.
bgAudioNode
.
active
=
true
}
else
{
this
.
bgAudioNode
.
active
=
false
}
picNode
.
getComponent
(
'
picNode
'
).
initWithData
(
data
)
}
},
/** 点击切换答案显示 */
onCheckall
()
{
}
// ------------------------------------------
});
play/assets/scene/scene/wordsItem.js
View file @
83de2984
...
...
@@ -10,6 +10,8 @@ cc.Class({
data
:
null
,
audio_url
:
null
,
onEnable
()
{
},
...
...
@@ -17,18 +19,25 @@ cc.Class({
},
initWithData
(
data
)
{
initWithData
(
data
,
scale
)
{
this
.
data
=
data
let
rect
=
this
.
data
.
rect
console
.
log
(
rect
)
this
.
node
.
x
=
rect
.
x
+
rect
.
width
/
2
this
.
node
.
y
=
-
rect
.
y
-
rect
.
height
/
2
this
.
node
.
width
=
rect
.
width
this
.
node
.
height
=
rect
.
height
this
.
node
.
scale
=
data
.
fontScale
?
data
.
fontScale
:
1
this
.
label
.
string
=
data
.
text
?
data
.
text
:
''
this
.
node
.
x
=
(
rect
.
x
+
rect
.
width
/
2
)
*
scale
this
.
node
.
y
=
(
-
rect
.
y
-
rect
.
height
/
2
)
*
scale
let
action
=
data
[
'
actionData_
'
]
let
node
=
this
.
label
.
node
let
option
=
action
.
changeOption
node
.
color
=
option
[
0
][
1
]
?
cc
.
color
(
option
[
0
][
1
])
:
cc
.
color
(
0
,
0
,
0
)
node
.
scale
=
data
.
fontScale
?
data
.
fontScale
*
scale
:
scale
this
.
label
.
string
=
action
.
text
?
action
.
text
:
''
this
.
node
.
width
=
node
.
width
*
node
.
scale
this
.
node
.
height
=
node
.
height
*
node
.
height
this
.
audioId
=
null
if
(
data
.
audio_url
)
{
this
.
audio_url
=
action
.
audio_url
if
(
this
.
audio_url
)
{
let
node
=
this
.
playAnim
.
node
node
.
scale
=
1
/
this
.
node
.
scale
node
.
setPosition
(
this
.
label
.
node
.
width
+
node
.
width
/
2
+
15
,
-
this
.
node
.
height
/
2
)
this
.
playAnim
.
node
.
active
=
true
}
else
{
this
.
playAnim
.
node
.
active
=
false
...
...
@@ -37,11 +46,8 @@ cc.Class({
onTouchStart
()
{
if
(
this
.
audioId
)
return
if
(
this
.
data
)
{
let
url
=
this
.
data
.
audio_url
if
(
url
&&
url
!=
''
)
{
this
.
playAudio
(
url
)
}
if
(
this
.
audio_url
&&
this
.
audio_url
!=
''
)
{
this
.
playAudio
(
this
.
audio_url
)
this
.
playAnim
.
play
(
'
play
'
)
}
},
...
...
play/assets/scene/textures/btn_laba.png.meta
View file @
83de2984
...
...
@@ -27,7 +27,7 @@
"rawWidth": 55,
"rawHeight": 59,
"borderTop": 0,
"borderBottom":
0
,
"borderBottom":
2
,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
...
...
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