Commit 875826c3 authored by jeff's avatar jeff

更新1111111

parent 83de2984
...@@ -603,7 +603,7 @@ export class Label extends MySprite { ...@@ -603,7 +603,7 @@ export class Label extends MySprite {
private _text: string; private _text: string;
// fontSize:String = '40px'; // fontSize:String = '40px';
fontName = 'Verdana'; fontName = 'font';
textAlign = 'left'; textAlign = 'left';
fontSize = 40; fontSize = 40;
fontColor = '#000000'; fontColor = '#000000';
......
<div class="p-image-children-editor"> <div class="p-image-children-editor " style="font-family: font;">
<h5 style="margin-left: 2.5%;margin-top: 10px; "> 预览: </h5>
<div class="preview-box" #wrap> <div class="preview-box" #wrap>
<canvas id="canvas" #canvas></canvas> <canvas id="canvas" #canvas></canvas>
</div> </div>
...@@ -94,9 +91,9 @@ ...@@ -94,9 +91,9 @@
</div> </div>
<div *ngIf="customTypeGroupArr[it.gIdx]?.action" style="display: flex;align-items: center; margin-top: 5px"> <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] : {}" <app-custom-action style="margin: auto" [item]="it ? it['actionData_'] : {}"
[type]="customTypeGroupArr[it.gIdx].action.type" [option]="customTypeGroupArr[it.gIdx].action.option" [type]="customTypeGroupArr[it.gIdx].action.type" [option]="customTypeGroupArr[it.gIdx].action.option"
(save)="onSaveCustomAction($event, it)" [audio] ='customTypeGroupArr[it.gIdx].action.audio'> (save)="onSaveCustomAction($event, it)" [audio]='customTypeGroupArr[it.gIdx].action.audio'>
></app-custom-action> ></app-custom-action>
</div> </div>
......
...@@ -19,6 +19,7 @@ import TWEEN from '@tweenjs/tween.js'; ...@@ -19,6 +19,7 @@ import TWEEN from '@tweenjs/tween.js';
import { getMinScale } from '../../play/Unit'; import { getMinScale } from '../../play/Unit';
import { tar } from 'compressing'; import { tar } from 'compressing';
import { NzMessageService } from 'ng-zorro-antd'; import { NzMessageService } from 'ng-zorro-antd';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
@Component({ @Component({
...@@ -169,13 +170,9 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges { ...@@ -169,13 +170,9 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
} }
// 背景音频
@Input()
bgAudioUrl: string = ''
onBgAudioUploadSuucess(e) { onBgAudioUploadSuucess(e) {
console.log(e) console.log(e)
this.bgAudioUrl = e.url this.bgItem.bgAudioUrl = e.url
} }
onBackgroundUploadSuccess(e) { onBackgroundUploadSuccess(e) {
...@@ -316,11 +313,10 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges { ...@@ -316,11 +313,10 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
item['id'] = saveData.id; item['id'] = saveData.id;
item['pic'] = saveData.pic_url item['pic'] = saveData.pic_url
// item['skeJsonData'] = saveData.skeJsonData; // item['skeJsonData'] = saveData.skeJsonData;
// item['texJsonData'] = saveData.texJsonData; // item['texJsonData'] = saveData.texJsonData;
// item['texPngData'] = saveData.texPngData; // item['texPngData'] = saveData.texPngData;
// item['actionData_' + item.gIdx] = saveData['actionData_' + item.gIdx]; item['actionData_'] = saveData['actionData_'];
} }
console.log('item.x:~~ ', item.x); console.log('item.x:~~ ', item.x);
...@@ -416,7 +412,6 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges { ...@@ -416,7 +412,6 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
this.setActionFont(textLabel, saveData['actionData_']); this.setActionFont(textLabel, saveData['actionData_']);
textLabel.refreshSize(); textLabel.refreshSize();
} }
textLabel.x = item.x; textLabel.x = item.x;
textLabel.y = item.y; textLabel.y = item.y;
...@@ -572,6 +567,9 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges { ...@@ -572,6 +567,9 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
console.log('in customRadioChange', e); console.log('in customRadioChange', e);
item.gIdx = -1; item.gIdx = -1;
item.textLabel.text = ' '
item.textLabel.width = 100
setTimeout(() => { setTimeout(() => {
item.gIdx = e; item.gIdx = e;
this.refreshCustomItem(item); this.refreshCustomItem(item);
...@@ -645,7 +643,10 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges { ...@@ -645,7 +643,10 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
this.initData(); this.initData();
this.initCtx(); this.initCtx();
//要加载字体
setTimeout(() => {
this.initItem(); this.initItem();
}, 100);
} }
initItem() { initItem() {
...@@ -1134,12 +1135,10 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges { ...@@ -1134,12 +1135,10 @@ export class CustomHotZoneComponent1 implements OnInit, OnDestroy, OnChanges {
// skeJsonData: hotZoneArr[i].skeJsonData, // skeJsonData: hotZoneArr[i].skeJsonData,
// texJsonData: hotZoneArr[i].texJsonData, // texJsonData: hotZoneArr[i].texJsonData,
// texPngData: hotZoneArr[i].texPngData, // texPngData: hotZoneArr[i].texPngData,
gIdx: hotZoneArr[i].gIdx, gIdx: hotZoneArr[i].gIdx
useHand: hotZoneArr[i].useHand,
useBorder: hotZoneArr[i].useBorder
}; };
hotZoneItem['actionData_' ] = hotZoneArr[i]['actionData_'] hotZoneItem['actionData_'] = hotZoneArr[i]['actionData_']
if (this.hotZoneFontObj) { if (this.hotZoneFontObj) {
......
{
"name": "publish",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ngx-color-picker": {
"version": "11.0.0",
"resolved": "https://registry.nlark.com/ngx-color-picker/download/ngx-color-picker-11.0.0.tgz",
"integrity": "sha1-weVGhQWVO8V5vyEBShNYCIIOp1M=",
"requires": {
"tslib": "^2.0.0"
}
},
"tslib": {
"version": "2.2.0",
"resolved": "https://registry.npm.taobao.org/tslib/download/tslib-2.2.0.tgz",
"integrity": "sha1-+yxHWXfjXiQTEe3iaTzuHsZpj1w="
}
}
}
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 64.51, "width": 103.13,
"height": 50.4 "height": 50.4
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -156,8 +156,8 @@ ...@@ -156,8 +156,8 @@
], ],
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_string": "test", "_string": "test111",
"_N$string": "test", "_N$string": "test111",
"_fontSize": 40, "_fontSize": 40,
"_lineHeight": 40, "_lineHeight": 40,
"_enableWrapText": true, "_enableWrapText": true,
......
...@@ -16,18 +16,25 @@ ...@@ -16,18 +16,25 @@
"_name": "node", "_name": "node",
"_objFlags": 0, "_objFlags": 0,
"_parent": null, "_parent": null,
"_children": [], "_children": [
"_active": true,
"_components": [
{ {
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 3 "__id__": 6
},
{
"__id__": 10
}
],
"_active": true,
"_components": [
{
"__id__": 13
} }
], ],
"_prefab": { "_prefab": {
"__id__": 4 "__id__": 14
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -44,8 +51,75 @@ ...@@ -44,8 +51,75 @@
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__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, "x": 0,
"y": 1 "y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "New Sprite(Splash)",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 4
}
],
"_prefab": {
"__id__": 5
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 100,
"g": 99,
"b": 137,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 48,
"height": 44
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
}, },
"_trs": { "_trs": {
"__type__": "TypedArray", "__type__": "TypedArray",
...@@ -81,8 +155,145 @@ ...@@ -81,8 +155,145 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": -4,
"_right": -4,
"_top": -4,
"_bottom": -4,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 100,
"_originalHeight": 100,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1 "__id__": 1
}, },
"asset": {
"__uuid__": "85e73971-9396-4c2a-9fac-2b187fd99c48"
},
"fileId": "3fpP7V8bRL9I4tBqsQ4W/R",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "New Sprite(Splash)",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 7
},
{
"__id__": 8
}
],
"_prefab": {
"__id__": 9
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 197,
"g": 244,
"b": 187,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 36
},
"_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": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
{ {
...@@ -92,8 +303,140 @@ ...@@ -92,8 +303,140 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061" "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_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": 100,
"_originalHeight": 100,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "85e73971-9396-4c2a-9fac-2b187fd99c48"
},
"fileId": "e0zPyfqplEKZlyC2lXi40G",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "New Node",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 11
}
],
"_prefab": {
"__id__": 12
},
"_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": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
"_fillType": 0, "_fillType": 0,
...@@ -108,6 +451,17 @@ ...@@ -108,6 +451,17 @@
"_atlas": null, "_atlas": null,
"_id": "" "_id": ""
}, },
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "85e73971-9396-4c2a-9fac-2b187fd99c48"
},
"fileId": "25GAuqDahFz4vaRdWo8jdV",
"sync": false
},
{ {
"__type__": "577b3ZhuUNJtLzUNX3CEf1G", "__type__": "577b3ZhuUNJtLzUNX3CEf1G",
"_name": "", "_name": "",
......
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
78.809, 78.809,
-3.5, 0,
0, 0,
0, 0,
0, 0,
......
cc.Class({
extends: cc.Component,
properties: {
playBtn: cc.Node,
label: cc.Label,
tiao: cc.Node
},
onload() {
this._clip = null
this._play = false
this._audioId = null
this._totoalTime = null
this._nowTime = null
},
onEnable() {
cc.systemEvent.on('stopBgMusic', this.onEvent, this)
},
onDisable() {
cc.systemEvent.off('stopBgMusic', this.onEvent, this)
},
init(url) {
this.stopAudio()
this.playBtn.children[0].active = false
this.playBtn.children[1].active = true
cc.assetManager.loadRemote(url, (err, audioClip) => {
if (err) return
this.clip = audioClip
this._totoalTime = audioClip.duration
this.label.string = '0:00/' + this.transTime(this._totoalTime)
this.tiao.children[0].getComponent(cc.Sprite).fillRange = 0
this.tiao.children[1].x =12
})
},
onPlay() {
this._play = !this._play
this.playBtn.children[0].active = this._play
this.playBtn.children[1].active = !this._play
if (this._play) {
if (this._audioId != null) {
cc.audioEngine.resume(this._audioId)
} else {
this._audioId = cc.audioEngine.play(this.clip, false, 0.8);
cc.audioEngine.setFinishCallback(this._audioId, this.stopAudio.bind(this));
this._nowTime = 0
}
cc.systemEvent.emit('stopWordsMusic')
this.schedule(this.onTimeLoop)
} else {
this.stopAudio()
}
},
/** 定时回调 */
onTimeLoop(dt) {
this._nowTime += dt
this.label.string = this.transTime(this._nowTime) + '/' + this.transTime(this._totoalTime)
if (this._nowTime > this._totoalTime) this._nowTime = this._totoalTime
let scale = this._nowTime / this._totoalTime
this.tiao.children[0].getComponent(cc.Sprite).fillRange = scale
this.tiao.children[1].x = 12 + 364 * scale
},
onEvent() {
if (!this._play) return
this.onStopAudio()
},
onStopAudio() {
if (this._nowTime < this._totoalTime) {
cc.audioEngine.pause(this._audioId)
this._play = false
this.playBtn.children[0].active = false
this.playBtn.children[1].active = true
this.unscheduleAllCallbacks()
} else {
this.stopAudio()
}
},
stopAudio() {
if (this._audioId != null) {
cc.audioEngine.stop(this._audioId)
this._audioId = null
this.unscheduleAllCallbacks()
this._play = false
this.playBtn.children[0].active = false
this.playBtn.children[1].active = true
this.tiao.children[0].getComponent(cc.Sprite).fillRange = 1
this.tiao.children[1].x = 12 + 364 * 1
}
},
/** 秒转分钟 */
transTime(time) {
let temp = Math.floor(time / 60)
time = (time - 60 * temp).toFixed(0)
if (time < 10) time = '0' + time
return temp + ':' + time
}
});
{
"ver": "1.0.8",
"uuid": "a5d5c97d-70df-4203-9b44-2c83877fab88",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
...@@ -11,7 +11,7 @@ cc.Class({ ...@@ -11,7 +11,7 @@ cc.Class({
data: null, data: null,
onLoad() { onLoad() {
this._show = false
}, },
onEnable() { onEnable() {
...@@ -25,21 +25,32 @@ cc.Class({ ...@@ -25,21 +25,32 @@ cc.Class({
}, },
initWithData(data, scale) { initWithData(data, scale) {
let action = data['actionData_']
if (!action) {
this.node.active = false
return
} else {
this.node.action = true
}
this.data = data this.data = data
let rect = this.data.rect let rect = this.data.rect
this.node.x = rect.x * scale this.node.x = (rect.x + rect.width / 2) * scale
this.node.y = -rect.y * scale this.node.y = (-rect.y - rect.height / 2) * scale
this.node.width = rect.width
this.node.height = rect.height
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 this.label.node.active = false
let option = action.changeOption let option = action.changeOption
this.label.node.color = option[0][1] ? cc.color(option[0][1]) : cc.color(0, 0, 0) this.label.node.color = option[0][1] ? cc.color(option[0][1]) : cc.color(0, 0, 0)
let num = Number(option[1][1]) * scale * data.fontScale
this.label.fontSize = num
this.label.lineHeight = num
this.label.string = action.text ? action.text : ''
this.node.width = rect.width * scale
this.node.height = rect.height * scale
}, },
onTouchStart() { onTouchStart() {
if (this._show) return
this._show = true
this.label.node.active = true this.label.node.active = true
cc.audioEngine.play(this.tipClip) cc.audioEngine.play(this.tipClip)
}, },
...@@ -47,5 +58,6 @@ cc.Class({ ...@@ -47,5 +58,6 @@ cc.Class({
/** 改变答案显示状态 */ /** 改变答案显示状态 */
onChangeState(show) { onChangeState(show) {
this.label.node.active = show this.label.node.active = show
this._show =show
} }
}); });
...@@ -6,14 +6,24 @@ cc.Class({ ...@@ -6,14 +6,24 @@ cc.Class({
properties: { properties: {
}, },
initWithData(data,scale) { initWithData(data, scale) {
let sprite = this.getComponent(cc.Sprite) let sprite = this.node.children[2].getComponent(cc.Sprite)
tools.getSpriteFrimeByUrl(data.pic_url,(sp)=>{ tools.getSpriteFrimeByUrl(data.pic_url, (sp) => {
sprite.spriteFrame = sp sprite.spriteFrame = sp
let rect = data.rect let rect = data.rect
this.node.setPosition(rect.x*scale,-rect.y*scale) this.node.setPosition((rect.x + rect.width / 2) * scale, (-rect.y - rect.height / 2) * scale)
this.node.width = rect.width*scale let height = rect.height * scale
this.node.height = rect.height*scale let width = rect.width * scale
sprite.node.width = width
sprite.node.height = height
this.node.height = height
this.node.width = width
let node = this.node.children[0]
node.height = height + 8
node.width = width + 8
node = this.node.children[1]
node.height = height
node.width = width
}) })
} }
}); });
...@@ -84,19 +84,19 @@ ...@@ -84,19 +84,19 @@
"__id__": 21 "__id__": 21
}, },
{ {
"__id__": 39 "__id__": 40
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 54 "__id__": 58
}, },
{ {
"__id__": 55 "__id__": 59
}, },
{ {
"__id__": 56 "__id__": 60
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -952,16 +952,16 @@ ...@@ -952,16 +952,16 @@
"__id__": 24 "__id__": 24
}, },
{ {
"__id__": 30 "__id__": 31
}, },
{ {
"__id__": 34 "__id__": 35
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 38 "__id__": 39
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1118,11 +1118,15 @@ ...@@ -1118,11 +1118,15 @@
"__id__": 25 "__id__": 25
}, },
{ {
"__id__": 28 "__id__": 27
} }
], ],
"_active": true, "_active": true,
"_components": [], "_components": [
{
"__id__": 29
}
],
"_prefab": null, "_prefab": null,
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -1155,7 +1159,7 @@ ...@@ -1155,7 +1159,7 @@
1, 1,
1, 1,
1, 1,
1 0
] ]
}, },
"_eulerAngles": { "_eulerAngles": {
...@@ -1179,13 +1183,10 @@ ...@@ -1179,13 +1183,10 @@
"__id__": 24 "__id__": 24
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 26 "__id__": 26
},
{
"__id__": 27
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1268,74 +1269,6 @@ ...@@ -1268,74 +1269,6 @@
"_atlas": null, "_atlas": null,
"_id": "200LqappFKCLUsTniwvise" "_id": "200LqappFKCLUsTniwvise"
}, },
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
},
"_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": "62ZpyFmY1Hc7xJHrjZMag1"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "btn_replay", "_name": "btn_replay",
...@@ -1347,7 +1280,7 @@ ...@@ -1347,7 +1280,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 29 "__id__": 28
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1403,7 +1336,7 @@ ...@@ -1403,7 +1336,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 28 "__id__": 27
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -1430,6 +1363,88 @@ ...@@ -1430,6 +1363,88 @@
"_atlas": null, "_atlas": null,
"_id": "f6oF0y1r1EELhPtNQWrpv2" "_id": "f6oF0y1r1EELhPtNQWrpv2"
}, },
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 24
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.1,
"clickEvents": [
{
"__id__": 30
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 3,
"transition": 3,
"_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": "35It6TDn9KobgK3pQ3c96H"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 2
},
"component": "",
"_componentId": "c238bwNxXtAHqIXQECY4nQz",
"handler": "onCheckall",
"customEventData": ""
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "btn_left", "_name": "btn_left",
...@@ -1441,10 +1456,10 @@ ...@@ -1441,10 +1456,10 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 31 "__id__": 32
}, },
{ {
"__id__": 33 "__id__": 34
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1500,7 +1515,7 @@ ...@@ -1500,7 +1515,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 30 "__id__": 31
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -1509,7 +1524,7 @@ ...@@ -1509,7 +1524,7 @@
"zoomScale": 1.1, "zoomScale": 1.1,
"clickEvents": [ "clickEvents": [
{ {
"__id__": 32 "__id__": 33
} }
], ],
"_N$interactable": true, "_N$interactable": true,
...@@ -1582,7 +1597,7 @@ ...@@ -1582,7 +1597,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 30 "__id__": 31
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -1620,10 +1635,10 @@ ...@@ -1620,10 +1635,10 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 35 "__id__": 36
}, },
{ {
"__id__": 37 "__id__": 38
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1679,7 +1694,7 @@ ...@@ -1679,7 +1694,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 34 "__id__": 35
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -1688,7 +1703,7 @@ ...@@ -1688,7 +1703,7 @@
"zoomScale": 1.1, "zoomScale": 1.1,
"clickEvents": [ "clickEvents": [
{ {
"__id__": 36 "__id__": 37
} }
], ],
"_N$interactable": true, "_N$interactable": true,
...@@ -1761,7 +1776,7 @@ ...@@ -1761,7 +1776,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 34 "__id__": 35
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -1824,19 +1839,22 @@ ...@@ -1824,19 +1839,22 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 40 "__id__": 41
}, },
{ {
"__id__": 45 "__id__": 48
}, },
{ {
"__id__": 51 "__id__": 54
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 53 "__id__": 56
},
{
"__id__": 57
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -1850,7 +1868,7 @@ ...@@ -1850,7 +1868,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 600, "width": 500,
"height": 90 "height": 90
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -1863,7 +1881,7 @@ ...@@ -1863,7 +1881,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-252.23000000000002, -315,
0, 0,
0, 0,
0, 0,
...@@ -1892,18 +1910,22 @@ ...@@ -1892,18 +1910,22 @@
"_name": "btnPlay", "_name": "btnPlay",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 39 "__id__": 40
}, },
"_children": [ "_children": [
{ {
"__id__": 41 "__id__": 42
}, },
{ {
"__id__": 43 "__id__": 44
} }
], ],
"_active": true, "_active": true,
"_components": [], "_components": [
{
"__id__": 46
}
],
"_prefab": null, "_prefab": null,
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -1957,13 +1979,13 @@ ...@@ -1957,13 +1979,13 @@
"_name": "btn_stop", "_name": "btn_stop",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 40 "__id__": 41
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 42 "__id__": 43
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2019,7 +2041,7 @@ ...@@ -2019,7 +2041,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 41 "__id__": 42
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -2051,13 +2073,13 @@ ...@@ -2051,13 +2073,13 @@
"_name": "btn_next", "_name": "btn_next",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 40 "__id__": 41
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 44 "__id__": 45
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2113,7 +2135,7 @@ ...@@ -2113,7 +2135,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 43 "__id__": 44
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -2140,25 +2162,107 @@ ...@@ -2140,25 +2162,107 @@
"_atlas": null, "_atlas": null,
"_id": "67n/3zVDlChbBxVBsMSZCn" "_id": "67n/3zVDlChbBxVBsMSZCn"
}, },
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 41
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 47
}
],
"_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": "76GOqNaq9B0oiRUsO6Ux3u"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 40
},
"component": "",
"_componentId": "a5d5cl9cN9CA5tELIOHf6uI",
"handler": "onPlay",
"customEventData": ""
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "bg_tiaodi", "_name": "bg_tiaodi",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 39 "__id__": 40
}, },
"_children": [ "_children": [
{ {
"__id__": 46 "__id__": 49
}, },
{ {
"__id__": 48 "__id__": 51
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 50 "__id__": 53
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2177,14 +2281,14 @@ ...@@ -2177,14 +2281,14 @@
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5, "x": 0,
"y": 0.5 "y": 0.5
}, },
"_trs": { "_trs": {
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
51.05, -145.506,
0, 0,
0, 0,
0, 0,
...@@ -2214,13 +2318,13 @@ ...@@ -2214,13 +2318,13 @@
"_name": "bg_tiao", "_name": "bg_tiao",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 45 "__id__": 48
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 47 "__id__": 50
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2246,7 +2350,7 @@ ...@@ -2246,7 +2350,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
-190.6, 3.449,
0, 0,
0, 0,
0, 0,
...@@ -2276,7 +2380,7 @@ ...@@ -2276,7 +2380,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 46 "__id__": 49
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -2308,13 +2412,13 @@ ...@@ -2308,13 +2412,13 @@
"_name": "icon_move", "_name": "icon_move",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 45 "__id__": 48
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 49 "__id__": 52
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2340,7 +2444,7 @@ ...@@ -2340,7 +2444,7 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 17,
0, 0,
0, 0,
0, 0,
...@@ -2370,7 +2474,7 @@ ...@@ -2370,7 +2474,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 48 "__id__": 51
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -2402,7 +2506,7 @@ ...@@ -2402,7 +2506,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 45 "__id__": 48
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -2431,16 +2535,16 @@ ...@@ -2431,16 +2535,16 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "New Label", "_name": "time",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 39 "__id__": 40
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 52 "__id__": 55
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2496,7 +2600,7 @@ ...@@ -2496,7 +2600,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 51 "__id__": 54
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -2529,7 +2633,7 @@ ...@@ -2529,7 +2633,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 39 "__id__": 40
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -2538,7 +2642,7 @@ ...@@ -2538,7 +2642,7 @@
"_left": 0, "_left": 0,
"_right": 0, "_right": 0,
"_top": 0, "_top": 0,
"_bottom": 62.77000000000001, "_bottom": 0,
"_verticalCenter": 0, "_verticalCenter": 0,
"_horizontalCenter": 0, "_horizontalCenter": 0,
"_isAbsLeft": true, "_isAbsLeft": true,
...@@ -2551,6 +2655,25 @@ ...@@ -2551,6 +2655,25 @@
"_originalHeight": 0, "_originalHeight": 0,
"_id": "50C3HEd7VCHoMtvxKUTJaF" "_id": "50C3HEd7VCHoMtvxKUTJaF"
}, },
{
"__type__": "a5d5cl9cN9CA5tELIOHf6uI",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 40
},
"_enabled": true,
"playBtn": {
"__id__": 41
},
"label": {
"__id__": 55
},
"tiao": {
"__id__": 48
},
"_id": "bc9MPqChFDCJsvpOdf++gN"
},
{ {
"__type__": "cc.Canvas", "__type__": "cc.Canvas",
"_name": "", "_name": "",
...@@ -2610,17 +2733,23 @@ ...@@ -2610,17 +2733,23 @@
"__id__": 15 "__id__": 15
}, },
"leftNode": { "leftNode": {
"__id__": 30 "__id__": 31
}, },
"rightNode": { "rightNode": {
"__id__": 34 "__id__": 35
},
"checkNode": {
"__id__": 24
}, },
"bgAudioNode": { "bgAudioNode": {
"__id__": 39 "__id__": 40
}, },
"btnClip": { "btnClip": {
"__uuid__": "39ef1939-3bf9-4d21-a67a-bc1dede521a9" "__uuid__": "39ef1939-3bf9-4d21-a67a-bc1dede521a9"
}, },
"tipClip": {
"__uuid__": "e0bcf4cc-35a7-4d61-b202-8dd49299c2c0"
},
"_id": "a1ibU1vO9Nwbfwjsm/NgGR" "_id": "a1ibU1vO9Nwbfwjsm/NgGR"
} }
] ]
\ No newline at end of file
...@@ -20,8 +20,13 @@ cc.Class({ ...@@ -20,8 +20,13 @@ cc.Class({
type: cc.Node, type: cc.Node,
default: null default: null
}, },
checkNode: {
type: cc.Node,
default: null
},
bgAudioNode: cc.Node, bgAudioNode: cc.Node,
btnClip: cc.AudioClip btnClip: cc.AudioClip,
tipClip: cc.AudioClip
}, },
// 生命周期 onLoad // 生命周期 onLoad
...@@ -85,6 +90,7 @@ cc.Class({ ...@@ -85,6 +90,7 @@ cc.Class({
this.picNode.opacity = 0 this.picNode.opacity = 0
this.leftNode.active = false this.leftNode.active = false
this.rightNode.active = false this.rightNode.active = false
this.answerState = false
}, },
onEnable() { onEnable() {
...@@ -101,7 +107,7 @@ cc.Class({ ...@@ -101,7 +107,7 @@ cc.Class({
}, },
getDefaultData() { getDefaultData() {
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 dataJson = ' [{"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/b90a006ba41723ec11970051e92f43e0.png","rect":{"x":125.28,"y":0,"width":508.44,"height":286},"bgAudioUrl":"http://staging-teach.cdn.ireadabc.com/c8a7dd49a778b0b6dd509aac0ef437ff.mp3"},"hotZoneItemArr":[{"id":"1620909579034","index":0,"itemType":"text","fontScale":0.59296875,"imgScale":1,"mapScale":0.59296875,"gIdx":"0","actionData_":{"type":"text","changeOption":[["fontColor","#000000"],["fontSize","60"]],"text":"aaaaaaaaaaaaaa","audio_url":"http://staging-teach.cdn.ireadabc.com/c8a7dd49a778b0b6dd509aac0ef437ff.mp3"},"rect":{"width":292.76,"height":35.58,"x":12.63,"y":26.79}},{"id":"1620915585437","index":1,"pic_url":"http://staging-teach.cdn.ireadabc.com/31bde9b15582618fa5db4ac7cbc275b4.gif","itemType":"pic","fontScale":0.59296875,"imgScale":0.14977973568281938,"mapScale":0.59296875,"gIdx":"2","actionData_":{"type":"text","changeOption":[["fontColor","#000000"],["fontSize","100"]],"text":"bbbbbbbbbbb"},"rect":{"x":328.41,"y":11,"width":161.61,"height":68}},{"id":"1620920750092","index":2,"itemType":"text","fontScale":0.59296875,"imgScale":1,"mapScale":0.59296875,"gIdx":"0","actionData_":{"type":"text","changeOption":[["fontColor","#000000"],["fontSize","100"]],"text":"嗯?","audio_url":"http://staging-teach.cdn.ireadabc.com/7df4cc83a6c76dc6f0a526d07e6f1987.mp3"},"rect":{"width":118.58,"height":59.3,"x":203.93,"y":129.35}}]},{"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/b90a006ba41723ec11970051e92f43e0.png","bgAudioUrl":"http://staging-teach.cdn.ireadabc.com/8f73a6b73a217d25ca4f4a2e234c1513.mp3","rect":{"x":222.44,"y":0,"width":903.11,"height":508}},"hotZoneItemArr":[{"id":"1620920863432","index":0,"pic_url":"http://staging-teach.cdn.ireadabc.com/335dea1b83498b0c7c05be637dc13dad.jpeg","itemType":"text","fontScale":1.053125,"imgScale":0.22391857506361323,"mapScale":1.053125,"gIdx":"0","actionData_":{"type":"text","changeOption":[["fontColor","#FF0000"],["fontSize","100"]],"text":"This is a test"},"rect":{"width":558.89,"height":105.31,"x":13.12,"y":6.34}},{"id":"1620920877342","index":1,"itemType":"text","fontScale":1.053125,"imgScale":1,"mapScale":1.053125,"gIdx":"1","actionData_":{"type":"text","changeOption":[["fontColor","#0000FF"],["fontSize","100"]],"text":"you are so good"},"rect":{"width":734.29,"height":105.31,"x":106.43,"y":151.34}},{"id":"1620922839187","index":2,"itemType":"text","fontScale":1.053125,"imgScale":1,"mapScale":1.053125,"gIdx":"0","actionData_":{"type":"text","changeOption":[["fontColor","#000000"],["fontSize","100"]],"text":"_______________"},"rect":{"width":728.12,"height":105.31,"x":109.5,"y":170.34}}]}]'
const data = JSON.parse(dataJson); const data = JSON.parse(dataJson);
return data; return data;
}, },
...@@ -261,7 +267,11 @@ cc.Class({ ...@@ -261,7 +267,11 @@ cc.Class({
.start(); .start();
}, },
stopAudio() { stopAudio() {
cc.systemEvent.emit('stopMusic') cc.systemEvent.emit('stopBgMusic')
cc.systemEvent.emit('stopWordsMusic')
this.answerState = false
this.checkNode.children[0].active = false
this.checkNode.children[1].active = true
}, },
// ------------------------------------------------ // ------------------------------------------------
...@@ -271,17 +281,26 @@ cc.Class({ ...@@ -271,17 +281,26 @@ cc.Class({
console.log('数据错误') console.log('数据错误')
return return
} }
if (data.bgAudioUrl && data.bgAudioUrl != '') { picNode.getComponent('picNode').initWithData(data)
let url = data.bgItem.bgAudioUrl
if (url && url != '') {
this.bgAudioNode.active = true this.bgAudioNode.active = true
this.bgAudioNode.getComponent('audioItem').init(url)
} else { } else {
this.bgAudioNode.active = false this.bgAudioNode.active = false
} }
picNode.getComponent('picNode').initWithData(data)
}, },
answerState: null,
/** 点击切换答案显示 */ /** 点击切换答案显示 */
onCheckall() { onCheckall() {
cc.audioEngine.playEffect(this.btnClip)
cc.audioEngine.playEffect(this.tipClip)
this.answerState = !this.answerState
this.checkNode.children[0].active = this.answerState
this.checkNode.children[1].active = !this.answerState
cc.systemEvent.emit('changeAnswerState', this.answerState)
} }
// ------------------------------------------ // ------------------------------------------
}); });
const tools = require("../script/tools"); var playingItem = null
cc.Class({ cc.Class({
extends: cc.Component, extends: cc.Component,
...@@ -13,42 +13,52 @@ cc.Class({ ...@@ -13,42 +13,52 @@ cc.Class({
audio_url: null, audio_url: null,
onEnable() { onEnable() {
cc.systemEvent.on('stopWordsMusic', this.stopAudio, this)
}, },
onDisable() { onDisable() {
cc.systemEvent.off('stopWordsMusic', this.stopAudio, this)
}, },
initWithData(data, scale) { initWithData(data, scale) {
let action = data['actionData_']
if (!action) {
this.node.active = false
return
} else {
this.node.action = true
}
this.data = data this.data = data
let rect = this.data.rect let rect = this.data.rect
this.node.x = (rect.x + rect.width / 2) * scale this.node.x = (rect.x + rect.width / 2) * scale
this.node.y = (-rect.y - rect.height / 2) * scale this.node.y = (-rect.y - rect.height / 2) * scale
let action = data['actionData_'] this.node.width = rect.width * scale
this.node.height = rect.height * scale
let node = this.label.node let node = this.label.node
let option = action.changeOption let option = action.changeOption
node.color = option[0][1] ? cc.color(option[0][1]) : cc.color(0, 0, 0) node.color = option[0][1] ? cc.color(option[0][1]) : cc.color(0, 0, 0)
node.scale = data.fontScale ? data.fontScale*scale : scale let num = Number(option[1][1]) * scale * data.fontScale
this.label.fontSize = num
this.label.lineHeight = num
this.label.string = action.text ? action.text : '' this.label.string = action.text ? action.text : ''
this.node.width = node.width * node.scale
this.node.height = node.height * node.height
this.audioId = null this.audioId = null
this.audio_url = action.audio_url this.audio_url = action.audio_url
if (this.audio_url) { if (this.audio_url) {
let node = this.playAnim.node let node = this.playAnim.node
node.scale = 1 / this.node.scale node.setPosition(this.node.width / 2 + node.width / 2 + 15, (-this.node.height + node.height) / 2)
node.setPosition(this.label.node.width + node.width / 2 + 15, -this.node.height / 2) node.active = true
this.playAnim.node.active = true
} else { } else {
this.playAnim.node.active = false this.playAnim.node.active = false
} }
}, },
onTouchStart() { onTouchStart() {
if (this.audioId) return if (this.audioId != null) return
if (this.audio_url && this.audio_url != '') { if (this.audio_url && this.audio_url != '') {
this.playAudio(this.audio_url) this.playAudio(this.audio_url)
this.playAnim.play('play') this.playAnim.play('play')
cc.systemEvent.emit('stopBgMusic')
} }
}, },
...@@ -56,9 +66,10 @@ cc.Class({ ...@@ -56,9 +66,10 @@ cc.Class({
playAudio(url) { playAudio(url) {
cc.assetManager.loadRemote(url, (err, audioClip) => { cc.assetManager.loadRemote(url, (err, audioClip) => {
if (err) return if (err) return
cc.systemEvent.once('stopMusic', this.stopAudio, this) if(playingItem) playingItem.stopAudio()
this.audioId = cc.audioEngine.play(audioClip, false, 0.8); this.audioId = cc.audioEngine.play(audioClip, false, 0.8);
cc.audioEngine.setFinishCallback(this.audioId, this.stopAudio.bind(this)); cc.audioEngine.setFinishCallback(this.audioId, this.stopAudio.bind(this));
playingItem = this
}); });
}, },
...@@ -67,7 +78,6 @@ cc.Class({ ...@@ -67,7 +78,6 @@ cc.Class({
cc.audioEngine.stop(this.audioId) cc.audioEngine.stop(this.audioId)
this.audioId = null this.audioId = null
this.playAnim.play('stop') this.playAnim.play('stop')
cc.systemEvent.off('stopMusic', this.stopAudio, this)
} }
}, },
/** 音频id */ /** 音频id */
......
...@@ -32,8 +32,8 @@ export default class NewClass extends cc.Component { ...@@ -32,8 +32,8 @@ export default class NewClass extends cc.Component {
this.node.removeAllChildren() this.node.removeAllChildren()
// let one = new cc.Node() // let one = new cc.Node()
// one.removeFromParent() // one.removeFromParent()
// this.node let one = new cc.Label()
one
// cc.audioEngine.setFinishCallback() // cc.audioEngine.setFinishCallback()
} }
......
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