Commit f3911585 authored by 李维's avatar 李维

dev commit

parent 2bd86de7
......@@ -81,34 +81,34 @@
"__id__": 11
},
{
"__id__": 15
"__id__": 21
},
{
"__id__": 18
"__id__": 24
},
{
"__id__": 21
"__id__": 27
},
{
"__id__": 22
"__id__": 28
},
{
"__id__": 23
"__id__": 29
},
{
"__id__": 24
"__id__": 30
}
],
"_active": true,
"_components": [
{
"__id__": 46
"__id__": 52
},
{
"__id__": 47
"__id__": 53
},
{
"__id__": 48
"__id__": 54
}
],
"_prefab": null,
......@@ -198,7 +198,7 @@
"array": [
0,
0,
342.18828767032636,
349.9825163043863,
0,
0,
0,
......@@ -587,12 +587,21 @@
"_children": [
{
"__id__": 12
},
{
"__id__": 14
},
{
"__id__": 16
},
{
"__id__": 18
}
],
"_active": true,
"_components": [
{
"__id__": 14
"__id__": 20
}
],
"_prefab": null,
......@@ -645,7 +654,7 @@
},
{
"__type__": "cc.Node",
"_name": "speaker_1",
"_name": "speaker_0",
"_objFlags": 0,
"_parent": {
"__id__": 11
......@@ -703,7 +712,7 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "27jdUeSaxEYKgtd09CyQGQ"
"_id": "95nEKpQ01MlpEaOoJsh+UK"
},
{
"__type__": "cc.Sprite",
......@@ -721,7 +730,195 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "570d2e53-3fbf-4959-9333-0d2a16b136db"
"__uuid__": "4a47635c-e5dd-469d-9655-13378bc366a1"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "be2ZokMrdEW6h5j0dD81ps"
},
{
"__type__": "cc.Node",
"_name": "speaker_1",
"_objFlags": 0,
"_parent": {
"__id__": 11
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 15
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 95,
"height": 101
},
"_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": "c72K+mXiFPcoR9nmWAj+1V"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "24a58311-9794-4337-8251-638dd476ff9c"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "e9VuxsEx1LYZoO5CpByiNi"
},
{
"__type__": "cc.Node",
"_name": "speaker_2",
"_objFlags": 0,
"_parent": {
"__id__": 11
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 17
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 95,
"height": 101
},
"_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": "de0CLiobNNB5V5fCJxQ6GH"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "780e7ebc-11dc-4e03-b0b3-f7f21ea25534"
},
"_type": 0,
"_sizeMode": 1,
......@@ -735,7 +932,101 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "51bEV4gBJCSKFOzH4S+tEC"
"_id": "2di0e1OxRH4rihE2qXz1kF"
},
{
"__type__": "cc.Node",
"_name": "speaker_3",
"_objFlags": 0,
"_parent": {
"__id__": 11
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 19
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 95,
"height": 101
},
"_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": "a4DK8LM5JNO7F8YdMlxpdg"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "d94751b4-dfc9-4597-806e-6c315f7d3e75"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "63NPeL2oRKUrI+8gBawygI"
},
{
"__type__": "cc.Button",
......@@ -816,7 +1107,7 @@
},
"_children": [
{
"__id__": 16
"__id__": 22
}
],
"_active": true,
......@@ -874,13 +1165,13 @@
"_name": "btn_restart",
"_objFlags": 0,
"_parent": {
"__id__": 15
"__id__": 21
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 17
"__id__": 23
}
],
"_prefab": null,
......@@ -936,7 +1227,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
"__id__": 22
},
"_enabled": true,
"_materials": [
......@@ -972,7 +1263,7 @@
},
"_children": [
{
"__id__": 19
"__id__": 25
}
],
"_active": true,
......@@ -1030,13 +1321,13 @@
"_name": "btn_back",
"_objFlags": 0,
"_parent": {
"__id__": 18
"__id__": 24
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 20
"__id__": 26
}
],
"_prefab": null,
......@@ -1092,7 +1383,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 19
"__id__": 25
},
"_enabled": true,
"_materials": [
......@@ -1302,13 +1593,13 @@
},
"_children": [
{
"__id__": 25
"__id__": 31
},
{
"__id__": 26
"__id__": 32
},
{
"__id__": 29
"__id__": 35
}
],
"_active": false,
......@@ -1366,7 +1657,7 @@
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 24
"__id__": 30
},
"_children": [],
"_active": true,
......@@ -1424,11 +1715,11 @@
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 24
"__id__": 30
},
"_children": [
{
"__id__": 27
"__id__": 33
}
],
"_active": true,
......@@ -1486,13 +1777,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 26
"__id__": 32
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 28
"__id__": 34
}
],
"_prefab": null,
......@@ -1548,7 +1839,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 27
"__id__": 33
},
"_enabled": true,
"_materials": [],
......@@ -1576,32 +1867,32 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 24
"__id__": 30
},
"_children": [
{
"__id__": 30
"__id__": 36
},
{
"__id__": 32
"__id__": 38
},
{
"__id__": 34
"__id__": 40
},
{
"__id__": 36
"__id__": 42
},
{
"__id__": 38
"__id__": 44
},
{
"__id__": 40
"__id__": 46
},
{
"__id__": 42
"__id__": 48
},
{
"__id__": 44
"__id__": 50
}
],
"_active": true,
......@@ -1659,13 +1950,13 @@
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 29
"__id__": 35
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 31
"__id__": 37
}
],
"_prefab": null,
......@@ -1721,7 +2012,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 30
"__id__": 36
},
"_enabled": true,
"_clip": {
......@@ -1739,13 +2030,13 @@
"_name": "出现",
"_objFlags": 0,
"_parent": {
"__id__": 29
"__id__": 35
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 33
"__id__": 39
}
],
"_prefab": null,
......@@ -1801,7 +2092,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
"__id__": 38
},
"_enabled": true,
"_clip": {
......@@ -1819,13 +2110,13 @@
"_name": "正确",
"_objFlags": 0,
"_parent": {
"__id__": 29
"__id__": 35
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 35
"__id__": 41
}
],
"_prefab": null,
......@@ -1881,7 +2172,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 34
"__id__": 40
},
"_enabled": true,
"_clip": {
......@@ -1899,13 +2190,13 @@
"_name": "错误泡泡爆炸",
"_objFlags": 0,
"_parent": {
"__id__": 29
"__id__": 35
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 37
"__id__": 43
}
],
"_prefab": null,
......@@ -1961,7 +2252,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 36
"__id__": 42
},
"_enabled": true,
"_clip": {
......@@ -1979,13 +2270,13 @@
"_name": "按钮",
"_objFlags": 0,
"_parent": {
"__id__": 29
"__id__": 35
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 39
"__id__": 45
}
],
"_prefab": null,
......@@ -2041,7 +2332,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 38
"__id__": 44
},
"_enabled": true,
"_clip": {
......@@ -2059,13 +2350,13 @@
"_name": "大星",
"_objFlags": 0,
"_parent": {
"__id__": 29
"__id__": 35
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 41
"__id__": 47
}
],
"_prefab": null,
......@@ -2121,7 +2412,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 40
"__id__": 46
},
"_enabled": true,
"_clip": {
......@@ -2139,13 +2430,13 @@
"_name": "题数",
"_objFlags": 0,
"_parent": {
"__id__": 29
"__id__": 35
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 43
"__id__": 49
}
],
"_prefab": null,
......@@ -2201,7 +2492,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 42
"__id__": 48
},
"_enabled": true,
"_clip": {
......@@ -2219,13 +2510,13 @@
"_name": "撒花",
"_objFlags": 0,
"_parent": {
"__id__": 29
"__id__": 35
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 45
"__id__": 51
}
],
"_prefab": null,
......@@ -2281,7 +2572,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 44
"__id__": 50
},
"_enabled": true,
"_clip": {
......
......@@ -151,7 +151,6 @@ export default class Cartoon {
subscribeTouchEvent(key, callBack, newEvent) {
if(!this.touchEventCallback[key] || newEvent) {
this.touchEventCallback[key] = callBack
console.log("DVDVDV", this.elements[key].node)
this.elements[key].node.off(cc.Node.EventType.TOUCH_START)
this.elements[key].node.on(cc.Node.EventType.TOUCH_START, ()=>{
if(this.touchEventCallback[key]) {
......
import Cartoon from "./Cartoon"
import defaultData from "./defaultData"
import { jelly, randomSortByArr } from "./utils"
import { jelly, randomSortByArr, onHomeworkFinish } from "./utils"
export default class GameLogic {
g_cartoon = null;
......@@ -115,6 +115,9 @@ export default class GameLogic {
addEventLinstener() {
const btn_restart = this.g_cartoon.getCartoonElement("restart")
this.g_cartoon.subscribeTouchEvent("restart", _=>{
if(!this.g_enableClick) {
return
}
this.g_cartoon.tweenChange(btn_restart.node, {scaleX: 0, scaleY: 0}, 0.2, _=>{
this.enableClick("Restart")
this.restartGame();
......@@ -123,9 +126,41 @@ export default class GameLogic {
const btn_lion = this.g_cartoon.getCartoonElement("lion")
this.g_cartoon.subscribeTouchEvent("lion", _=>{
if(!this.g_enableClick) {
return
}
let a = btn_lion.node.getComponent(dragonBones.ArmatureDisplay)
a.playAnimation('Armature', 1);
})
const btn_speaker = this.g_cartoon.getCartoonElement("audio");
this.g_cartoon.subscribeTouchEvent("audio", _=>{
if(!this.g_enableClick) {
return
}
this.startSpeakerAnime()
})
}
endGame() {
const btn_restart = this.g_cartoon.getCartoonElement("restart")
this.disableClick("EndGame")
this.g_cartoon.playAudio("撒花")
this.g_cartoon.tweenChange(btn_restart.node, {scale: 1}, 0.3, _=>{
this.enableClick("EndGame");
onHomeworkFinish();
})
}
restartGame() {
this.m_currentQuestion = -1;
this.m_currentQuestionIndex = -1;
this.m_rightAns = 0;
this.m_stopMoving = false;
this.cleanScore();
this.nextQuestion()
this.initStar();
this.releaseBubbles();
}
systemTick() {
......@@ -137,32 +172,24 @@ export default class GameLogic {
if(!this.m_stopMoving && bubble.move.enable && !bubble.move.fix) {
bubble.move.x += bubble.move.vX
bubble.move.y += bubble.move.vY
if(bubble.move.scale<this.m_maxScale) {
bubble.move.scale += 0.1;
} else {
bubble.move.scale = this.m_maxScale
}
bubble.node.scaleX = bubble.move.scale;
bubble.node.scaleY = bubble.move.scale;
if (bubble.move.x >= maxX - bubble.move.r * bubble.move.scale) {
bubble.move.x = maxX - bubble.move.r * bubble.move.scale;
if (bubble.move.x >= maxX - bubble.move.r * this.m_maxScale) {
bubble.move.x = maxX - bubble.move.r * this.m_maxScale;
bubble.move.vX = -bubble.move.vX;
// bubble.move.lastId = null;
}
if (bubble.move.x <= -maxX + bubble.move.r * bubble.move.scale) {
bubble.move.x = -maxX + bubble.move.r * bubble.move.scale;
if (bubble.move.x <= -maxX + bubble.move.r * this.m_maxScale) {
bubble.move.x = -maxX + bubble.move.r * this.m_maxScale;
bubble.move.vX = -bubble.move.vX;
// bubble.move.lastId = null;
}
if (bubble.move.y >= maxY - bubble.move.r * bubble.move.scale) {
bubble.move.y = maxY - bubble.move.r * bubble.move.scale;
if (bubble.move.y >= maxY - bubble.move.r * this.m_maxScale) {
bubble.move.y = maxY - bubble.move.r * this.m_maxScale;
bubble.move.vY = -bubble.move.vY;
// bubble.move.lastId = null;
}
if (bubble.move.y <= -maxY + bubble.move.r * bubble.move.scale) {
bubble.move.y = -maxY + bubble.move.r * bubble.move.scale;
if (bubble.move.y <= -maxY + bubble.move.r * this.m_maxScale) {
bubble.move.y = -maxY + bubble.move.r * this.m_maxScale;
bubble.move.vY = - bubble.move.vY;
// bubble.move.lastId = null;
}
......@@ -174,7 +201,7 @@ export default class GameLogic {
if (j !== index_x) {
if (Math.round(Math.pow(this.m_bubblesAll[index_x].node.x - this.m_bubblesAll[j].node.x, 2) +
Math.pow(this.m_bubblesAll[index_x].node.y - this.m_bubblesAll[j].node.y, 2)) <=
Math.round(Math.pow(this.m_bubblesAll[index_x].move.r * this.m_bubblesAll[index_x].move.scale + this.m_bubblesAll[j].move.r * this.m_bubblesAll[j].move.scale, 2))) {
Math.round(Math.pow(this.m_bubblesAll[index_x].move.r * this.m_maxScale + this.m_bubblesAll[j].move.r * this.m_maxScale, 2))) {
var tempX = this.m_bubblesAll[index_x].move.vX;
var tempY = this.m_bubblesAll[index_x].move.vY;
......@@ -203,6 +230,11 @@ export default class GameLogic {
const starGroup = this.g_cartoon.getNodeByPath(`Canvas/star_group`)
const scoreGroup = this.g_cartoon.getNodeByPath(`Canvas/score_group`)
const scoreAll = []
const num = this.g_formData.dataArray.length;
if(num>9) {
scoreGroup.scale = 0.6
}
for(let i=0; i<this.g_formData.dataArray.length; i++) {
const star = cc.instantiate(this.g_systemOption.prefabs.star);
star.parent = starGroup;
......@@ -214,7 +246,7 @@ export default class GameLogic {
scoreAll.push(score)
}
let startY = (scoreAll.length * 66 + (scoreAll.length-1) * 10) / 2;
let startY = (scoreAll.length * 66) / 2;
scoreAll.forEach((score, index)=>{
score.y = startY
startY -= 66 + 10
......@@ -228,6 +260,7 @@ export default class GameLogic {
const starGroup = this.g_cartoon.getNodeByPath(`Canvas/star_group`);
const scoreGroup = this.g_cartoon.getNodeByPath(`Canvas/score_group`);
this.g_cartoon.playAudio("大星")
this.g_cartoon.tweenChange(star.node, {y: 380}, 1, ()=>{
setTimeout(() => {
const worldPos = starGroup.convertToWorldSpaceAR(cc.v2(star.node.x, star.node.y));
......@@ -236,6 +269,7 @@ export default class GameLogic {
star.node.parent = scoreGroup;
star.node.x = localPos.x;
star.node.y = localPos.y;
this.g_cartoon.tweenChange(star.node, {x: score.node.x, y: score.node.y, scale: 0.2}, 0.8, _=>{
score_b.active = true;
score_b.scaleX = 0;
......@@ -293,7 +327,9 @@ export default class GameLogic {
this.m_bubblesAll.push(bubble)
this.g_cartoon.subscribeTouchEvent(`bubble_${i}`, ()=>{
console.log("d")
if(!this.g_enableClick) {
return
}
this.disableClick(`bubble_${i}`)
if(bubble.isRight) {
bubble.node.active = false;
......@@ -302,12 +338,16 @@ export default class GameLogic {
if(this.m_rightAns>=rightNum) {
this.m_stopMoving = true;
this.addStar(_=>{
this.destroyBubbles();
if(!this.nextQuestion()) {
this.endGame()
this.enableClick(`bubble_${i}`)
}
this.destroyBubbles().then(_=>{
if(!this.nextQuestion()) {
this.endGame()
} else {
this.releaseBubbles();
}
})
})
} else {
this.enableClick("Destroy")
}
} else {
this.m_stopMoving = true;
......@@ -323,6 +363,7 @@ export default class GameLogic {
}
destroyBubbles() {
this.disableClick("DestroyBubbles")
this.save = []
this.m_bubblesAll.forEach(item=>{
if(!item.move.fix) {
......@@ -334,6 +375,13 @@ export default class GameLogic {
}
})
this.m_bubblesAll = this.save;
return new Promise((resolve, reject)=>{
setTimeout(() => {
resolve();
this.enableClick("DestroyBubbles")
}, 1100);
})
}
releaseBubbles() {
......@@ -345,28 +393,30 @@ export default class GameLogic {
]
]
let startx = cc.winSize.width / 2 - 350
let starty = -cc.winSize.height / 2 + 350
let startx = cc.winSize.width / 2
let starty = -cc.winSize.height / 2
const vArr = [
{vX: -0.5, vY: 0.5 }, {vX: 0.5, vY: -0.5 }, {vX: -0.5, vY: -0.5 }, {vX: 0.5, vY: 0.5 }
]
let pAll = []
let count = 0;
this.m_bubblesAll.forEach(bubble => {
this.m_bubblesAll.forEach((bubble, index) => {
if(!bubble.move.fix) {
bubble.node.x = startx;
bubble.node.y = starty;
bubble.node.scale = 0;
let _p = new Promise((resolve, reject) => {
console.log(count)
bubble.node.x = pos[0][count].x
bubble.node.y = pos[0][count].y
bubble.move.x = pos[0][count].x
bubble.move.y = pos[0][count].y
bubble.move.vX = vArr[count%4].vX
bubble.move.vX = vArr[count%4].vX
bubble.move.vY = vArr[count%4].vY
bubble.move.scale = 1;
bubble.node.scaleX = bubble.move.scale;
bubble.node.scaleY = bubble.move.scale;
count++;
resolve()
setTimeout(() => {
this.g_cartoon.playAudio("出现")
this.g_cartoon.tweenChange(bubble.node, {scale: this.m_maxScale, x: bubble.move.x, y: bubble.move.y}, 3, _=>{
resolve()
})
}, 200 * index);
})
pAll.push(_p)
}
......@@ -380,25 +430,57 @@ export default class GameLogic {
})
}
endGame() {
const btn_restart = this.g_cartoon.getCartoonElement("restart")
console.log(btn_restart.node)
this.g_cartoon.playAudio("撒花")
this.g_cartoon.tweenChange(btn_restart.node, {scale: 1}, 0.3, _=>{
this.enableClick("Restart")
})
}
cleanScore() {
const scoreGroup = this.g_cartoon.getNodeByPath(`Canvas/score_group`);
const scoreAll = []
for(let i=0; i<this.g_formData.dataArray.length; i++) {
const _score = this.g_cartoon.getCartoonElement(`score_${i}`)
_score.node.destroy();
console.log(_score)
// const score = cc.instantiate(this.g_systemOption.prefabs.score);
// score.parent = scoreGroup;
// this.g_cartoon.setCartoonElement(`score_${i}`, score)
// scoreAll.push(score)
}
restartGame() {
this.m_currentQuestion = -1;
this.m_currentQuestionIndex = -1;
this.m_rightAns = 0;
this.m_stopMoving = false;
console.log("重新开始", this.nextQuestion());
this.initStar();
this.releaseBubbles();
// let startY = (scoreAll.length * 66 + (scoreAll.length-1) * 10) / 2;
// scoreAll.forEach((score, index)=>{
// score.y = startY
// startY -= 66 + 10
// })
}
startSpeakerAnime(speakerBase) {
const speakers = [];
for (let index = 1; index < 4; index++) {
const node = cc.find(`Canvas/speaker/speaker_${index}`);
speakers.push(node);
}
const node0 = cc.find(`Canvas/speaker/speaker_0`);
node0.active = false;
let currentIdx = 0;
cc.tween(speakerBase)
.call(() => {
speakers.forEach(node => node.active = false);
speakers[currentIdx % speakers.length].active = true;
currentIdx++;
})
.delay(0.2)
.union()
.repeatForever()
.start();
}
stopSpeakerAnime() {
for (let index = 1; index < 4; index++) {
const node = cc.find(`Canvas/speaker/speaker_${index}`);
node.active = false;
}
const node0 = cc.find(`Canvas/speaker/speaker_0`);
node0.active = true;
}
......@@ -521,13 +603,13 @@ export default class GameLogic {
disableClick(eventName) {
this.g_enableClick = false;
this.g_disableClickEventName = eventName
// console.log(`Click disabled! [${eventName}]`)
console.log(`Click disabled! [${eventName}]`)
}
enableClick(eventName) {
this.g_enableClick = true;
this.g_disableClickEventName = ""
// console.log(`Click enabled! [${eventName}]`)
console.log(`Click enabled! [${eventName}]`)
}
}
......@@ -131,4 +131,16 @@ export function btnClickAnima(btn, time=0.15, rate=1.05) {
.to(time / 2, {scale: btn.tmpScale})
.start()
})
}
export function onHomeworkFinish() {
const middleLayer = cc.find('middleLayer');
if (middleLayer) {
const middleLayerComponent = middleLayer.getComponent('middleLayer');
if (middleLayerComponent.role == 'student') {
middleLayerComponent.onHomeworkFinish(() => { });
}
} else {
console.log('onHomeworkFinish');
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "a0fb37da-d793-4eb6-80e4-ccec20a63bbb",
"uuid": "3f83a6a1-d6df-485e-b389-5baa1f868390",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
......@@ -11,10 +11,10 @@
"height": 101,
"platformSettings": {},
"subMetas": {
"speaker": {
"speaker_0": {
"ver": "1.0.4",
"uuid": "570d2e53-3fbf-4959-9333-0d2a16b136db",
"rawTextureUuid": "a0fb37da-d793-4eb6-80e4-ccec20a63bbb",
"uuid": "4a47635c-e5dd-469d-9655-13378bc366a1",
"rawTextureUuid": "3f83a6a1-d6df-485e-b389-5baa1f868390",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
......
{
"ver": "2.3.5",
"uuid": "4afa6af5-0247-4b0b-84cb-ca73c43da096",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 95,
"height": 101,
"platformSettings": {},
"subMetas": {
"speaker_1": {
"ver": "1.0.4",
"uuid": "24a58311-9794-4337-8251-638dd476ff9c",
"rawTextureUuid": "4afa6af5-0247-4b0b-84cb-ca73c43da096",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 95,
"height": 101,
"rawWidth": 95,
"rawHeight": 101,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "b44918f4-0131-4676-9a71-870c316d5b2d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 95,
"height": 101,
"platformSettings": {},
"subMetas": {
"speaker_2": {
"ver": "1.0.4",
"uuid": "780e7ebc-11dc-4e03-b0b3-f7f21ea25534",
"rawTextureUuid": "b44918f4-0131-4676-9a71-870c316d5b2d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 95,
"height": 101,
"rawWidth": 95,
"rawHeight": 101,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "1011b81a-caf7-4afa-b8a9-445d3eeadb7c",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 95,
"height": 101,
"platformSettings": {},
"subMetas": {
"speaker_3": {
"ver": "1.0.4",
"uuid": "d94751b4-dfc9-4597-806e-6c315f7d3e75",
"rawTextureUuid": "1011b81a-caf7-4afa-b8a9-445d3eeadb7c",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 95,
"height": 101,
"rawWidth": 95,
"rawHeight": 101,
"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