Commit 5016642d authored by 唐鑫's avatar 唐鑫

bug处理

parent 90dbaf92
...@@ -15,21 +15,20 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -15,21 +15,20 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
item; item;
customTypeGroupArr = [ customTypeGroupArr = [
// {
// name: '发音图片',
// pic: true,
// audio: true,
// },
{ {
name: '发音图片', name: '热区',//发音区块
pic: true,
audio: true,
},
{
name: '发音区块',
rect: true, rect: true,
audio: true, audio: true,
}, },
{ // {
name: "热区", // name: "热区",
rect: true // rect: true
} // }
] ]
constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) { constructor(private appRef: ApplicationRef, private changeDetectorRef: ChangeDetectorRef) {
......
...@@ -16,19 +16,19 @@ ...@@ -16,19 +16,19 @@
{ {
"frame": 0, "frame": 0,
"value": { "value": {
"__uuid__": "562deefd-c9fd-42f0-97d7-d6f5893ef3f3" "__uuid__": "243e71ab-eb67-4dd0-8abd-5ca1104903df"
} }
}, },
{ {
"frame": 0.3333333333333333, "frame": 0.3333333333333333,
"value": { "value": {
"__uuid__": "61e47c68-658d-416b-a46e-399ebfddd2c8" "__uuid__": "243e71ab-eb67-4dd0-8abd-5ca1104903df"
} }
}, },
{ {
"frame": 0.6666666666666666, "frame": 0.6666666666666666,
"value": { "value": {
"__uuid__": "562deefd-c9fd-42f0-97d7-d6f5893ef3f3" "__uuid__": "243e71ab-eb67-4dd0-8abd-5ca1104903df"
} }
} }
] ]
......
...@@ -45,11 +45,11 @@ ...@@ -45,11 +45,11 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 45 "__id__": 43
} }
], ],
"_prefab": { "_prefab": {
"__id__": 46 "__id__": 44
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -1147,22 +1147,22 @@ ...@@ -1147,22 +1147,22 @@
}, },
{ {
"__id__": 36 "__id__": 36
},
{
"__id__": 39
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 42 "__id__": 39
}, },
{ {
"__id__": 43 "__id__": 40
},
{
"__id__": 41
} }
], ],
"_prefab": { "_prefab": {
"__id__": 44 "__id__": 42
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -1345,8 +1345,8 @@ ...@@ -1345,8 +1345,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 60, "width": 52,
"height": 70 "height": 50
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -1357,8 +1357,8 @@ ...@@ -1357,8 +1357,8 @@
"__type__": "TypedArray", "__type__": "TypedArray",
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0.435, -1.579,
-1.306, 19.664,
0, 0,
0, 0,
0, 0,
...@@ -1425,113 +1425,6 @@ ...@@ -1425,113 +1425,6 @@
"fileId": "60grmEaEVCx7SsKEadDwBA", "fileId": "60grmEaEVCx7SsKEadDwBA",
"sync": false "sync": false
}, },
{
"__type__": "cc.Node",
"_name": "icon_hand_old",
"_objFlags": 0,
"_parent": {
"__id__": 32
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 40
}
],
"_prefab": {
"__id__": 41
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 69,
"height": 78
},
"_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__": 39
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "562deefd-c9fd-42f0-97d7-d6f5893ef3f3"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "2ce7d58d-b6fe-4ef7-a128-de76f672a803"
},
"fileId": "b6EBayLo9DCrkpa2CYD+lG",
"sync": false
},
{ {
"__type__": "cc.Animation", "__type__": "cc.Animation",
"_name": "", "_name": "",
...@@ -1539,7 +1432,7 @@ ...@@ -1539,7 +1432,7 @@
"node": { "node": {
"__id__": 32 "__id__": 32
}, },
"_enabled": true, "_enabled": false,
"_defaultClip": { "_defaultClip": {
"__uuid__": "110d5a6d-4d4e-4a04-bed2-4bb56c56d03d" "__uuid__": "110d5a6d-4d4e-4a04-bed2-4bb56c56d03d"
}, },
...@@ -1578,6 +1471,16 @@ ...@@ -1578,6 +1471,16 @@
"_originalHeight": 0, "_originalHeight": 0,
"_id": "" "_id": ""
}, },
{
"__type__": "d7912kM6VxIgoOHkOzKc7g4",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
},
"_enabled": true,
"_id": ""
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
...@@ -1604,7 +1507,10 @@ ...@@ -1604,7 +1507,10 @@
"__id__": 4 "__id__": 4
}, },
"handAnim": { "handAnim": {
"__id__": 42 "__id__": 39
},
"hand": {
"__id__": 32
}, },
"sprite": { "sprite": {
"__id__": 12 "__id__": 12
......
This diff is collapsed.
...@@ -112,7 +112,7 @@ cc.Class({ ...@@ -112,7 +112,7 @@ cc.Class({
}, },
getDefaultData() { getDefaultData() {
const dataJson = ' [{"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/a962378295f3deb54e9f9329d59aa909.jpg","rect":{"x":298.4,"y":0,"width":1058.19,"height":615}},"hotZoneItemArr":[{"id":"1634813643232","index":0,"audio_url":"http://staging-teach.cdn.ireadabc.com/0b42398a12e1b2f075e9965e4d608765.mp3","itemType":"rect","fontScale":1.29296875,"imgScale":1,"mapScale":1.29296875,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":75.1,"y":310.5,"width":200,"height":200}},{"id":"1634813702995","index":1,"audio_url":"http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8.mp3","itemType":"rect","fontScale":1.29296875,"imgScale":1,"mapScale":1.29296875,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":340.1,"y":281.5,"width":200,"height":200}},{"id":"1634813712642","index":2,"audio_url":"http://staging-teach.cdn.ireadabc.com/784cd4188bf126d6c3c9395d9a807619.mp3","itemType":"rect","fontScale":1.29296875,"imgScale":1,"mapScale":1.29296875,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":544.11,"y":323.5,"width":200,"height":200}}]},{"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/281406244e10356325f075522f016ceb.jpg","rect":{"x":288.4,"y":0,"width":1058.19,"height":615}},"hotZoneItemArr":[{"id":"1634813750668","index":0,"audio_url":"http://staging-teach.cdn.ireadabc.com/ec19a2c73ec4fca0bf0458c74381a702.mp3","itemType":"rect","fontScale":1.27734375,"imgScale":1,"mapScale":1.27734375,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":439.6,"y":289,"width":69,"height":69}},{"id":"1634813772152","index":1,"audio_url":"http://staging-teach.cdn.ireadabc.com/0e67aa701df18cbb5581ffb81ffa7836.mp3","itemType":"rect","fontScale":1.27734375,"imgScale":1,"mapScale":1.27734375,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":545.61,"y":275,"width":59,"height":59}},{"id":"1634813784384","index":2,"audio_url":"http://staging-teach.cdn.ireadabc.com/4c0379bc0f3bd0722874b2e11fb35336.mp3","itemType":"rect","fontScale":1.27734375,"imgScale":1,"mapScale":1.27734375,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":619.61,"y":258,"width":57,"height":57}},{"id":"1634813800497","index":3,"audio_url":"http://staging-teach.cdn.ireadabc.com/fe226bc303f03ea994cb9a93d1620284.mp3","itemType":"rect","fontScale":1.27734375,"imgScale":1,"mapScale":1.27734375,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":710.61,"y":236,"width":51,"height":51}}]},{"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/562f741288227a9a36a7ce63a152278e.jpg","rect":{"x":288.4,"y":0,"width":1058.19,"height":615}},"hotZoneItemArr":[{"id":"1634813836558","index":0,"audio_url":"http://staging-teach.cdn.ireadabc.com/7c1d1540233b6d050eae8215679104a8.mp3","itemType":"rect","fontScale":1.27734375,"imgScale":1,"mapScale":1.27734375,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":9.6,"y":305,"width":69,"height":69}},{"id":"1634813857964","index":1,"audio_url":"http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3","itemType":"rect","fontScale":1.27734375,"imgScale":1,"mapScale":1.27734375,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":115.6,"y":303,"width":67,"height":67}},{"id":"1634813868736","index":2,"audio_url":"http://staging-teach.cdn.ireadabc.com/3d0fea61d5d97f3caf04a9b738a0291b.mp3","itemType":"rect","fontScale":1.27734375,"imgScale":1,"mapScale":1.27734375,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":209.6,"y":290,"width":65,"height":65}}]}]' const dataJson = ' [{"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/a962378295f3deb54e9f9329d59aa909.jpg","rect":{"x":427.1,"y":0,"width":1534.81,"height":892}},"hotZoneItemArr":[{"id":"1634813643232","index":0,"audio_url":"http://staging-teach.cdn.ireadabc.com/0b42398a12e1b2f075e9965e4d608765.mp3","itemType":"rect","fontScale":1.86640625,"imgScale":1,"mapScale":1.86640625,"gIdx":"0","useHand":true,"useBorder":true,"rect":{"x":108.92,"y":450.35,"width":290.08,"height":290.08}},{"id":"1634813702995","index":1,"itemType":"rect","fontScale":1.86640625,"imgScale":1,"mapScale":1.86640625,"gIdx":"0","useHand":true,"useBorder":true,"rect":{"x":493.28,"y":408.29,"width":290.08,"height":290.08}},{"id":"1634813712642","index":2,"audio_url":"http://staging-teach.cdn.ireadabc.com/784cd4188bf126d6c3c9395d9a807619.mp3","itemType":"rect","fontScale":1.86640625,"imgScale":1,"mapScale":1.86640625,"gIdx":"0","useHand":true,"useBorder":true,"rect":{"x":789.18,"y":469.21,"width":290.08,"height":290.08}}]},{"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/281406244e10356325f075522f016ceb.jpg","rect":{"x":427.1,"y":0,"width":1534.81,"height":892}},"hotZoneItemArr":[{"id":"1634813750668","index":0,"itemType":"rect","fontScale":1.86640625,"imgScale":1,"mapScale":1.86640625,"gIdx":"0","useHand":true,"useBorder":true,"rect":{"x":637.6,"y":419.17,"width":100.08,"height":100.08}},{"id":"1634813772152","index":1,"itemType":"rect","fontScale":1.86640625,"imgScale":1,"mapScale":1.86640625,"gIdx":"0","useHand":true,"useBorder":true,"rect":{"x":791.35,"y":398.86,"width":85.57,"height":85.57}},{"id":"1634813784384","index":2,"itemType":"rect","fontScale":1.86640625,"imgScale":1,"mapScale":1.86640625,"gIdx":"0","useHand":true,"useBorder":true,"rect":{"x":898.68,"y":374.21,"width":82.67,"height":82.67}},{"id":"1634813800497","index":3,"itemType":"rect","fontScale":1.86640625,"imgScale":1,"mapScale":1.86640625,"gIdx":"0","useHand":true,"useBorder":true,"rect":{"x":1030.67,"y":342.3,"width":73.97,"height":73.97}}]},{"bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/562f741288227a9a36a7ce63a152278e.jpg","rect":{"x":288.4,"y":0,"width":1058.19,"height":615}},"hotZoneItemArr":[{"id":"1634813836558","index":0,"audio_url":"http://staging-teach.cdn.ireadabc.com/7c1d1540233b6d050eae8215679104a8.mp3","itemType":"rect","fontScale":1.27734375,"imgScale":1,"mapScale":1.27734375,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":9.6,"y":305,"width":69,"height":69}},{"id":"1634813857964","index":1,"audio_url":"http://staging-teach.cdn.ireadabc.com/495324991838775e49e3ca6593d432c9.mp3","itemType":"rect","fontScale":1.27734375,"imgScale":1,"mapScale":1.27734375,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":115.6,"y":303,"width":67,"height":67}},{"id":"1634813868736","index":2,"audio_url":"http://staging-teach.cdn.ireadabc.com/3d0fea61d5d97f3caf04a9b738a0291b.mp3","itemType":"rect","fontScale":1.27734375,"imgScale":1,"mapScale":1.27734375,"gIdx":"1","useHand":true,"useBorder":true,"rect":{"x":209.6,"y":290,"width":65,"height":65}}]}]'
const data = JSON.parse(dataJson); const data = JSON.parse(dataJson);
return data; return data;
}, },
...@@ -238,6 +238,7 @@ cc.Class({ ...@@ -238,6 +238,7 @@ cc.Class({
return; return;
} }
this.curPage -= 1 this.curPage -= 1
if (this.curPage < 0) this.curPage = 2;
if (this.curPage == 0) { if (this.curPage == 0) {
this.leftNode.active = false this.leftNode.active = false
} }
...@@ -326,6 +327,14 @@ cc.Class({ ...@@ -326,6 +327,14 @@ cc.Class({
console.log('数据错误') console.log('数据错误')
return return
} }
let isAllNotAudio = data.hotZoneItemArr.every(dt => {
return !!!dt.audio_url
})
if (isAllNotAudio) {
this.btn_audio.active = false;
} else {
this.btn_audio.active = true;
}
picNode.getComponent('picNode').initWithData(data) picNode.getComponent('picNode').initWithData(data)
}, },
......
...@@ -7,6 +7,7 @@ cc.Class({ ...@@ -7,6 +7,7 @@ cc.Class({
quan: cc.Node, quan: cc.Node,
tipsAnim: cc.Animation, tipsAnim: cc.Animation,
handAnim: cc.Animation, handAnim: cc.Animation,
hand: cc.Node,
sprite: cc.Sprite, sprite: cc.Sprite,
tipClip: cc.AudioClip, tipClip: cc.AudioClip,
btnX: cc.Node, btnX: cc.Node,
...@@ -22,7 +23,7 @@ cc.Class({ ...@@ -22,7 +23,7 @@ cc.Class({
this._playing = false this._playing = false
this.quan.active = false this.quan.active = false
this.tipsAnim.node.active = false this.tipsAnim.node.active = false
this.handAnim.node.active = false this.hand.active = false
// this.btnX.active = false // this.btnX.active = false
this.icon_stop.active = false this.icon_stop.active = false
}, },
...@@ -44,8 +45,8 @@ cc.Class({ ...@@ -44,8 +45,8 @@ cc.Class({
this.node.height = rect.height / scale this.node.height = rect.height / scale
this.sprite.node.active = false this.sprite.node.active = false
if (data.useHand) { if (data.useHand) {
this.handAnim.node.active = true this.hand.active = true
this.handAnim.play() this.hand.getComponent("btn_rotate").play()
} }
let comps = this.getComponentsInChildren(cc.Widget) let comps = this.getComponentsInChildren(cc.Widget)
for (let one of comps) { for (let one of comps) {
...@@ -56,6 +57,14 @@ cc.Class({ ...@@ -56,6 +57,14 @@ cc.Class({
onTouchStart() { onTouchStart() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!this.data.audio_url) {
this.hand.active = false
this.stopAudio();
if (this.data.useBorder) {
this.quan.active = true
}
return;
}
if (this._playing || this.audioId) { if (this._playing || this.audioId) {
//增加暂停功能。 //增加暂停功能。
this._playing = false; this._playing = false;
...@@ -64,6 +73,7 @@ cc.Class({ ...@@ -64,6 +73,7 @@ cc.Class({
this.icon_stop.active = false; this.icon_stop.active = false;
if (!this.audioId) return; if (!this.audioId) return;
cc.audioEngine.stop(this.audioId); cc.audioEngine.stop(this.audioId);
this.audioId = null;
return return
} }
if (this.data) { if (this.data) {
...@@ -82,30 +92,30 @@ cc.Class({ ...@@ -82,30 +92,30 @@ cc.Class({
if (this.data.useBorder) { if (this.data.useBorder) {
this.quan.active = true this.quan.active = true
} }
this.handAnim.stop() this.hand.getComponent("btn_rotate").stop()
this.handAnim.node.active = false this.hand.active = false
// if (onlyOne && onlyOne != this) {
// onlyOne.hideBox()
// }
onlyOne = this
if (!this._playing) { if (!this._playing) {
this._playing = true this._playing = true
cc.systemEvent.once('stopMusic', this.onStopAudio, this) cc.systemEvent.once('stopMusic', this.onStopAudio, this)
let id = cc.audioEngine.play(this.tipClip) // let id = cc.audioEngine.play(this.tipClip)
cc.audioEngine.setFinishCallback(id, () => { // cc.audioEngine.setFinishCallback(id, () => {
if (onlyOne != this) { if (onlyOne != this) {
this._playing = false this._playing = false
return return
} }
let url = this.data.audio_url let url = this.data.audio_url
if (url && url != '') { if (url && url != '') {
this.playAudio(url) this.playAudio(url)
} else { } else {
this._playing = false this._playing = false
} }
}) // })
} }
if (onlyOne && onlyOne != this) {
onlyOne.hideBox()
}
onlyOne = this
} }
if (this.timer) clearInterval(this.timer); if (this.timer) clearInterval(this.timer);
this.timer = setInterval(() => { this.timer = setInterval(() => {
......
// 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: {
// 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() {
this.node;
},
play() {
let action = cc.repeatForever(cc.sequence(
cc.rotateTo(0.1, -5),
cc.rotateTo(0.1, 0),
cc.rotateTo(0.1, 5),
cc.rotateTo(0.1, 0),
cc.rotateTo(0.1, -5),
cc.rotateTo(0.1, 0),
cc.rotateTo(0.1, 5),
cc.rotateTo(0.1, 0),
cc.rotateTo(0.1, 0),
cc.rotateTo(0.1, 0),
cc.rotateTo(0.1, 0),
cc.rotateTo(0.1, 0)
));
this.node.runAction(action);
},
stop() {
this.node.stopAllActions();
},
start() {
},
update(dt) { },
});
{
"ver": "1.0.8",
"uuid": "d791290c-e95c-4882-8387-90ecca73b838",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
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