Commit 4cba23aa authored by Tt's avatar Tt

流程走完待细节调整

parent 8ab7dab4
......@@ -3998,8 +3998,8 @@
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 0,
"b": 0,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
......@@ -4342,7 +4342,7 @@
"__id__": 98
}
],
"_active": true,
"_active": false,
"_components": [],
"_prefab": null,
"_opacity": 255,
......
......@@ -518,7 +518,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.setNetImg(image_text_image, data.image, { w: 240, h: 270 })
}
}
private currentData: any;
private currentDt: any;
private currentItem: any;
@property(cc.Node)
......@@ -547,7 +547,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
let item = e.target;
let data = item.data;
this.currentItem = item;
this.currentData = data;
this.currentDt = data;
this.touchForbid = true;
// 移动钩子过来 然后弹出面板
......@@ -567,44 +567,50 @@ export default class SceneComponent extends MyCocosSceneComponent {
private btn_close: cc.Node = null;
showRecord(item) {
this.layout_record.active = true;
// 卡片显示
let card = pg.view.find(this.layout_record, 'card')
this.updateCard(card, this.currentDt)
// 音频处理
let btn_voice = pg.view.find(this.layout_record, 'btn_voice')
btn_voice.data = this.currentDt;
// 展示待录音内容
// let btn_voice = pg.view.find(layer, "btn_voice");
// let normal = pg.view.find(btn_voice, 'normal')
// cc.tween(normal)
// .repeatForever(
// cc.tween()
// .to(0.7, { scale: 1.1 })
// .delay(0.3)
// .to(0.7, { scale: 1.00 })
// .delay(0.3)
// )
// .start();
let normal = pg.view.find(btn_voice, 'normal')
let ing = pg.view.find(btn_voice, 'ing')
pg.view.visible(normal, true)
pg.view.visible(ing, false)
cc.tween(normal)
.repeatForever(
cc.tween()
.to(0.2, { angle: -18 })
.to(0.2, { angle: 0 })
.to(0.2, { angle: 18 })
.to(0.2, { angle: 0 })
.to(0.2, { angle: -18 })
.to(0.2, { angle: 0 })
.to(0.2, { angle: 18 })
.to(0.2, { angle: 0 })
.to(0.2, { angle: -18 })
.to(0.2, { angle: 0 })
.to(0.2, { angle: 18 })
.to(0.2, { angle: 0 })
.delay(1)
)
.start();
// this.btn_voice_time_id = setTimeout(() => {
// if (!this.node || !this.node.parent) return;
// // 摇晃mic
// this.playLocalAudio("wait")
// cc.tween(normal).to(0.25, { angle: -15 }).to(0.25, { angle: 0 }).to(0.25, { angle: 15 }).to(0.25, { angle: 0 }).start();
// }, 3000);
pg.view.touchOn(btn_voice, this.onTouchCardRecord, this)
}
onTouchRecordClose() {
this.layout_record.active = false;
}
// 前后切换一共有
updateRecordBtns(layer) {
let btn_voice = pg.view.find(layer, "btn_voice");
let btn_play = pg.view.find(layer, "btn_play");
let recordData = layer.data.recordData;
if (recordData) {
btn_voice.x = -60;
pg.view.visible(btn_voice, true);
pg.view.visible(btn_play, true);
} else {
btn_voice.x = 0;
pg.view.visible(btn_voice, true);
pg.view.visible(btn_play, false);
}
}
// current 和 currentCard
btn_voice_time_id: any;
currentCard: cc.Node;
......@@ -617,25 +623,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
// 录音
let btn_voice = e.target;
let layer = btn_voice.parent;
let normal = pg.view.find(btn_voice, 'normal')
let ing = pg.view.find(btn_voice, 'ing')
this.playLocalAudio("touch_voice")
this.checkCardsTime = 999999;
hw.record.startTest(layer.data.text).then((isSuccess) => {
hw.record.startTest(this.currentDt.text).then((isSuccess) => {
if (!isSuccess) {
this.recording = false;
// 录音中
hw.record.endTest().then((recordData: any) => {
layer.data.recordData = recordData;
this.currentDt.recordData = recordData;
this.currentCard = null;
pg.view.visible(normal, true);
pg.view.visible(ing, false);
let ingBg = pg.view.find(ing, 'bg');
ingBg.getComponent(ImgAuto).playVoiceEnd();
this.updateRecordBtns(layer);
let score = recordData.result.overall
this.updatePopAni(layer, score);
this.updatePopAni(null, score);
this.checkCardsTime = 3;
})
} else {
......@@ -649,48 +653,39 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
private showFires: any;
updatePopAni(front, score) {
let btn_play = pg.view.find(front, 'btn_play')
let result = pg.view.find(btn_play, 'result')
// let btn_play = pg.view.find(front, 'btn_play')
// let result = pg.view.find(btn_play, 'result')
let layout_ani = pg.view.find(this, 'layout_ani')
layout_ani.active = true;
if (score >= 90) {
if (score >= 70) {
hw.log.d("非常棒")
front.data.isChose = "right"
pg.view.visible(pg.view.find(result, 'excellent'), true)
pg.view.visible(pg.view.find(result, 'good'), false)
pg.view.visible(pg.view.find(result, 'tryagain'), false)
let item = pg.view.find(layout_ani, 'JJ_Excellent_ske')
item.active = true;
pg.view.playDBAnimation(item, 'newAnimation', 1);
this.playLocalAudio("record_right")
} else if (score >= 60) {
hw.log.d("干的不错")
front.data.isChose = "right"
pg.view.visible(pg.view.find(result, 'excellent'), false)
pg.view.visible(pg.view.find(result, 'good'), true)
pg.view.visible(pg.view.find(result, 'tryagain'), false)
let item = pg.view.find(layout_ani, 'JJ_Good_ske')
item.active = true;
pg.view.playDBAnimation(item, 'newAnimation', 1);
this.playLocalAudio("record_right")
this.recordExcellent();
} else {
hw.log.d("再试一次吧")
front.data.isChose = "wrong"
pg.view.visible(pg.view.find(result, 'excellent'), false)
pg.view.visible(pg.view.find(result, 'good'), false)
pg.view.visible(pg.view.find(result, 'tryagain'), true)
let item = pg.view.find(layout_ani, 'JJ_Tryagain_ske')
item.active = true;
pg.view.playDBAnimation(item, 'better', 1);
this.playLocalAudio("record_wrong")
this.recordTryAgain();
}
}
recordExcellent() {
if (!this.showFires) this.showFires = {};
if (!this.showFires[`${this.count}`]) {
this.showFires[`${this.count}`] = true;
hw.util.playEndTrebleFirework();
}
this.onTouchRecordClose();
}
recordTryAgain() {
}
private currentPlayAudioId: any;
onTouchCardPlay(e) {
if (this.touchForbid) return;// 顶级禁止全部点击
......
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