Commit c94e1ecb authored by Guo Yuhang's avatar Guo Yuhang

fix:走查问题解决

Signed-off-by: Guo Yuhang's avatar郭宇航 <guoyuhang@iplayabc.com>
parent 0c3b98ea
<div class="model-content">
<div *ngFor="let it of picArr; let i = index" class="card-item" style="padding: 0.5vw;">
<div class="border">
......@@ -6,15 +5,12 @@
<div style="display: flex; align-items: center; width: 100%;">
<!-- 左边部分 -->
<div class="item-box" style="width: 100%">
<input style="width: 80%; margin-bottom: 0.5vw" type="text" nz-input placeholder="" [(ngModel)]="it.left.title" (blur)="saveItem()">
<app-upload-image-with-preview
style="width: 100%"
[picUrl]="it.left.pic_url"
(imageUploaded)="onImageUploadSuccessByItem($event, it.left)"
></app-upload-image-with-preview>
<input style="width: 80%; margin-bottom: 0.5vw" type="text" nz-input placeholder=""
[(ngModel)]="it.left.title" (blur)="saveItem()">
<app-upload-image-with-preview style="width: 100%" [picUrl]="it.left.pic_url"
(imageUploaded)="onImageUploadSuccessByItem($event, it.left)"></app-upload-image-with-preview>
<div style="display: flex; justify-items: center; padding-top: 10px">
<app-audio-recorder
[audioUrl]="it.left.audio_url"
<app-audio-recorder [audioUrl]="it.left.audio_url"
(audioUploaded)="onAudioUploadSuccessByItem($event, it.left)">
</app-audio-recorder>
</div>
......@@ -91,7 +87,7 @@
</div>
<div nz-col nzSpan="8" class="add-btn-box" >
<div nz-col nzSpan="8" class="add-btn-box">
<!--<div style="width: 100%; height: 100%;">-->
<button style=" margin: auto; width: 60%; height: 60%;" nz-button nzType="dashed" class="add-btn"
......@@ -102,27 +98,15 @@
<!--</div>-->
</div>
<!--<div style="padding-bottom: 30px;">-->
<!--<h5> title-sound: </h5>-->
<!--<app-audio-recorder-->
<!--[audioUrl]="item.contentObj.title_audio_url"-->
<!--(audioUploaded)="onAudioUploadSuccessByItem($event, item.contentObj, 'title')">-->
<!--</app-audio-recorder>-->
<!--</div>-->
<div style="padding-bottom: 20px;">
<input style="width: 80%; margin-bottom: 0.5vw" type="text" nz-input placeholder=""
[(ngModel)]="item.contentObj.title" (blur)="saveItem()">
<h5> title-sound: </h5>
<app-audio-recorder [audioUrl]="item.contentObj.audio_url"
(audioUploaded)="onAudioUploadSuccessByItem($event, item.contentObj)">
</app-audio-recorder>
</div>
<!--<div style="padding-bottom: 30px;">-->
......
......@@ -68,15 +68,12 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
init() {
if (this.item.contentObj.picArr) {
this.picArr = this.item.contentObj.picArr;
} else {
this.picArr = this.getDefaultPicArr();
this.item.contentObj.picArr = this.picArr;
}
console.log('item:', this.item);
// this.picArr = this.getDefaultPicArr();
// this.item.contentObj.picArr = this.picArr;
......@@ -131,6 +128,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
onAudioUploadSuccessByItem(e, item) {
console.log('+++++++++++++++');
item.audio_url = e.url;
this.save();
}
......
......@@ -17,7 +17,7 @@
"__id__": 2
},
{
"__id__": 34
"__id__": 47
}
],
"_active": true,
......@@ -78,22 +78,22 @@
"__id__": 5
},
{
"__id__": 18
"__id__": 27
},
{
"__id__": 20
"__id__": 39
}
],
"_active": true,
"_components": [
{
"__id__": 31
"__id__": 44
},
{
"__id__": 32
"__id__": 45
},
{
"__id__": 33
"__id__": 46
}
],
"_prefab": null,
......@@ -107,8 +107,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 960,
"height": 640
"width": 1280,
"height": 720
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -119,8 +119,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
480,
320,
640,
360,
0,
0,
0,
......@@ -183,7 +183,7 @@
"array": [
0,
0,
558.5741785706517,
538.6557773190736,
0,
0,
0,
......@@ -257,13 +257,19 @@
"__id__": 9
},
{
"__id__": 12
"__id__": 13
},
{
"__id__": 17
}
],
"_active": true,
"_components": [
{
"__id__": 17
"__id__": 25
},
{
"__id__": 26
}
],
"_prefab": null,
......@@ -277,7 +283,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"width": 1600,
"height": 720
},
"_anchorPoint": {
......@@ -342,7 +348,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"width": 1600,
"height": 720
},
"_anchorPoint": {
......@@ -398,7 +404,7 @@
"__uuid__": "d0f94cc8-9d38-49a6-bc58-3002a98bb350"
},
"_type": 0,
"_sizeMode": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
......@@ -453,6 +459,9 @@
},
{
"__id__": 11
},
{
"__id__": 12
}
],
"_prefab": null,
......@@ -466,7 +475,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"width": 1600,
"height": 720
},
"_anchorPoint": {
......@@ -522,15 +531,15 @@
"__uuid__": "2ff4e31e-6762-4b12-a8ef-4474ea6cd186"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_sizeMode": 0,
"_fillType": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_fillRange": 1,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "bdJEbpgwpMf5RWTCG/VNIb"
......@@ -545,7 +554,7 @@
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_alignFlags": 44,
"_left": 0,
"_right": 0,
"_top": 0,
......@@ -562,23 +571,40 @@
"_originalHeight": 720,
"_id": "00Q0bB7r9H1IekB50U2MXk"
},
{
"__type__": "b2354GTZopG4oaGZ40/baPN",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
},
"_enabled": true,
"image": null,
"displayMode": 3,
"offsetX": 0,
"offsetY": 0,
"_id": "1b0/vYJ7JLJ7NMQKquFJ5w"
},
{
"__type__": "cc.Node",
"_name": "sign",
"_name": "bg3",
"_objFlags": 0,
"_parent": {
"__id__": 5
},
"_children": [
"_children": [],
"_active": true,
"_components": [
{
"__id__": 13
"__id__": 14
},
{
"__id__": 15
},
{
"__id__": 16
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
......@@ -590,8 +616,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
"width": 1600,
"height": 102
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -602,8 +628,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-297.065,
252.342,
0,
-309,
0,
0,
0,
......@@ -625,20 +651,103 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "9eJd3vP4tOdI/OXebp9Ad6"
"_id": "13WuETWOlFqItcTdeN/NdA"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 13
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "bedb3f82-62e2-45b7-9270-dea073a4d32d"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 1,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "db7ixAO8NHk5MhdQ+DX39l"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 13
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 44,
"_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": 1280,
"_originalHeight": 0,
"_id": "5eUOkO1npJu7WLtPWEC1/K"
},
{
"__type__": "b2354GTZopG4oaGZ40/baPN",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 13
},
"_enabled": true,
"image": null,
"displayMode": 3,
"offsetX": 0,
"offsetY": 0,
"_id": "2cK5snoXhBdYh0bR2hwLAS"
},
{
"__type__": "cc.Node",
"_name": "bg1",
"_name": "sign",
"_objFlags": 0,
"_parent": {
"__id__": 12
"__id__": 5
},
"_children": [],
"_children": [
{
"__id__": 18
},
{
"__id__": 20
}
],
"_active": true,
"_components": [
{
"__id__": 14
"__id__": 23
},
{
"__id__": 24
}
],
"_prefab": null,
......@@ -652,8 +761,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 500,
"height": 107
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -664,8 +773,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
2.65,
2.12,
-500,
290,
0,
0,
0,
......@@ -687,52 +796,20 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "886pkqfppGIp6KR3/b5PN1"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 13
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "7e6c30c3-f574-481f-82ae-b37ca91599eb"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "3aY/HDdNZGjqSdQzpXCWtT"
"_id": "9eJd3vP4tOdI/OXebp9Ad6"
},
{
"__type__": "cc.Node",
"_name": "bg2",
"_name": "bg1",
"_objFlags": 0,
"_parent": {
"__id__": 12
"__id__": 17
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 16
"__id__": 19
}
],
"_prefab": null,
......@@ -746,8 +823,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 241,
"height": 41
"width": 500,
"height": 107
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -758,8 +835,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
13.248,
14.838,
2.65,
2.12,
0,
0,
0,
......@@ -781,14 +858,14 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "7aacIqPfpE4ItuujnC2ZCJ"
"_id": "886pkqfppGIp6KR3/b5PN1"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 15
"__id__": 18
},
"_enabled": true,
"_materials": [
......@@ -799,38 +876,8 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "c59bb4c1-4f47-466c-b644-2eab0ded6f31"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "c2Hhvl49dMt5789A3XejK7"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
"__uuid__": "7e6c30c3-f574-481f-82ae-b37ca91599eb"
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
......@@ -843,35 +890,38 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "edrCtPEtJJt5ALnW+UzX2N"
"_id": "3aY/HDdNZGjqSdQzpXCWtT"
},
{
"__type__": "cc.Node",
"_name": "layout",
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 2
"__id__": 17
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 19
"__id__": 21
},
{
"__id__": 22
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 76,
"g": 23,
"b": 47,
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 960,
"height": 640
"width": 234.16,
"height": 50.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -882,8 +932,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
1.665,
-200,
10.598,
14.838,
0,
0,
0,
......@@ -905,56 +955,178 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "03PA4kl0hJg5Ze8UEOjVp6"
"_id": "e69doCvBFGdoArd7j1TJNk"
},
{
"__type__": "cc.Layout",
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
"__id__": 20
},
"_enabled": true,
"_layoutSize": {
"__type__": "cc.Size",
"width": 960,
"height": 640
},
"_resize": 2,
"_N$layoutType": 3,
"_N$cellSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_useOriginalSize": false,
"_string": "Sight Words",
"_N$string": "Sight Words",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "aa5b426e-3b93-4e31-b27f-bbe5ce50bcb9"
},
"_N$startAxis": 0,
"_N$paddingLeft": 100,
"_N$paddingRight": 0,
"_N$paddingTop": 60,
"_N$paddingBottom": 0,
"_N$spacingX": 180,
"_N$spacingY": 180,
"_N$verticalDirection": 1,
"_N$horizontalDirection": 0,
"_N$affectedByScale": false,
"_id": "f1Y4BpSlVJv502bLYjpHRy"
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 1,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 2,
"_N$cacheMode": 0,
"_id": "27m7vf5sVNjboi3BO5vd0E"
},
{
"__type__": "cc.LabelOutline",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 20
},
"_enabled": true,
"_color": {
"__type__": "cc.Color",
"r": 36,
"g": 133,
"b": 178,
"a": 255
},
"_width": 4,
"_id": "47zcNichFN/5m31K34AJ1W"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 9,
"_left": 300,
"_right": 0,
"_top": 70,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "5dm27WY6ZB4b17biKVsArL"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
},
"_enabled": true,
"_clip": null,
"_volume": 1,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": false,
"_id": "a9zc9hlThCrqhxJ7r0Upsg"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "edrCtPEtJJt5ALnW+UzX2N"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_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": 1280,
"_originalHeight": 720,
"_id": "07/1nrOaFE/ZSj9ZvNSgOt"
},
{
"__type__": "cc.Node",
"_name": "Card",
"_objFlags": 0,
"_objFlags": 512,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 21
"__id__": 28
},
{
"__id__": 24
"__id__": 30
},
{
"__id__": 26
"__id__": 33
}
],
"_active": true,
......@@ -1009,19 +1181,16 @@
},
{
"__type__": "cc.Node",
"_name": "img",
"_name": "bgfront",
"_objFlags": 0,
"_parent": {
"__id__": 20
"__id__": 27
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 22
},
{
"__id__": 23
"__id__": 29
}
],
"_prefab": null,
......@@ -1035,8 +1204,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 120,
"height": 175
"width": 220,
"height": 220
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -1070,14 +1239,14 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "94vpkZQoRLwpd2t1wkOr5h"
"_id": "f1oSWOCw9LpZsEYfoaUNJJ"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
"__id__": 28
},
"_enabled": true,
"_materials": [
......@@ -1087,9 +1256,11 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_spriteFrame": {
"__uuid__": "04f666a2-2416-4edb-a67f-7a4937d79926"
},
"_type": 0,
"_sizeMode": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
......@@ -1100,36 +1271,23 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "fdS+SURplMH6QJZ3mErdFc"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
},
"_enabled": true,
"_clip": null,
"_volume": 1,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": false,
"_id": "76jMXe1QxG1p1IPebst+1U"
"_id": "1faK4aNtdOOK84rgK7bhR8"
},
{
"__type__": "cc.Node",
"_name": "bgfront",
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 20
"__id__": 27
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 25
"__id__": 31
},
{
"__id__": 32
}
],
"_prefab": null,
......@@ -1143,8 +1301,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 220,
"height": 220
"width": 120,
"height": 175
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -1178,14 +1336,14 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "f1oSWOCw9LpZsEYfoaUNJJ"
"_id": "94vpkZQoRLwpd2t1wkOr5h"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 24
"__id__": 30
},
"_enabled": true,
"_materials": [
......@@ -1195,11 +1353,9 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "04f666a2-2416-4edb-a67f-7a4937d79926"
},
"_spriteFrame": null,
"_type": 0,
"_sizeMode": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
......@@ -1210,27 +1366,43 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "1faK4aNtdOOK84rgK7bhR8"
"_id": "fdS+SURplMH6QJZ3mErdFc"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 30
},
"_enabled": true,
"_clip": null,
"_volume": 1,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": false,
"_id": "76jMXe1QxG1p1IPebst+1U"
},
{
"__type__": "cc.Node",
"_name": "bgback",
"_objFlags": 0,
"_parent": {
"__id__": 20
"__id__": 27
},
"_children": [
{
"__id__": 27
"__id__": 34
}
],
"_active": true,
"_components": [
{
"__id__": 29
"__id__": 37
},
{
"__id__": 30
"__id__": 38
}
],
"_prefab": null,
......@@ -1286,13 +1458,16 @@
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 26
"__id__": 33
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 28
"__id__": 35
},
{
"__id__": 36
}
],
"_prefab": null,
......@@ -1306,8 +1481,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 50.4
"width": 200,
"height": 250
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -1319,7 +1494,7 @@
"ctor": "Float64Array",
"array": [
0,
141.187,
135,
0,
0,
0,
......@@ -1348,7 +1523,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 27
"__id__": 34
},
"_enabled": true,
"_materials": [
......@@ -1363,7 +1538,7 @@
"_N$string": "",
"_fontSize": 50,
"_lineHeight": 40,
"_enableWrapText": true,
"_enableWrapText": false,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
......@@ -1373,16 +1548,43 @@
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "ComicSansMS-Bold",
"_N$overflow": 0,
"_N$overflow": 2,
"_N$cacheMode": 0,
"_id": "a53orQ0eZKIpPKud/cIltE"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 34
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 30,
"_right": 30,
"_top": 10,
"_bottom": 10,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 50.4,
"_id": "a5k16nBoVG9bSIeHEoSWQ6"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 26
"__id__": 33
},
"_enabled": true,
"_materials": [
......@@ -1414,7 +1616,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 26
"__id__": 33
},
"_enabled": true,
"_clip": {
......@@ -1427,6 +1629,211 @@
"preload": false,
"_id": "54j01GJLxICJ5/bgqguCBB"
},
{
"__type__": "cc.Node",
"_name": "AutoContainer",
"_objFlags": 512,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 40
}
],
"_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": "3bvCFUZIJL9qdjO3rL0CYM"
},
{
"__type__": "cc.Node",
"_name": "layout",
"_objFlags": 0,
"_parent": {
"__id__": 39
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 41
},
{
"__id__": 42
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 76,
"g": 23,
"b": 47,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": -200.0000000000001
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-100.00000000000001,
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": "03PA4kl0hJg5Ze8UEOjVp6"
},
{
"__type__": "cc.Layout",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 40
},
"_enabled": true,
"_layoutSize": {
"__type__": "cc.Size",
"width": 0,
"height": -200.0000000000001
},
"_resize": 2,
"_N$layoutType": 3,
"_N$cellSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_N$startAxis": 0,
"_N$paddingLeft": 150,
"_N$paddingRight": 0,
"_N$paddingTop": 100,
"_N$paddingBottom": 0,
"_N$spacingX": 180,
"_N$spacingY": 180,
"_N$verticalDirection": 1,
"_N$horizontalDirection": 0,
"_N$affectedByScale": false,
"_id": "f1Y4BpSlVJv502bLYjpHRy"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 40
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 200.00000000000006,
"_bottom": 4.263256414560601e-14,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 960,
"_originalHeight": 640,
"_id": "7dstcTQ9pHVYLfCdSlAlIV"
},
{
"__type__": "14b5cwFyzpM8oPE8OmwSLV+",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 39
},
"_enabled": true,
"designWidth": 1280,
"designHeight": 720,
"relativeNode": null,
"relativeX": 0,
"relativeY": 0,
"_id": "8dTcSpM11CcI1r8EazlZj8"
},
{
"__type__": "cc.Canvas",
"_name": "",
......@@ -1437,8 +1844,8 @@
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 960,
"height": 640
"width": 1280,
"height": 720
},
"_fitWidth": false,
"_fitHeight": true,
......@@ -1452,7 +1859,7 @@
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_left": 0,
......@@ -1492,7 +1899,7 @@
"_active": false,
"_components": [
{
"__id__": 35
"__id__": 48
}
],
"_prefab": null,
......@@ -1548,7 +1955,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 34
"__id__": 47
},
"_enabled": true,
"_materials": [
......
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
cc.Class({
extends: cc.Component,
properties: {
designWidth: {
default: 1280,
type: cc.Integer
},
designHeight: {
default: 720,
type: cc.Integer
},
relativeNode: {
default: null,
type: cc.Node,
tooltip: '设置相对节点'
},
relativeX: {
default: 0,
type: cc.Integer,
tooltip: '设置相对节点的X偏移量'
},
relativeY: {
default: 0,
type: cc.Integer,
tooltip: '设置相对节点的Y偏移量'
},
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start () {
cc.view._frameSize
cc.view._devicePixelRatio
window.aaa = this
this.setScale();
// this.setPosition();
},
setScale() {
const {width: designWidth, height: designHeight} = cc.view.getDesignResolutionSize()
if (!this.designWidth) {
this.designWidth = designWidth
}
if (!this.designHeight) {
this.designHeight = designHeight
}
let {width: viewWidth, height: wiewHeight} = cc.view.getFrameSize();
const ration = cc.view.getDevicePixelRatio();
viewWidth = viewWidth * ration;
wiewHeight = wiewHeight * ration;
const viewRatio = viewWidth / wiewHeight;
const designRatio = this.designWidth / this.designHeight;
let containerScale = 1;
if (designRatio > viewRatio) {
// base width
containerScale = viewWidth / this.designWidth;
console.log('base w', containerScale);
} else {
// base height
containerScale = wiewHeight / this.designHeight;
console.log('base h', containerScale);
}
// console.log(cc.winSize.width , viewWidth);
// let sx = cc.winSize.width / viewWidth;
// let sy = cc.winSize.height / wiewHeight;
// console.log(sx,sy);
let cocosScale = Math.min(cc.view._scaleX, cc.view._scaleY);
this.node.width = this.designWidth;
this.node.height = this.designHeight;
this.node.x = 0;
this.node.y = 0;
this.node.scale = containerScale / cocosScale;
},
setPosition() {
const canvas = cc.find('Canvas');
if (!this.relativeNode) {
this.relativeNode = this.node.parent
}
const worldPos = canvas.convertToWorldSpaceAR(cc.v2(this.relativeNode.x , this.relativeNode.y));
console.log(1, worldPos);
// const wx = this.relativeNode.width * (1 - this.relativeNode.anchorX) -
const wx = worldPos.x - this.relativeNode.width
// const wy = this.relativeNode.height * (this.relativeNode.anchorY - 1) + worldPos.y
const wy = worldPos.y - this.relativeNode.height
const nodePos = canvas.convertToWorldSpaceAR(cc.v2(this.node.x , this.node.y));
console.log(2, nodePos);
// const nx = this.node.width * (1 - this.node.anchorX) - nodePos.x
// const ny = this.node.height * (this.node.anchorY - 1) + nodePos.y
const nx = this.node.width * (1 - this.node.anchorX) - nodePos.x;
const ny = nodePos.y - this.node.height * (1 - this.node.anchorY) ;
// const relaX = worldPos.x - nodePos.x;
// const relaY = worldPos.y - nodePos.y;
const relaX = (wx - nx) * this.node.scale;
const relaY = (wy - ny) * this.node.scale;
this.node.x = relaX + this.relativeX;
this.node.y = relaY + this.relativeY;
}
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "14b5cc05-cb3a-4cf2-83c4-f0e9b048b57e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const ImageMode = cc.Enum({
NONE: 1,
FILL: 2,
CONTAIN: 3,
COVER: 4
});
cc.Class({
extends: cc.Component,
properties: {
image: {
default: null,
type: cc.Sprite
},
displayMode: {
default: ImageMode.NONE,
type: ImageMode
},
offsetX: {
default: 0,
type: cc.Integer,
},
offsetY: {
default: 0,
type: cc.Integer,
},
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start () {
if (!this.image) {
this.image = this.node.getComponent(cc.Sprite)
}
if (!this.image) {
return;
}
if (this.displayMode === ImageMode.FILL) {
this.node.width = this.node.parent.width;
this.node.height = this.node.parent.height;
}
if (this.displayMode === ImageMode.CONTAIN) {
const scale = this.calcMinScale();
this.node.x += this.offsetX;
this.node.y += this.offsetY;
this.node.scale = scale;
}
if (this.displayMode === ImageMode.COVER) {
const scale = this.calcMaxScale();
this.node.x += this.offsetX;
this.node.y += this.offsetY;
this.node.scale = scale;
}
},
calcMinScale() {
const {width: designWidth, height: designHeight} = this.node;
const {width: viewWidth, height: wiewHeight} = this.node.parent;
const viewRatio = viewWidth / wiewHeight;
const designRatio = designWidth / designHeight;
let containerScale = 1;
if (designRatio > viewRatio) {
// base width
containerScale = viewWidth / designWidth;
console.log('base w', containerScale);
} else {
// base height
containerScale = wiewHeight / designHeight;
console.log('base h', containerScale);
}
this.node.width = designWidth;
this.node.height = designHeight;
return containerScale
},
calcMaxScale() {
const {width: designWidth, height: designHeight} = this.node;
const {width: viewWidth, height: wiewHeight} = this.node.parent;
const viewRatio = viewWidth / wiewHeight;
const designRatio = designWidth / designHeight;
let containerScale = 1;
if (designRatio > viewRatio) {
containerScale = wiewHeight / designHeight;
console.log('base h', containerScale);
} else {
containerScale = viewWidth / designWidth;
console.log('base w', containerScale);
}
this.node.width = designWidth;
this.node.height = designHeight;
return containerScale
}
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "b2354193-668a-46e2-8686-678d3f6da3cd",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -103,8 +103,8 @@ cc.Class({
getDefaultData() {
const dataJson = ' {"contentObj":{"picArr":[{"left":{"title":"11111","pic_url":"http://staging-teach.cdn.ireadabc.com/156b8293a073ef828f6e01fc620c3562.png","audio_url":"http://staging-teach.cdn.ireadabc.com/83513f8d6083ebe072e3f9e47a21558a.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"","pic_url":"","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"","pic_url":"","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"","pic_url":"","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"","pic_url":"","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"","pic_url":"","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"","pic_url":"","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"","pic_url":"","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}}]}}'
// const dataJson = '{"contentObj":{"picArr":[{"left":{"title":"ant","pic_url":"http://staging-teach.cdn.ireadabc.com/ae171e6f3d70323f407aa254d2c3bd4e.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/b4e6f8abf69975813c2a44d1b5d3d9e0.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"ant2","pic_url":"http://staging-teach.cdn.ireadabc.com/6ea7e019a03c7cfaf516cdee66671047.jpg","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"ant3","pic_url":"http://staging-teach.cdn.ireadabc.com/ba2422c95c71d9991039d4b980af2166.jpg","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"ant4","pic_url":"http://staging-teach.cdn.ireadabc.com/c5fabd5e07386171fbddcde40be08dbb.jpg","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"ant5","pic_url":"http://staging-teach.cdn.ireadabc.com/9c26888dfe02eb79877c4fcc64867ecc.jpg","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"ant6","pic_url":"http://staging-teach.cdn.ireadabc.com/34a119bfa22caf4785bacfe639d9fa05.png","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"第七个","pic_url":"http://staging-teach.cdn.ireadabc.com/8eda76334b178bbe56d1f79ff53e68d0.jpg","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"第八个","pic_url":"http://staging-teach.cdn.ireadabc.com/3be3efc51e3e5178e3afc882c9a528d1.jpg","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"9","pic_url":"http://staging-teach.cdn.ireadabc.com/fb7ce5b740206aff8c3bb1f5cfc21ab9.png","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"10","pic_url":"http://staging-teach.cdn.ireadabc.com/97a054918747798f6e6e1f19f99b08d2.jpg","audio_url":""},"right":{"title":"","pic_url":"","audio_url":""}}]}}'
const dataJson = '{"contentObj":{"audio_url":"http://staging-teach.cdn.ireadabc.com/a4d27ad173a95823d4b8ec82363c5aa0.mp3","title":"123","picArr":[{"left":{"title":"11111111111111111111","pic_url":"http://staging-teach.cdn.ireadabc.com/156b8293a073ef828f6e01fc620c3562.png","audio_url":"http://staging-teach.cdn.ireadabc.com/83513f8d6083ebe072e3f9e47a21558a.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"222222","pic_url":"http://staging-teach.cdn.ireadabc.com/e029bf3210a23a169f1cc14a851cc9e4.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/5285e1e88a26a08783757e9c43a8653f.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"3333","pic_url":"http://staging-teach.cdn.ireadabc.com/89f8093ced2b9ddeccec352e9b7f2775.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/440cf9d57752b30691d90ed565e8c924.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"444444","pic_url":"http://staging-teach.cdn.ireadabc.com/5a2c61d8faf5935e70fd9b15953b12f6.png","audio_url":"http://staging-teach.cdn.ireadabc.com/a5fa20e0c6024421b0d9a7007c303503.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"5555","pic_url":"http://staging-teach.cdn.ireadabc.com/ce2e48ecefbf8b7011385a95133fe987.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/a41f0f2bf190396e2641ec8dada8edfe.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"66","pic_url":"http://staging-teach.cdn.ireadabc.com/13845267419e50bd7f0c0f74ba424be2.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/32258b839eca32b6ccf94f3dd6c86e0c.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"77777","pic_url":"http://staging-teach.cdn.ireadabc.com/7ec7599c86f974c9f88409893010811d.png","audio_url":"http://staging-teach.cdn.ireadabc.com/49ac987d13695eb411da4bef0adb318f.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"8888888","pic_url":"http://staging-teach.cdn.ireadabc.com/24ee95ea61a2a653ce25c65557b18356.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/85cff126986f5cc11b05e95181da5869.mp3"},"right":{"title":"","pic_url":"","audio_url":""}}]}}'
// const dataJson = '{"contentObj":{"picArr":[{"left":{"title":"11111","pic_url":"http://staging-teach.cdn.ireadabc.com/156b8293a073ef828f6e01fc620c3562.png","audio_url":"http://staging-teach.cdn.ireadabc.com/83513f8d6083ebe072e3f9e47a21558a.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"222222","pic_url":"http://staging-teach.cdn.ireadabc.com/e029bf3210a23a169f1cc14a851cc9e4.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/5285e1e88a26a08783757e9c43a8653f.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"3333","pic_url":"http://staging-teach.cdn.ireadabc.com/89f8093ced2b9ddeccec352e9b7f2775.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/440cf9d57752b30691d90ed565e8c924.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"444444","pic_url":"http://staging-teach.cdn.ireadabc.com/5a2c61d8faf5935e70fd9b15953b12f6.png","audio_url":"http://staging-teach.cdn.ireadabc.com/a5fa20e0c6024421b0d9a7007c303503.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"5555","pic_url":"http://staging-teach.cdn.ireadabc.com/ce2e48ecefbf8b7011385a95133fe987.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/a41f0f2bf190396e2641ec8dada8edfe.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"66","pic_url":"http://staging-teach.cdn.ireadabc.com/13845267419e50bd7f0c0f74ba424be2.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/32258b839eca32b6ccf94f3dd6c86e0c.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"77777","pic_url":"http://staging-teach.cdn.ireadabc.com/7ec7599c86f974c9f88409893010811d.png","audio_url":"http://staging-teach.cdn.ireadabc.com/49ac987d13695eb411da4bef0adb318f.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"8888888","pic_url":"http://staging-teach.cdn.ireadabc.com/24ee95ea61a2a653ce25c65557b18356.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/85cff126986f5cc11b05e95181da5869.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"99999999999999999","pic_url":"http://staging-teach.cdn.ireadabc.com/3aa5a936d8e0e6f1dd2f6eb6d3d26645.jpg","audio_url":"http://staging-teach.cdn.ireadabc.com/a4d27ad173a95823d4b8ec82363c5aa0.mp3"},"right":{"title":"","pic_url":"","audio_url":""}},{"left":{"title":"10101010101010","pic_url":"http://staging-teach.cdn.ireadabc.com/5ec43bf9507ff08d556487dee9234653.png","audio_url":"http://staging-teach.cdn.ireadabc.com/66878465ec50d162bd60fcdaa641933b.mp3"},"right":{"title":"","pic_url":"","audio_url":""}}]}}'
const data1 = JSON.parse(dataJson);
return data1;
},
......@@ -179,9 +179,27 @@ cc.Class({
// this.initListener();
},
myStart() {
const layoutNode = cc.find('Canvas/layout');
const layoutNode = cc.find('Canvas/AutoContainer/layout');
var layout = layoutNode.getComponent(cc.Layout);
console.log('fdsafdsa', this._imageResList);
const signNode = cc.find('Canvas/background/sign');
const bg1Node = signNode.getChildByName('bg1');
bg1Node.addComponent(cc.Button);
var labelTitle = signNode.getChildByName('label').getComponent(cc.Label);
const data = this.getDefaultData();
labelTitle.string = data.contentObj.title;
var audioUrl = data.contentObj.audio_url;
const playAudio = bg1Node.getComponent(cc.AudioSource);
cc.assetManager.loadRemote(audioUrl, (err, audioClip) => {
playAudio.clip = audioClip;
});
bg1Node.on('click', () => {
console.log('fdsafdsa');
playAudio.play();
});
for (let index = 0; index < this._imageResList.length; index++) {
const cardNode = cc.instantiate(cc.find('Canvas/Card'));
const imgNode = cardNode.getChildByName('img');
......@@ -225,15 +243,15 @@ cc.Class({
}, this);
layoutNode.addChild(cardNode);
if (this._imageResList.length > 8) {
cardNode.scaleY = 0.6;
cardNode.scaleX = 0.6;
layout.spacingX = 80;
layout.paddingLeft = 60;
} else {
cardNode.scaleY = 0.7;
cardNode.scaleX = 0.7;
cardNode.scaleY = 0.8;
cardNode.scaleX = 0.8;
layout.spacingX = 120;
layout.paddingLeft = 100;
// layout.paddingLeft = 60;
} else {
cardNode.scaleY = 0.8;
cardNode.scaleX = 0.8;
layout.spacingX = 180;
// layout.paddingLeft = 100;
}
layout.updateLayout();
}
......
{
"ver": "1.1.0",
"uuid": "297f7509-d6c0-4623-bc9b-a20914fb8806",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "8f6f10ec-689a-4666-ae07-1fc41db8ca28",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "843b086f-37a0-4942-be22-456fdf6ed58d",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "35d50ca8-f711-4322-a55b-0e027690b4ec",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "443de203-a840-4728-a77c-aa23f4bdad82",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "aa5b426e-3b93-4e31-b27f-bbe5ce50bcb9",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "dbf0e2bd-079f-4479-9be0-d3ab4ae070f2",
"uuid": "45617302-a220-499d-ad67-4bb0a9c243c9",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 244,
"height": 45,
"width": 1280,
"height": 102,
"platformSettings": {},
"subMetas": {
"sight-words": {
"group-8": {
"ver": "1.0.4",
"uuid": "c59bb4c1-4f47-466c-b644-2eab0ded6f31",
"rawTextureUuid": "dbf0e2bd-079f-4479-9be0-d3ab4ae070f2",
"uuid": "bedb3f82-62e2-45b7-9270-dea073a4d32d",
"rawTextureUuid": "45617302-a220-499d-ad67-4bb0a9c243c9",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......@@ -22,10 +22,10 @@
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 241,
"height": 41,
"rawWidth": 241,
"rawHeight": 41,
"width": 1280,
"height": 102,
"rawWidth": 1280,
"rawHeight": 102,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment