Commit 204feca6 authored by Tt's avatar Tt

hy04修改完成

parent 1d755afa
......@@ -11,6 +11,7 @@ const { ccclass, property } = cc._decorator;
export default class LayerBack extends cc.Component {
private btn_back: cc.Node;
private img_npc_voice: cc.Node;
private bg_forbid: cc.Node;
onLoad() {
this.initView();
this.initEvent();
......@@ -19,6 +20,7 @@ export default class LayerBack extends cc.Component {
initView() {
this.bg_forbid = pg.view.find(this, 'bg_forbid')
this.btn_back = pg.view.find(this, 'btn_back')
this.label_title = pg.view.find(this, 'label_title')
this.img_npc_voice = pg.view.find(this.label_title, 'img_npc_voice')
......@@ -38,6 +40,7 @@ export default class LayerBack extends cc.Component {
pg.event.on('npc_layer_back_init', (data) => {
this.updateView(data);
if (!this.npcAudio) {
pg.view.visible(this.bg_forbid, false)
pg.event.emit('npc_voice_play_voice_end');
} else {
this.playVoiceStart();
......@@ -55,6 +58,7 @@ export default class LayerBack extends cc.Component {
this.schedule(this.playVoiceRunning, 0.3)
pg.audio.playAudioByUrl(this.npcAudio, () => {
this.playVoiceEnd();
pg.view.visible(this.bg_forbid, false)
pg.event.emit('npc_voice_play_voice_end')
}, (audioId) => {
this.audioId = audioId;
......
......@@ -21,20 +21,23 @@
"__id__": 2
},
{
"__id__": 7
"__id__": 6
},
{
"__id__": 11
}
],
"_active": true,
"_components": [
{
"__id__": 22
"__id__": 27
},
{
"__id__": 23
"__id__": 28
}
],
"_prefab": {
"__id__": 24
"__id__": 29
},
"_opacity": 255,
"_color": {
......@@ -85,7 +88,7 @@
},
{
"__type__": "cc.Node",
"_name": "btn_back",
"_name": "bg_forbid",
"_objFlags": 0,
"_parent": {
"__id__": 1
......@@ -98,13 +101,128 @@
},
{
"__id__": 4
}
],
"_prefab": {
"__id__": 5
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1920,
"height": 1080
},
"_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.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.BlockInputEvents",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "0b87ca13-07e1-4237-ab3b-7f27c69deb2d"
},
"fileId": "07DTTDThBNdJCrgpsUtJSh",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "btn_back",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 7
},
{
"__id__": 8
},
{
"__id__": 5
"__id__": 9
}
],
"_prefab": {
"__id__": 6
"__id__": 10
},
"_opacity": 255,
"_color": {
......@@ -158,7 +276,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
"__id__": 6
},
"_enabled": true,
"_materials": [
......@@ -190,7 +308,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
"__id__": 6
},
"_enabled": true,
"_normalMaterial": null,
......@@ -258,7 +376,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
"__id__": 6
},
"_enabled": true,
"alignMode": 1,
......@@ -300,17 +418,20 @@
},
"_children": [
{
"__id__": 8
"__id__": 12
}
],
"_active": true,
"_components": [
{
"__id__": 20
"__id__": 24
},
{
"__id__": 25
}
],
"_prefab": {
"__id__": 21
"__id__": 26
},
"_opacity": 255,
"_color": {
......@@ -364,27 +485,27 @@
"_name": "img_npc_voice",
"_objFlags": 0,
"_parent": {
"__id__": 7
"__id__": 11
},
"_children": [
{
"__id__": 9
"__id__": 13
},
{
"__id__": 12
"__id__": 16
},
{
"__id__": 15
"__id__": 19
}
],
"_active": true,
"_components": [
{
"__id__": 18
"__id__": 22
}
],
"_prefab": {
"__id__": 19
"__id__": 23
},
"_opacity": 255,
"_color": {
......@@ -438,17 +559,17 @@
"_name": "p1",
"_objFlags": 0,
"_parent": {
"__id__": 8
"__id__": 12
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 10
"__id__": 14
}
],
"_prefab": {
"__id__": 11
"__id__": 15
},
"_opacity": 255,
"_color": {
......@@ -502,7 +623,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
"__id__": 13
},
"_enabled": true,
"_materials": [
......@@ -545,17 +666,17 @@
"_name": "p2",
"_objFlags": 0,
"_parent": {
"__id__": 8
"__id__": 12
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 13
"__id__": 17
}
],
"_prefab": {
"__id__": 14
"__id__": 18
},
"_opacity": 255,
"_color": {
......@@ -609,7 +730,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 12
"__id__": 16
},
"_enabled": true,
"_materials": [
......@@ -652,17 +773,17 @@
"_name": "p3",
"_objFlags": 0,
"_parent": {
"__id__": 8
"__id__": 12
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 16
"__id__": 20
}
],
"_prefab": {
"__id__": 17
"__id__": 21
},
"_opacity": 255,
"_color": {
......@@ -716,7 +837,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 15
"__id__": 19
},
"_enabled": true,
"_materials": [
......@@ -759,7 +880,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
"__id__": 12
},
"_enabled": true,
"alignMode": 2,
......@@ -797,7 +918,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
"__id__": 11
},
"_enabled": true,
"_materials": [
......@@ -827,6 +948,33 @@
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 11
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 1,
"_left": 0,
"_right": 0,
"_top": 67.39999999999998,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
......
......@@ -21,7 +21,8 @@ export default class LayerEnding extends cc.Component {
pg.view.touchOn(this.replay_btn, this.onTouchReplay, this)
pg.view.touchOn(this.next_btn, this.onTouchNext, this)
pg.event.on('layer_ending_show', (data) => {
this.showLayer(data);
this.onTouchNext();
// this.showLayer(data);
})
}
showLayer(data) {
......@@ -42,9 +43,12 @@ export default class LayerEnding extends cc.Component {
}
onTouchNext() {
pg.view.visible(this.layer_center, false)
console.log("下一题");
pg.view.visible(this.layer_center, false);
const middleLayer = cc.find('middleLayer');
if (!middleLayer) return;
const middleLayerComponent = middleLayer.getComponent('middleLayer');
if (!middleLayerComponent) return;
const { index, length } = middleLayerComponent.getPageInfo(); // 返回 length:有多少页; index: 当前第几页(从0开始)
if (index == length - 1) {
middleLayerComponent.goNextCross(); // 跳转到下一关卡
......
This diff is collapsed.
......@@ -36,12 +36,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
// TODO 加载完成后的逻辑写在这里, 下面的代码仅供参考
this.initData();
this.initView();
this.initEvent()
this.showWord()
this.initEvent();
this.showWordInit();
pg.event.once('npc_voice_play_voice_end', () => {
this.showWordStart();
})
pg.event.emit('npc_layer_back_init', this.data)
}
// 一轮单词数量
private static Word_List_Len: number = 8;
private word_area: cc.Node;
private upper_shadow: cc.Node;
private lower_shadow: cc.Node;
......@@ -160,6 +163,19 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initWordBg();
this.initWord();
this.initQuestion();
this.initQuestionVoice();
}
showWordInit() {
this.wordBgList = [];
this.wordList = [];
this.successGroupIds = {};
pg.view.removChildren(this.word_area)
this.initWordBg();
this.initWord();
this.initQuestion();
}
showWordStart() {
this.initQuestionVoice();
}
private layer_question: cc.Node;
initQuestion() {
......@@ -171,6 +187,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
img_voice.active = this.CurrentWord.type != "img";
if (img_voice.active) {
pg.view.touchOn(img_voice, this.onTouchVoice, this);
}
}
initQuestionVoice() {
let img_voice = pg.view.find(this.layer_question, 'img_voice');
if (img_voice.active) {
this.onTouchVoice({ target: img_voice });
}
}
......
export const defaultData = {
"onlineFlg": false, "title": "", "questionText": "", "questionTextAudio": "",
export const defaultData =
{
"onlineFlg": false,
"title": "",
"questionText": "",
"questionTextAudio": "",
"questions": [
{
"questionAudio": "", "duration": 120, "type": "imgVideo", "image": "http://staging-teach.cdn.ireadabc.com/5e2fd05e37c3f6694201049d244c58f0.png", "audio": "http://staging-teach.cdn.ireadabc.com/5214110bd03ae60f70e44c2e930f85ca_l.mp3", "text": "", "right": false, "letterList": [{ "text": "t" }, { "text": "e" }, { "text": "st" }], "audioName": "create_hy11_paopao.mp3"
"questionAudio": "",
"duration": 120,
"type": "img",
"image": "http://staging-teach.cdn.ireadabc.com/e184e067fc931d55fce93c9937a26c51.png",
"audio": "",
"text": "",
"right": false,
"letterList": [
{
"text": "m"
},
{
"text": "o"
},
{
"text": "n"
},
{
"text": "k"
},
{
"text": "e"
},
{
"text": "y"
}
]
},
{
"questionAudio": "", "duration": 120, "type": "imgVideo", "image": "http://staging-teach.cdn.ireadabc.com/84c53a0b9aac340ae396db7137847d51.png", "audio": "http://staging-teach.cdn.ireadabc.com/1cf4664096cae0d4fb534f66a3861b6c_l.mp3", "text": "", "right": false, "letterList": [{ "text": "f" }, { "text": "u" }, { "text": "nn" }, { "text": "y" }], "audioName": "error_hy11_paopao.mp3"
}], "bgAudio": "", "bgAudioName": "", "audioName": "", "titleTxt": "test", "undefined": "create_hy11_paopao.mp3", "titleAudio": "http://staging-teach.cdn.ireadabc.com/5214110bd03ae60f70e44c2e930f85ca_l.mp3", "npcTitle": "test", "npcAudio": "http://staging-teach.cdn.ireadabc.com/5214110bd03ae60f70e44c2e930f85ca_l.mp3", "npcAudioName": "create_hy11_paopao.mp3"
"questionAudio": "",
"duration": 120,
"type": "img",
"image": "http://staging-teach.cdn.ireadabc.com/e921b21c9ac22a623497b79cf849a421.png",
"audio": "",
"text": "",
"right": false,
"letterList": [
{
"text": "b"
},
{
"text": "a"
},
{
"text": "d"
}
]
}
],
"bgAudio": "",
"bgAudioName": "",
"audioName": "",
"npcTitle": "",
"npcAudio": "",
"npcAudioName": ""
}
// {
// "onlineFlg": false, "title": "", "questionText": "", "questionTextAudio": "",
// "questions": [
// {
// "questionAudio": "", "duration": 120, "type": "imgVideo", "image": "http://staging-teach.cdn.ireadabc.com/5e2fd05e37c3f6694201049d244c58f0.png", "audio": "http://staging-teach.cdn.ireadabc.com/5214110bd03ae60f70e44c2e930f85ca_l.mp3", "text": "", "right": false, "letterList": [{ "text": "t" }, { "text": "e" }, { "text": "st" }], "audioName": "create_hy11_paopao.mp3"
// },
// {
// "questionAudio": "", "duration": 120, "type": "imgVideo", "image": "http://staging-teach.cdn.ireadabc.com/84c53a0b9aac340ae396db7137847d51.png", "audio": "http://staging-teach.cdn.ireadabc.com/1cf4664096cae0d4fb534f66a3861b6c_l.mp3", "text": "", "right": false, "letterList": [{ "text": "f" }, { "text": "u" }, { "text": "nn" }, { "text": "y" }], "audioName": "error_hy11_paopao.mp3"
// }], "bgAudio": "", "bgAudioName": "", "audioName": "", "titleTxt": "test", "undefined": "create_hy11_paopao.mp3", "titleAudio": "http://staging-teach.cdn.ireadabc.com/5214110bd03ae60f70e44c2e930f85ca_l.mp3", "npcTitle": "test", "npcAudio": "http://staging-teach.cdn.ireadabc.com/5214110bd03ae60f70e44c2e930f85ca_l.mp3", "npcAudioName": "create_hy11_paopao.mp3"
// }
// {
// "onlineFlg": false, "title": "钓鱼大作战", "questionText": "", "questionTextAudio": "http://staging-teach.cdn.ireadabc.com/e422c682ff3304a532937db64573caa4.mp3", "questions": [
......
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