Commit 71e26912 authored by lwd555's avatar lwd555

commit

parent 8e332abd
......@@ -130,6 +130,13 @@ var game = cc.Class({
};
},
clearInter() {
for (var i = 0; i < this.contentArr.childrenCount; i++) {
this.contentArr.children[i].children[0].getComponent("LWD_3_item").clearInter();
}
},
//隐藏剩余物品并跳转下一题
resetQues: function () {
if (LWD_3.data_mgr.quesId >= 4) {
......@@ -138,6 +145,7 @@ var game = cc.Class({
}, 1000));
LWD_3.data_mgr.gameState = 2
} else {
this.clearInter();
for (var i = 0; i < this.contentArr.childrenCount; i++) {
cc.tween(this.contentArr.children[i].children[0])
.to(0.8, { opacity: 0 })
......@@ -188,7 +196,7 @@ var game = cc.Class({
//更新界面信息
UpdataUi: function () {
LWD_3.data_mgr.gameState == 1;
LWD_3.data_mgr.gameState = 1;
var Info = {
tex_json: LWD_3.data_mgr.data.tex_json,
ske_json: LWD_3.data_mgr.data.ske_json,
......@@ -267,6 +275,7 @@ var game = cc.Class({
//重置UI界面
resetUI: function () {
this.clearInter();
//移除所有子节点
this.contentArr.removeAllChildren();
},
......
......@@ -31,9 +31,13 @@ cc.Class({
},
clearInter() {
clearInterval(this.timer);
},
//触摸开始
touchBegan: function (event) {
LWD_3.data_mgr.gameState = 2;
if (LWD_3.data_mgr.gameState == 2) return;
LWD_3.data_mgr.time = 0;
//如果有提示手则停止
......@@ -65,6 +69,8 @@ cc.Class({
//触摸移动
touchMove: function (event) {
if (LWD_3.data_mgr.gameState == 2) return;
if (this.node.isComplent || this._isRotate) {
return
}
......@@ -81,10 +87,11 @@ cc.Class({
//触摸结束
touchEnd: function (event) {
clearInterval(this.timer);
if (LWD_3.data_mgr.gameState == 2) return;
//暂停音效
LWD_3.snd_mgr.pauseVolume();
LWD_3.data_mgr.gameState = 1;
//获得世界坐标
var posScreen = event.getLocation(); //点击事件获取位置
var posNode = this.node.convertToNodeSpaceAR(posScreen);
......@@ -147,6 +154,11 @@ cc.Class({
//先播放错误声音
LWD_3.speaker.inst.playEffect(LWD_3.enum.E_Audio.Right);
//当前关卡是否结束
if (LWD_3.data_mgr.nowNum <= 0) {
LWD_3.data_mgr.quesId += 1;
LWD_3.game.inst.resetQues();
}
this._timeoutIds.push(setTimeout(() => {
LWD_3.game.inst.playCatDragon("right");
......@@ -155,12 +167,6 @@ cc.Class({
//先播放错误声音
LWD_3.speaker.inst.playEffect(num);
//当前关卡是否结束
if (LWD_3.data_mgr.nowNum <= 0) {
LWD_3.data_mgr.quesId += 1;
LWD_3.game.inst.resetQues();
}
}, 500));
// LWD_3.data_mgr.nowNum -= 1;
......@@ -221,13 +227,14 @@ cc.Class({
touchCancel: function (event) {
clearInterval(this.timer);
if (LWD_3.data_mgr.gameState == 2) return;
//回到原来的位置
this.node.x = 0;
this.node.y = 0;
this.isMove = false;
LWD_3.data_mgr.gameState = 1;
},
//更新界面ui
......@@ -294,6 +301,8 @@ cc.Class({
_intervalIds: null,
// 生命周期
onDestroy() {
clearInterval(this.timer);
this._timeoutIds.forEach(id => {
clearTimeout(id);
});
......
......@@ -6,7 +6,7 @@ LWD_3.data_mgr = {
quesId: 0,//题目id
nowNum: 0,//剩余正确数量
gameState: 2,//游戏状态1可操作 2不可操作
gameState: 1,//游戏状态1可操作 2不可操作
//获得默认数据
getDefaultData() {
......@@ -46,9 +46,162 @@ LWD_3.data_mgr = {
"guideEnd_audio_url": "http://staging-teach.cdn.ireadabc.com/bd6e2b3a870ef3f9ee9ad9c0fda79228.mp3",
"guideRestart_audio_url": "http://staging-teach.cdn.ireadabc.com/bd6e2b3a870ef3f9ee9ad9c0fda79228.mp3",
}
const data = dataJson;
const data1 = dataJson;
// const data = JSON.parse(dataJson);
// const data = [];
const data = {
"question_arr": [
{
"question_audio_url": "https://teach.cdn.ireadabc.com/a5a335d362c47064f34aa6988dcaa3a4.mp3",
"option_arr": [
{
"text": "a_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/ef4aec311cf6349aac0251fefea51495.mp3",
"is_right": false
},
{
"text": "u_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/9b4d5a7d58dd29fe3983a3e1ed723488.mp3",
"is_right": false
},
{
"text": "o_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/aad3b9ddff6a712ebdebfaad5c6d8c4c.mp3",
"is_right": false
},
{
"text": "i_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/18d60942e3f1f2d4a0bfa850e1764ff4.mp3",
"is_right": true
},
{
"text": "ave",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/d5a82cfd83a443694682b8dd90e8883b.mp3",
"is_right": false
}
]
},
{
"question_audio_url": "https://teach.cdn.ireadabc.com/a5a335d362c47064f34aa6988dcaa3a4.mp3",
"option_arr": [
{
"text": "ake",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/7aa7ae7a3693fe7faad4f3203e5e0470.mp3",
"is_right": false
},
{
"text": "ave",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/d5a82cfd83a443694682b8dd90e8883b.mp3",
"is_right": false
},
{
"text": "ate",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/219a7220c0372e856601306f6b5af22c.mp3",
"is_right": false
},
{
"text": "i_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/18d60942e3f1f2d4a0bfa850e1764ff4.mp3",
"is_right": true
},
{
"text": "u_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/9b4d5a7d58dd29fe3983a3e1ed723488.mp3",
"is_right": false
}
]
},
{
"question_audio_url": "https://teach.cdn.ireadabc.com/a5a335d362c47064f34aa6988dcaa3a4.mp3",
"option_arr": [
{
"text": "ake",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/7aa7ae7a3693fe7faad4f3203e5e0470.mp3",
"is_right": false
},
{
"text": "i_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/18d60942e3f1f2d4a0bfa850e1764ff4.mp3",
"is_right": true
},
{
"text": "o_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/aad3b9ddff6a712ebdebfaad5c6d8c4c.mp3",
"is_right": false
},
{
"text": "ate",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/219a7220c0372e856601306f6b5af22c.mp3",
"is_right": false
},
{
"text": "u_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/9b4d5a7d58dd29fe3983a3e1ed723488.mp3",
"is_right": false
}
]
},
{
"question_audio_url": "https://teach.cdn.ireadabc.com/a5a335d362c47064f34aa6988dcaa3a4.mp3",
"option_arr": [
{
"text": "a_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/ef4aec311cf6349aac0251fefea51495.mp3",
"is_right": false
},
{
"text": "ame",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/905dd2c3db170630ef50556e68a43dd6.mp3",
"is_right": false
},
{
"text": "u_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/9b4d5a7d58dd29fe3983a3e1ed723488.mp3",
"is_right": false
},
{
"text": "i_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/18d60942e3f1f2d4a0bfa850e1764ff4.mp3",
"is_right": true
},
{
"text": "o_e",
"pic_url": "https://teach.cdn.ireadabc.com/10304dad1e1302839bcf3946448cb044.png",
"audio_url": "https://teach.cdn.ireadabc.com/aad3b9ddff6a712ebdebfaad5c6d8c4c.mp3",
"is_right": false
}
]
}
],
"ske_json": "https://teach.cdn.ireadabc.com/e1f754e6541015ac2af531aaee21647d.json",
"ske_json_name": "bear_2_ske.json",
"tex_json": "https://teach.cdn.ireadabc.com/74817f63b8f00d89e7994d6e75660ced.json",
"tex_json_name": "bear_2_tex.json",
"tex_png": "https://teach.cdn.ireadabc.com/29812ad5d439658dd872d51dfd6eeb27.png",
"tex_png_name": "bear_2_tex.png",
"guideRestart_audio_url": "https://teach.cdn.ireadabc.com/545f8544641d2423783604c9f6802f1c.mp3",
"guideEnd_audio_url": "https://teach.cdn.ireadabc.com/ef8b1264fa40981cd16a3c7b003a6cdf.mp3",
"guideBegin_audio_url": "https://teach.cdn.ireadabc.com/e41dd233aab5b09a3d48fc82e9991ad6.mp3"
}
return data;
},
......
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