Commit eb692f80 authored by Tt's avatar Tt

移动待调试

parent f9410400
......@@ -23,7 +23,9 @@ export default class ImgAuto extends cc.Component {
}
private playVoiceCount: number;
playVoiceStart() {
if (this.playVoiceCount > 0) return;
if (this.playVoiceCount > 0){
this.playVoiceEnd();
}
this.playVoiceCount = 0;
this.schedule(this.playVoiceRunning, 0.3)
}
......
This diff is collapsed.
......@@ -90,7 +90,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
initListener() {
pg.view.touchOn(this.btn_last, this.preLayer, this);
pg.view.touchOn(this.btn_next, this.nextLayer, this);
pg.view.touchOn(this.btn_voice, this.onTouchVoice, this);
pg.view.touchOn(this.btn_record, this.onTouchRecord, this);
pg.view.touchOn(this.ani_npc, this.onPlayNpc, this);
......@@ -136,11 +135,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.touchForbid = true;
this.voiceTouchForbid = true;
let currentLayer = this.createLayer();
this.updateLayer(currentLayer, this.CurrentData)
this.updateLayer(currentLayer, this.CurrentData, this.count)
this.layers.push(currentLayer)
if (!this.NextData) return;
let nextLayer = this.createLittleLayer();
this.updateLayer(nextLayer, this.NextData)
this.updateLayer(nextLayer, this.NextData, this.count + 1)
this.layers.push(nextLayer)
}
startGame() {
......@@ -153,7 +152,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.recordAudio = "";
this.label_word.active = false;
this.touchForbid = true;
let com = this.btn_voice.getComponent(ImgAuto);
let btn_voice = pg.view.find(this.CurrentLayer, 'btn_voice')
let com = btn_voice.getComponent(ImgAuto);
com.playVoiceStart();
pg.audio.playAudioByUrl(this.CurrentData.audio, () => {
this.currentAudioId = null;
......@@ -167,9 +167,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
private showLastNext: number;
updateBtns(dt) {
if (this.CurrentData) {
pg.view.setString(this.label_round, `${this.count + 1}/${this.list.length}`);
}
this.showLastNext -= dt;
this.btn_last.active = this.showLastNext > 0 && !!this.LastData;
this.btn_next.active = this.showLastNext > 0 && !!this.NextData;
......@@ -446,7 +443,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 停止当前所有动作
if (this.OutData && !this.OutLayer) {
let outLayer = this.createLittleLayer();
this.updateLayer(outLayer, this.OutData)
this.updateLayer(outLayer, this.OutData, this.count + 2)
outLayer.x = 3500;
this.layers.push(outLayer)
}
......@@ -523,18 +520,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
return layer;
}
@property(cc.Node)
public label_round: cc.Node = null;
@property(cc.Node)
public btn_last: cc.Node = null;
@property(cc.Node)
public btn_next: cc.Node = null;
@property(cc.Node)
public btn_voice: cc.Node = null;
updateLayer(layer, data) {
updateLayer(layer, data, i) {
if (!layer || !data) return;
// 根据数据来渲染
let label_round = pg.view.find(layer, 'label_round')
let itemBg1 = pg.view.find(layer, 'bg_1')
let itemBg2 = pg.view.find(layer, 'bg_2')
let itemBg3 = pg.view.find(layer, 'bg_3')
......@@ -558,10 +552,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
img.active = true;
pg.view.setNetImg(img, data.image, { w: wh[0], h: wh[1] })
pg.view.setString(label_round, `${i + 1}/${this.list.length}`);
pg.view.touchOn(pg.view.find(layer, "btn_voice"), this.onTouchVoice, this);
}
onTouchVoice(e) {
console.log(this.voiceTouchForbid)
if (this.voiceTouchForbid) return;
let com = this.btn_voice.getComponent(ImgAuto);
let btn_voice = e.target;
let com = btn_voice.getComponent(ImgAuto);
com.playVoiceStart();
pg.audio.playAudioByUrl(this.CurrentData.audio, () => {
com.playVoiceEnd();
......
export const defaultData =
// {
// "recordFlag": 2,
// "title": "test",
// "questionText": "",
// "questionTextAudio": "",
// "questions": [
// {
// "questionAudio": "",
// "duration": 120,
// "options": [
// {
// "type": "img_txt_audio",
// "image": "http://staging-teach.cdn.ireadabc.com/cadf4f62024a1e932aa8c108de0d0a27.jpg",
// "audio": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610_l.mp3",
// "text": "This is Annie's apple tree?",
// "duration": 5,
// "content": "yes,It is Annie's apple tree.",
// "right": false,
// "imageBig": 3,
// "audioName": "btn_hy01_danci.mp3",
// npcAudio: "http://staging-teach.cdn.ireadabc.com/7f617b30a5eb2a090234920500f9c7ce_l.mp3",
// npcAudioName: "right_sn17_danci.mp3"
// }, {
// "type": "img_txt_audio",
// "image": "http://staging-teach.cdn.ireadabc.com/befdc1801d93fd95b3a8ee7c7a2d2d05.png", "audio": "http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3", "text": "clound in air", "duration": 10,
// "content": "clound is cloud", "right": false, "audioName": "敲碎蛋的声音.mp3", "imageBig": 2,
// npcAudio: "http://staging-teach.cdn.ireadabc.com/7f617b30a5eb2a090234920500f9c7ce_l.mp3",
// npcAudioName: "right_sn17_danci.mp3"
// }, {
// "type": "img_txt_audio", "imageBig": 1, "image": "http://staging-teach.cdn.ireadabc.com/ef1e6f871b37ad482e268809e91d20b7.png", "audio": "http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3", "text": "", "duration": 10, "content": "", "right": false, "audioName": "excellent_dg10_ty.mp3"
// }]
// }],
// "bgAudio": "", "bgAudioName": "", "audioName": "", "npcTitle": "test",
// "npcAudio": "http://staging-teach.cdn.ireadabc.com/fd75d456ec85f8c90ffd03f1d9d8d10f_l.mp3", "npcAudioName": "tryagain_dg10_ty.mp3", "word_count": "20", "sentence_count": "11", "zi_count": "33"
// }
{
"recordFlag": "3",
"npcTitle": "一问一答",
"npcAudio": "http://staging-teach.cdn.ireadabc.com/b6a1ee625d8298a757e8d78bf50352ab_l.mp3",
"npcAudioName": "a apple.mp3",
"recordFlag": 2,
"title": "test",
"questionText": "",
"questionTextAudio": "",
"questions": [
......@@ -48,24 +11,61 @@ export const defaultData =
"options": [
{
"type": "img_txt_audio",
"imageBig": 1,
"image": "http://staging-teach.cdn.ireadabc.com/6d78cd31a6d72ad30db6da53ddad47c6.jpeg",
"audio": "http://staging-teach.cdn.ireadabc.com/45f046740d0172760c854babde438355_l.mp3",
"text": "",
"duration": "",
"content": "",
"image": "http://staging-teach.cdn.ireadabc.com/cadf4f62024a1e932aa8c108de0d0a27.jpg",
"audio": "http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610_l.mp3",
"text": "This is Annie's apple tree?",
"duration": 5,
"content": "yes,It is Annie's apple tree.",
"right": false,
"audioName": "a alligator.mp3",
"npcAudio": "http://staging-teach.cdn.ireadabc.com/651907aeee4b61ed893657c9fd8fd83d_l.mp3",
"npcAudioName": "What festival are they having?.mp3"
}
]
}
],
"bgAudio": "",
"bgAudioName": "",
"word_count": "0",
"sentence_count": "0",
"zi_count": "0",
"audioName": ""
}
\ No newline at end of file
"imageBig": 3,
"audioName": "btn_hy01_danci.mp3",
npcAudio: "http://staging-teach.cdn.ireadabc.com/7f617b30a5eb2a090234920500f9c7ce_l.mp3",
npcAudioName: "right_sn17_danci.mp3"
}, {
"type": "img_txt_audio",
"image": "http://staging-teach.cdn.ireadabc.com/befdc1801d93fd95b3a8ee7c7a2d2d05.png", "audio": "http://staging-teach.cdn.ireadabc.com/43839adb578c7e01456748b8a176a0c3_l.mp3", "text": "clound in air", "duration": 10,
"content": "clound is cloud", "right": false, "audioName": "敲碎蛋的声音.mp3", "imageBig": 2,
npcAudio: "http://staging-teach.cdn.ireadabc.com/7f617b30a5eb2a090234920500f9c7ce_l.mp3",
npcAudioName: "right_sn17_danci.mp3"
}, {
"type": "img_txt_audio", "imageBig": 1, "image": "http://staging-teach.cdn.ireadabc.com/ef1e6f871b37ad482e268809e91d20b7.png", "audio": "http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3", "text": "", "duration": 10, "content": "", "right": false, "audioName": "excellent_dg10_ty.mp3"
}]
}],
"bgAudio": "", "bgAudioName": "", "audioName": "", "npcTitle": "test",
"npcAudio": "http://staging-teach.cdn.ireadabc.com/fd75d456ec85f8c90ffd03f1d9d8d10f_l.mp3", "npcAudioName": "tryagain_dg10_ty.mp3", "word_count": "20", "sentence_count": "11", "zi_count": "33"
}
// {
// "recordFlag": "3",
// "npcTitle": "一问一答",
// "npcAudio": "http://staging-teach.cdn.ireadabc.com/b6a1ee625d8298a757e8d78bf50352ab_l.mp3",
// "npcAudioName": "a apple.mp3",
// "questionText": "",
// "questionTextAudio": "",
// "questions": [
// {
// "questionAudio": "",
// "duration": 120,
// "options": [
// {
// "type": "img_txt_audio",
// "imageBig": 1,
// "image": "http://staging-teach.cdn.ireadabc.com/6d78cd31a6d72ad30db6da53ddad47c6.jpeg",
// "audio": "http://staging-teach.cdn.ireadabc.com/45f046740d0172760c854babde438355_l.mp3",
// "text": "",
// "duration": "",
// "content": "",
// "right": false,
// "audioName": "a alligator.mp3",
// "npcAudio": "http://staging-teach.cdn.ireadabc.com/651907aeee4b61ed893657c9fd8fd83d_l.mp3",
// "npcAudioName": "What festival are they having?.mp3"
// }
// ]
// }
// ],
// "bgAudio": "",
// "bgAudioName": "",
// "word_count": "0",
// "sentence_count": "0",
// "zi_count": "0",
// "audioName": ""
// }
\ 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