Commit e5fd1484 authored by Tt's avatar Tt

上传修改内容

parent ae5fa172
This diff is collapsed.
......@@ -63,6 +63,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Node) question_img: cc.Node = null;
@property(cc.Node) label_title: cc.Node = null;
@property(cc.Node) btn_vioce: cc.Node = null;
@property(cc.Node) btn_vioce_ing: cc.Node = null;
@property(cc.Node) btn_restart: cc.Node = null;
@property(cc.Node) label_tip_wait: cc.Node = null;
@property(cc.Node) label_tip_ing: cc.Node = null;
......@@ -72,6 +73,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 初始化页面
initView() {
this.btn_vioce.active = false;
this.btn_vioce_ing.active = false;
this.btn_restart.active = false;
this.label_tip_wait.active = false;
this.label_tip_ing.active = false;
......@@ -83,7 +85,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.touchOn(this.btn_go, this.onTouchNext, this);
pg.view.touchOn(this.btn_restart, this.onTouchRestart, this);
pg.view.touchOn(this.btn_vioce, this.onTouchRecord, this);
pg.view.touchOn(pg.view.find(this.btn_vioce, 'img_ing'), this.onTouchRecordEnd, this);
pg.view.touchOn(this.btn_vioce_ing, this.onTouchRecordEnd, this);
}
// 初始化游戏
initGame() {
......@@ -110,8 +112,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.setString(this.label_title, this.currentQuestion.title);
this.btn_vioce.active = true;
pg.view.visible(pg.view.find(this.btn_vioce, 'img_ing'), false)
pg.view.visible(pg.view.find(this.btn_vioce, 'img_stop'), false)
pg.view.visible(this.btn_vioce_ing, false)
this.label_tip_wait.active = true;
// 展示下一题
......@@ -125,7 +126,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this._cantouch = false;
if (this.current == 0) {
this.xiaodi.playEnter(this.data.startAudio).then(() => {
this.xiaodi.playEnter(this.currentQuestion.startAudio).then(() => {
this._cantouch = true;
})
} else {
......@@ -158,9 +159,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.label_tip_wait.active = false
this.label_tip_ing.active = true;
pg.view.visible(pg.view.find(this.btn_vioce, 'img_ing'), true)
pg.view.visible(pg.view.find(this.btn_vioce, 'img_stop'), true)
let img_ing = pg.view.find(this.btn_vioce, 'img_ing')
pg.view.visible(this.btn_vioce_ing, true)
let img_ing = pg.view.find(this.btn_vioce_ing, 'img_ing')
img_ing.getComponent(cc.Sprite).fillRange = subTime / this.targetTime;
if (subTime == 0) {
this.onTouchRecordEnd();
......@@ -170,8 +170,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.startTime = null;
this.label_tip_wait.active = false
this.label_tip_ing.active = false;
pg.view.visible(pg.view.find(this.btn_vioce, 'img_ing'), false)
pg.view.visible(pg.view.find(this.btn_vioce, 'img_stop'), false)
pg.view.visible(this.btn_vioce_ing, false)
}
async onTouchRecord() {
if (!this._cantouch) return;
......@@ -188,6 +187,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
async onTouchRecordEnd() {
if (!this.recording) return;
this.recording = false;
this.showTimeEnd();
let testData = {
"text": "Hello every one my name is world",
......@@ -258,6 +258,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
})
}
onTouchNext() {
console.log('next')
if (this.recording) return;
if (!this.nextQuestion) {
pg.view.find(this, 'layout_game/img_question').active = false;
......@@ -305,11 +306,24 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.xiaodi.hideAll();
}
showVideoPlayer() {
@property(cc.Node) video_canvas: cc.Node = null;
hideVideoPlayer() {
this.layout_video.active = true;
this.videoPlayer.stayOnBottom = true;
this.videoPlayer.node.x = 0;
this.videoPlayer.node.y = 0;
this.videoPlayer.node.width = 100;
this.videoPlayer.node.height = 100;
}
showVideoPlayer() {
this.layout_video.active = true;
this.videoPlayer.stayOnBottom = true;
this.videoPlayer.node.x = this.video_canvas.x;
this.videoPlayer.node.y = this.video_canvas.y;
this.videoPlayer.node.width = this.video_canvas.width;
this.videoPlayer.node.height = this.video_canvas.height;
if (!this._isReadyToPlay) {
//首次播放
this._isReadyToPlay = false;
......
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