Commit 97b53cba authored by Li MingZhe's avatar Li MingZhe

feat: 音频

parent 075ed516
{
"ver": "2.0.1",
"uuid": "4343fc6d-0463-4a54-b33d-849f8c52e614",
"downloadMode": 0,
"duration": 0.130612,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "8be772e6-5d59-41fc-94dc-740b7886ed2a",
"downloadMode": 0,
"duration": 1.37425,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "cf4194d1-b3c9-4752-a688-ac743fd6dffb",
"downloadMode": 0,
"duration": 0.536,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "f4288d8f-0b1b-4351-80be-0ca27ff1cf8a",
"downloadMode": 0,
"duration": 2.35102,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "73c6427f-bac9-4ced-bfe8-1ea0628616eb",
"downloadMode": 0,
"duration": 1.056667,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "efd1cc04-9cf0-47d8-905c-229e476e8b59",
"downloadMode": 0,
"duration": 1.044898,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "fc63f540-c414-44f6-91bf-52fd6a0d919a",
"downloadMode": 0,
"duration": 1.750204,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "d56c6fa4-e16c-407e-ad99-4fdf2d3d6e22",
"downloadMode": 0,
"duration": 1.306122,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
......@@ -249,7 +249,7 @@ cc.Class({
this.groupIndex = 0;
// this.initCurGroup();
// this.initAudioEffect();
this.initAudioEffect();
this.layer1 = cc.find('Canvas/layer_1');
this.layer2 = cc.find('Canvas/layer_2');
......@@ -272,11 +272,24 @@ cc.Class({
}
},
appearClip: null,
clickClip: null,
capClip: null,
btnClip: null,
speakClip: null,
rightClip: null,
wrongClip: null,
starClip: null,
showClip: null,
initAudioEffect() {
// this.appearClip = cc.find('Canvas/res/audio/appear').getComponent(cc.AudioSource).clip;
// this.starClip = cc.find('Canvas/res/audio/star').getComponent(cc.AudioSource).clip;
this.clickClip = cc.find('Canvas/res/audio/click').getComponent(cc.AudioSource).clip;
this.capClip = cc.find('Canvas/res/audio/cap').getComponent(cc.AudioSource).clip;
this.btnClip = cc.find('Canvas/res/audio/btn').getComponent(cc.AudioSource).clip;
this.speakClip = cc.find('Canvas/res/audio/speak').getComponent(cc.AudioSource).clip;
this.rightClip = cc.find('Canvas/res/audio/right').getComponent(cc.AudioSource).clip;
this.wrongClip = cc.find('Canvas/res/audio/wrong').getComponent(cc.AudioSource).clip;
this.starClip = cc.find('Canvas/res/audio/star').getComponent(cc.AudioSource).clip;
this.showClip = cc.find('Canvas/res/audio/show').getComponent(cc.AudioSource).clip;
},
curGroup: null,
......@@ -471,6 +484,7 @@ cc.Class({
this.initBottle();
this.initRole();
this.initHand();
},
bottleArr: null,
......@@ -515,11 +529,60 @@ cc.Class({
dragonDisplay.playAnimation('newAnimation', -1);
role.on(cc.Node.EventType.TOUCH_START, () => {
this._curShowItem = role;
this.role.hand.active = false;
playAudio(this.clickClip);
})
},
initHand() {
const node = new cc.Node();
this.role.addChild(node);
this.role.hand = node;
const handStar = getSprNode('hand_star');
this.addHandStarAnima(handStar);
const handArrow = getSprNode('hand_arrow');
handArrow.x = 200;
handArrow.baseX = handArrow.x;
this.addHandArrowAnima(handArrow);
const hand = getSprNode('hand');
hand.x = 5;
hand.anchorY = 1;
node.addChild(handStar)
node.addChild(hand)
node.addChild(handArrow)
},
addHandStarAnima(node) {
const time = 1
cc.tween(node)
.to(time, {scale: 0.8}, {easing: 'quadInOut'})
.to(time, {scale: 1}, {easing: 'quadInOut'})
.call(() => {
this.addHandStarAnima(node);
})
.start();
},
addHandArrowAnima(node) {
const time = 0.5
cc.tween(node)
.to(time, {x: node.baseX + 30}, {easing: 'quadIn'})
.to(time, {x: node.baseX}, {easing: 'quadOut'})
.call(() => {
this.addHandArrowAnima(node);
})
.start();
},
getBottle() {
......@@ -586,6 +649,7 @@ cc.Class({
})
this.curBottle = bottle;
playAudio(this.capClip);
},
delayCall(time, cb) {
......@@ -732,6 +796,7 @@ cc.Class({
.to(1, {opacity: 255}, {easing: 'quadOut'})
.start();
playAudio(this.showClip);
},
showStudentPanelLabel(isRight) {
......@@ -746,15 +811,48 @@ cc.Class({
this.hideSpeakIcon();
this.showWrongAndRightAnima(isRight);
if (isRight) {
this.isShowStarAnima = true;
this.showStarAnima();
playAudio(this.rightClip);
playAudio(this.starClip);
this.delayCall(1.7, () => {
this.isShowStarAnima = false;
})
} else {
playAudio(this.wrongClip);
}
playAudio(this.showClip);
},
showStarAnima() {
this.delayCall(0.005, () => {
if (!this.isShowStarAnima) {
return;
}
this.addOneStarAnima();
this.showStarAnima();
})
},
addOneStarAnima() {
const star = getSprNode('icon_star');
star.scale = (0.3 + Math.random() * 0.7) * this._mapScaleMin;
star.angle = Math.random() * 360;
star.x = -this.canvas.width / 2 + Math.random() * this.canvas.width;
star.y = this.canvas.height / 2 + 100 * this._mapScaleMin
this.layer2.addChild(star);
const time = 0.8 + Math.random() * 2;
cc.tween(star)
.to(time, {y: -this.canvas.height / 2 - 100 * this._mapScaleMin, angle: star.angle - 360 * Math.random() + 180})
.start();
},
showWrongAndRightAnima(isRight) {
this.wrongAndRightDisplay.node.active = true;
......@@ -770,6 +868,7 @@ cc.Class({
this.speakIcon.active = true;
this.appear(this.speakIcon, 0.5)
playAudio(this.speakClip);
},
hideSpeakIcon() {
......@@ -808,9 +907,9 @@ cc.Class({
this.initPic();
this.initTeacherPanel();
this.initStudentPanel();
if (this.isTeacher) {
// if (this.isTeacher) {
this.initTeacherBtn();
}
// }
this.initSpeakIcon();
this.initWrongAndRightAnima();
},
......@@ -820,6 +919,13 @@ cc.Class({
title.scale = this._mapScaleMin;
title.parent = this.layer2;
title.addComponent(cc.Button);
title.on('click', () => {
if (this.data.title_audio_url) {
playAudioByUrl(this.data.title_audio_url);
}
})
title.x = -this.canvas.width / 2 + title.width / 2 * title.scale + 20 * this._mapScaleMin;
title.y = this.canvas.height / 2 - title.height / 2 * title.scale - 20 * this._mapScaleMin;
......@@ -967,6 +1073,7 @@ cc.Class({
show.x = this.teacherPanel.width / 2 - show.width / 2 - 9;
show.y = this.teacherPanel.height / 2 - 10;
this.addBtnClickFunc(show, () => {
this.showBtnAnima(show);
this.showTeacherPanelLabel();
this.sendServerEvent('show_question', {})
})
......@@ -976,6 +1083,7 @@ cc.Class({
speak.x = -this.studentPanel.width / 2 + speak.width / 2 + 28;
speak.y = this.studentPanel.height / 2 + 2;
this.addBtnClickFunc(speak, () => {
this.showBtnAnima(speak);
this.showSpeakIcon();
this.sendServerEvent('show_speak', {})
})
......@@ -988,6 +1096,7 @@ cc.Class({
right.x = this.canvas.width / 2 - right.width / 2 * this._mapScaleMin + offX;
right.y = offY;
this.addBtnClickFunc(right, () => {
this.showBtnAnima(right);
this.showStudentPanelLabel(true);
this.sendServerEvent('show_answer', {isRight: true})
})
......@@ -998,6 +1107,7 @@ cc.Class({
wrong.x = right.x;
wrong.y = right.y - 100 * this._mapScaleMin;
this.addBtnClickFunc(wrong, () => {
this.showBtnAnima(wrong);
this.showStudentPanelLabel(false);
this.sendServerEvent('show_answer', {isRight: false})
})
......@@ -1008,15 +1118,16 @@ cc.Class({
next.x = wrong.x;
next.y = wrong.y - 170 * this._mapScaleMin;
this.addBtnClickFunc(next, () => {
this.showBtnAnima(next);
this.backLayer1();
sendServerEvent('back_layer', {});
this.sendServerEvent('back_layer', {});
})
},
addBtnClickFunc(node, cb) {
node.addComponent(cc.Button);
node.on('click', () => {
node.on(cc.Node.EventType.TOUCH_START, () => {
cb();
})
},
......@@ -1060,6 +1171,7 @@ cc.Class({
roleBack() {
this.role.x = this.role.baseX;
this.role.y = this.role.baseY;
this.role.hand.active = true;
},
wrongAndRightDisplay: null,
......@@ -1076,6 +1188,17 @@ cc.Class({
this.wrongAndRightDisplay = wrongAndRight.getComponent(dragonBones.ArmatureDisplay);
},
showBtnAnima(btn) {
playAudio(this.btnClip);
cc.tween(btn)
.to(0.05, {scale: 0.9 * this._mapScaleMin})
.to(0.05, {scale: 1 * this._mapScaleMin})
.call(() => {
})
.start();
},
......
{
"ver": "2.3.5",
"uuid": "d9d7d243-a5e0-4276-a436-4cb90da8f61d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 91,
"height": 111,
"platformSettings": {},
"subMetas": {
"hand": {
"ver": "1.0.4",
"uuid": "c5908518-f47b-4d1d-9d66-0ed0290222c6",
"rawTextureUuid": "d9d7d243-a5e0-4276-a436-4cb90da8f61d",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 91,
"height": 111,
"rawWidth": 91,
"rawHeight": 111,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "1487164c-d2e9-4e4f-af8c-c622fa6c53c1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 69,
"height": 51,
"platformSettings": {},
"subMetas": {
"hand_arrow": {
"ver": "1.0.4",
"uuid": "b9cfdde5-4965-4a04-8c3b-a05c72244c5f",
"rawTextureUuid": "1487164c-d2e9-4e4f-af8c-c622fa6c53c1",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 69,
"height": 51,
"rawWidth": 69,
"rawHeight": 51,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d14fc90e-4569-449d-8145-b066bcbff4bd",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 79,
"height": 76,
"platformSettings": {},
"subMetas": {
"hand_star": {
"ver": "1.0.4",
"uuid": "eba57bd6-7868-4eac-9433-f0e3b640af9a",
"rawTextureUuid": "d14fc90e-4569-449d-8145-b066bcbff4bd",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 79,
"height": 76,
"rawWidth": 79,
"rawHeight": 76,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "1ba6f340-64e0-4e61-8ce6-699385a7ab87",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 79,
"height": 76,
"platformSettings": {},
"subMetas": {
"icon_sahua": {
"ver": "1.0.4",
"uuid": "d1e68a76-85a2-4775-ae5d-c8288e37b7ce",
"rawTextureUuid": "1ba6f340-64e0-4e61-8ce6-699385a7ab87",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 79,
"height": 76,
"rawWidth": 79,
"rawHeight": 76,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ 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