Commit 0ad8a900 authored by Chen Jiping's avatar Chen Jiping

feat:调整业务逻辑

parent e6f0384c
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="2" nzFor="guideAudioUrl1">CC引导音频1</nz-form-label> <nz-form-label [nzSpan]="2" nzFor="guideAudioUrl1">开始音频</nz-form-label>
<nz-form-control [nzSpan]="4"> <nz-form-control [nzSpan]="4">
<app-audio-recorder [audioUrl]="item.guideAudioUrl1" id="guideAudioUrl1" <app-audio-recorder [audioUrl]="item.guideAudioUrl1" id="guideAudioUrl1"
(audioUploaded)="onAudioUploadSuccess($event, item, 'guideAudioUrl1')"> (audioUploaded)="onAudioUploadSuccess($event, item, 'guideAudioUrl1')">
...@@ -24,23 +24,21 @@ ...@@ -24,23 +24,21 @@
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="2" nzFor="guideAudioUrl2">CC引导音频2</nz-form-label> <nz-form-label [nzSpan]="2" nzFor="guideAudioUrl2">待机音频</nz-form-label>
<nz-form-control [nzSpan]="4"> <nz-form-control [nzSpan]="4">
<app-audio-recorder [audioUrl]="item.guideAudioUrl2" id="guideAudioUrl2" <app-audio-recorder [audioUrl]="item.guideAudioUrl2" id="guideAudioUrl2"
(audioUploaded)="onAudioUploadSuccess($event, item, 'guideAudioUrl2')"> (audioUploaded)="onAudioUploadSuccess($event, item, 'guideAudioUrl2')">
</app-audio-recorder> </app-audio-recorder>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<!--
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="2" nzFor="guideAudioUrl3">CC引导音频3</nz-form-label> <nz-form-label [nzSpan]="2" nzFor="guideAudioUrl3">结束音频</nz-form-label>
<nz-form-control [nzSpan]="4"> <nz-form-control [nzSpan]="4">
<app-audio-recorder [audioUrl]="item.guideAudioUrl3" id="guideAudioUrl3" <app-audio-recorder [audioUrl]="item.guideAudioUrl3" id="guideAudioUrl3"
(audioUploaded)="onAudioUploadSuccess($event, item, 'guideAudioUrl3')"> (audioUploaded)="onAudioUploadSuccess($event, item, 'guideAudioUrl3')">
</app-audio-recorder> </app-audio-recorder>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
-->
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="2">图片</nz-form-label> <nz-form-label [nzSpan]="2">图片</nz-form-label>
<nz-form-control [nzSpan]="4"> <nz-form-control [nzSpan]="4">
...@@ -49,6 +47,14 @@ ...@@ -49,6 +47,14 @@
</app-upload-image-with-preview> </app-upload-image-with-preview>
</nz-form-control> </nz-form-control>
</nz-form-item> </nz-form-item>
<nz-form-item>
<nz-form-label [nzSpan]="2">图片音频</nz-form-label>
<nz-form-control [nzSpan]="4">
<app-audio-recorder [audioUrl]="item.audioUrl"
(audioUploaded)="onAudioUploadSuccess($event, item, 'audioUrl')">
</app-audio-recorder>
</nz-form-control>
</nz-form-item>
<nz-form-item> <nz-form-item>
<nz-form-label [nzSpan]="2" nzFor="add-btn">字母添加</nz-form-label> <nz-form-label [nzSpan]="2" nzFor="add-btn">字母添加</nz-form-label>
<nz-form-control [nzSpan]="4"> <nz-form-control [nzSpan]="4">
......
...@@ -86,14 +86,14 @@ ...@@ -86,14 +86,14 @@
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 67
},
{ {
"__id__": 68 "__id__": 68
}, },
{ {
"__id__": 69 "__id__": 69
},
{
"__id__": 70
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2825,7 +2825,7 @@ ...@@ -2825,7 +2825,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 66 "__id__": 67
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2891,7 +2891,7 @@ ...@@ -2891,7 +2891,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 65 "__id__": 66
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2949,11 +2949,15 @@ ...@@ -2949,11 +2949,15 @@
"_parent": { "_parent": {
"__id__": 62 "__id__": 62
}, },
"_children": [], "_children": [
{
"__id__": 64
}
],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 64 "__id__": 65
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3004,6 +3008,64 @@ ...@@ -3004,6 +3008,64 @@
"groupIndex": 0, "groupIndex": 0,
"_id": "39olKLQahPUIkTaY3Gn6UZ" "_id": "39olKLQahPUIkTaY3Gn6UZ"
}, },
{
"__type__": "cc.Node",
"_name": "ClickBtn",
"_objFlags": 0,
"_parent": {
"__id__": 63
},
"_children": [],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 350,
"height": 480
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
900.811,
-518.548,
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": "85fMvCft1LxJiRiRsEWxOy"
},
{ {
"__type__": "dragonBones.ArmatureDisplay", "__type__": "dragonBones.ArmatureDisplay",
"_name": "", "_name": "",
......
...@@ -123,6 +123,7 @@ cc.Class({ ...@@ -123,6 +123,7 @@ cc.Class({
this._audioResList.push({ url: this.data.guideAudioUrl1 }); this._audioResList.push({ url: this.data.guideAudioUrl1 });
this._audioResList.push({ url: this.data.guideAudioUrl2 }); this._audioResList.push({ url: this.data.guideAudioUrl2 });
this._audioResList.push({ url: this.data.guideAudioUrl3 }); this._audioResList.push({ url: this.data.guideAudioUrl3 });
this._audioResList.push({ url: this.data.audioUrl });
} }
...@@ -213,11 +214,13 @@ cc.Class({ ...@@ -213,11 +214,13 @@ cc.Class({
handNode.initY = handNode.y; handNode.initY = handNode.y;
this._cantouch = false;
//播放动车 //播放动车
this.playAni('begin', 0); this.playAni('begin', 0);
const begin = () => { const begin = () => {
this.playAni('normal', 0); this.playAni('begin', 0);
this._cantouch = true; this._cantouch = true;
...@@ -306,6 +309,7 @@ cc.Class({ ...@@ -306,6 +309,7 @@ cc.Class({
}, },
_curIndex: null, _curIndex: null,
_canClickWord: null,
initPic() { initPic() {
let exercises = this.data.exercises; let exercises = this.data.exercises;
...@@ -339,6 +343,34 @@ cc.Class({ ...@@ -339,6 +343,34 @@ cc.Class({
let label = this.getWord(initial, 700, true); let label = this.getWord(initial, 700, true);
label.isInitial = true; label.isInitial = true;
wordNodeArr.push(label); wordNodeArr.push(label);
label.addComponent(cc.Button);
label.on('click', () => {
if(!this._canClickWord){
return;
}
if (!this._cantouch) {
return;
}
//设置不可点击
this._cantouch = false;
const state = this.playAni('begin', 0);
//播放音频
this.playAudioByUrl(wordArr[i].audioUrl, ()=>{
this._cantouch = true;
state.stop();
this.playAni('normal', 0);
})
//显示文本动画
this.textTwinkle(label);
})
//其余字母 //其余字母
let last = wordArr[i].val.substr(1); let last = wordArr[i].val.substr(1);
...@@ -391,10 +423,100 @@ cc.Class({ ...@@ -391,10 +423,100 @@ cc.Class({
this._curIndex = 0; this._curIndex = 0;
}, },
_canClickCat: null,
_showStandby: null,
initBtn() { initBtn() {
const catBtn = cc.find('Canvas/Main Camera/catFrame/cat/ClickBtn');
catBtn.addComponent(cc.Button);
catBtn.on('click', () => {
if(!this._cantouch){
return;
}
if(!this._canClickCat){
return;
}
if(this._showStandby){
return;
}
this._showStandby = true;
//播放待机音频
if(this.data.guideAudioUrl2){
const state = this.playAni('begin', 0);
//播放完成,停止动画
this.playAudioByUrl(this.data.guideAudioUrl2, () => {
state.stop();
this._showStandby = false;
this.playAni('normal', 0);
});
}
else{
this.playAni('begin', 1, () => {
this._showStandby = false;
});
}
});
const picNode = cc.find("Canvas/content/bg_green/pic");
picNode.addComponent(cc.Button);
picNode.on('click', () => {
if(!this._cantouch){
return;
}
this._cantouch = false;
let rotation = picNode.angle;
let times = 1;
const rota = () => {
cc.tween(picNode)
.to(0.3, { angle: rotation - 15 })
.to(0.3, { angle: rotation })
.to(0.3, { angle: rotation + 15 })
.to(0.3, { angle: rotation })
.call(() => {
if(times > 2){
this._cantouch = true;
return;
}
times += 1;
rota();
})
.start();
}
console.log("click pic...");
if(this.data.audioUrl){
const state = this.playAni('begin', 0);
this.playAudioByUrl(this.data.audioUrl, ()=>{
state.stop();
//播放待机
this.playAni("normal", 0);
});
}
rota();
});
}, },
getWord(wordVal, size, isInitial) { getWord(wordVal, size, isInitial) {
...@@ -443,13 +565,29 @@ cc.Class({ ...@@ -443,13 +565,29 @@ cc.Class({
}, },
playAni(name, times = 1) { catAniState: null,
playAni(name, times = 1, cb = null) {
if(this.catAniState && this.catAniState.name != name)
{
this.catAniState.stop();
}
const cat = cc.find('Canvas/Main Camera/catFrame/cat'); const cat = cc.find('Canvas/Main Camera/catFrame/cat');
var dragonDisplay = cat.getComponent(dragonBones.ArmatureDisplay); var dragonDisplay = cat.getComponent(dragonBones.ArmatureDisplay);
const state = dragonDisplay.playAnimation(name, times); const state = dragonDisplay.playAnimation(name, times);
dragonDisplay.on(dragonBones.EventObject.COMPLETE, () => {
tip.active = false;
if (cb) {
cb();
}
})
this.catAniState = state;
return state; return state;
}, },
...@@ -572,6 +710,7 @@ cc.Class({ ...@@ -572,6 +710,7 @@ cc.Class({
console.log(' in showEnd'); console.log(' in showEnd');
if (this._shown) { if (this._shown) {
this._cantouch = true;
return; return;
} }
...@@ -582,15 +721,20 @@ cc.Class({ ...@@ -582,15 +721,20 @@ cc.Class({
this._stop = true; this._stop = true;
//播放动画 //播放动画
const state = this.playAni('begin', 0); const state = this.playAni('finish', 0);
//播放引导音频2 //播放结束音频
this.playAudioByUrl(this.data.guideAudioUrl2, () => { this.playAudioByUrl(this.data.guideAudioUrl3, () => {
state.stop(); state.stop();
this.playAni('normal', 0); this.playAni('normal', 0);
//设置可以点击字母
this._canClickWord = true;
this._cantouch = true;
this.showPhotoBtn(); this.showPhotoBtn();
}); });
...@@ -734,7 +878,7 @@ cc.Class({ ...@@ -734,7 +878,7 @@ cc.Class({
.to(0.5, { scale: node.initScale * 1.1 }) .to(0.5, { scale: node.initScale * 1.1 })
.to(0.5, { scale: node.initScale }) .to(0.5, { scale: node.initScale })
.call(() => { .call(() => {
this._cantouch = true;
this._curIndex++; this._curIndex++;
......
...@@ -44,6 +44,7 @@ export const defaultData = { ...@@ -44,6 +44,7 @@ export const defaultData = {
} }
} }
, ,
"audioUrl":"http://staging-teach.cdn.ireadabc.com/bbab99eb9f5fe3cbe2d24cf80594d8c9.mp3",
"guideAudioUrl1":"http://staging-teach.cdn.ireadabc.com/c3b83a24fd8f9b37ee72409cdb45e3f7.mp3", "guideAudioUrl1":"http://staging-teach.cdn.ireadabc.com/c3b83a24fd8f9b37ee72409cdb45e3f7.mp3",
"guideAudioUrl2":"http://staging-teach.cdn.ireadabc.com/9f6ff5d0617bf274ee2d9af4cfc93c62.mp3", "guideAudioUrl2":"http://staging-teach.cdn.ireadabc.com/9f6ff5d0617bf274ee2d9af4cfc93c62.mp3",
"guideAudioUrl3":"http://staging-teach.cdn.ireadabc.com/c3b83a24fd8f9b37ee72409cdb45e3f7.mp3" "guideAudioUrl3":"http://staging-teach.cdn.ireadabc.com/c3b83a24fd8f9b37ee72409cdb45e3f7.mp3"
......
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