Commit 7100d3e4 authored by Tt's avatar Tt

正确错误效果完成

parent e975e26a
{
"ver": "1.1.2",
"uuid": "4b356d73-d687-4401-86c5-0d10cccc8efd",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{"frameRate":24,"name":"星星","version":"5.5","compatibleVersion":"5.5","armature":[{"type":"Armature","frameRate":24,"name":"armatureName","aabb":{"x":-49.5,"y":-54,"width":99,"height":109},"bone":[{"name":"root"},{"length":50,"name":"星星","parent":"root"}],"slot":[{"name":"1","parent":"星星"},{"name":"2","parent":"星星"},{"name":"3","parent":"星星"},{"name":"4","parent":"星星"},{"name":"5","parent":"星星"}],"skin":[{"slot":[{"name":"3","display":[{"name":"3","transform":{"y":0.5}}]},{"name":"5","display":[{"name":"5","transform":{"y":0.5}}]},{"name":"4","display":[{"name":"4","transform":{"y":0.5}}]},{"name":"2","display":[{"name":"2","transform":{"x":0.5}}]},{"name":"1","display":[{"name":"1","transform":{"x":0.5}}]}]}],"animation":[{"duration":21,"playTimes":0,"name":"newAnimation","slot":[{"name":"1","colorFrame":[{"duration":2},{"tweenEasing":0},{"duration":2,"tweenEasing":0,"value":{"aM":70}},{"tweenEasing":0,"value":{"aM":70}},{"duration":2,"tweenEasing":0,"value":{"aM":35}},{"tweenEasing":0,"value":{"aM":35}},{"duration":12,"value":{"aM":0}}]},{"name":"2","colorFrame":[{"duration":2,"tweenEasing":0,"value":{"aM":0}},{"tweenEasing":0,"value":{"aM":0}},{"duration":2,"tweenEasing":0},{"tweenEasing":0},{"duration":2,"tweenEasing":0,"value":{"aM":70}},{"tweenEasing":0,"value":{"aM":70}},{"duration":2,"tweenEasing":0,"value":{"aM":35}},{"tweenEasing":0,"value":{"aM":35}},{"duration":9,"value":{"aM":0}}]},{"name":"3","colorFrame":[{"duration":5,"tweenEasing":0,"value":{"aM":0}},{"tweenEasing":0,"value":{"aM":0}},{"duration":2,"tweenEasing":0},{"tweenEasing":0},{"duration":2,"tweenEasing":0,"value":{"aM":70}},{"tweenEasing":0,"value":{"aM":70}},{"duration":2,"tweenEasing":0,"value":{"aM":35}},{"tweenEasing":0,"value":{"aM":35}},{"duration":6,"value":{"aM":0}}]},{"name":"4","colorFrame":[{"duration":8,"tweenEasing":0,"value":{"aM":0}},{"tweenEasing":0,"value":{"aM":0}},{"duration":2,"tweenEasing":0},{"tweenEasing":0},{"duration":2,"tweenEasing":0,"value":{"aM":70}},{"tweenEasing":0,"value":{"aM":70}},{"duration":2,"tweenEasing":0,"value":{"aM":35}},{"tweenEasing":0,"value":{"aM":35}},{"duration":3,"value":{"aM":0}}]},{"name":"5","colorFrame":[{"duration":11,"tweenEasing":0,"value":{"aM":0}},{"tweenEasing":0,"value":{"aM":0}},{"duration":8,"tweenEasing":0},{"tweenEasing":0},{"duration":0,"value":{"aM":0}}]}]}],"defaultActions":[{"gotoAndPlay":"newAnimation"}]}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "f5c1977d-d6fc-4ab6-9496-39ea8c31d8d7",
"subMetas": {}
}
\ No newline at end of file
{"SubTexture":[{"width":60,"y":1,"height":66,"name":"1","x":102},{"width":68,"y":112,"height":76,"name":"2","x":173},{"width":79,"y":112,"height":89,"name":"3","x":92},{"width":89,"y":112,"height":99,"name":"4","x":1},{"width":99,"y":1,"height":109,"name":"5","x":1}],"width":256,"height":256,"name":"星星","imagePath":"星星_tex.png"}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "102525f7-7025-4b84-ba45-e8aef9eee61d",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "a7ae7f17-3bb0-48f8-a921-54e1543c6b91",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 256,
"height": 256,
"platformSettings": {},
"subMetas": {
"星星_tex": {
"ver": "1.0.4",
"uuid": "8cfdf452-fcfb-4d56-bc51-9376b1428c4d",
"rawTextureUuid": "a7ae7f17-3bb0-48f8-a921-54e1543c6b91",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -7,
"offsetY": 22,
"trimX": 1,
"trimY": 1,
"width": 240,
"height": 210,
"rawWidth": 256,
"rawHeight": 256,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
...@@ -87,25 +87,25 @@ ...@@ -87,25 +87,25 @@
"__id__": 60 "__id__": 60
}, },
{ {
"__id__": 85 "__id__": 87
}, },
{ {
"__id__": 87 "__id__": 89
}, },
{ {
"__id__": 101 "__id__": 103
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 102 "__id__": 104
}, },
{ {
"__id__": 103 "__id__": 105
}, },
{ {
"__id__": 104 "__id__": 106
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -2923,6 +2923,9 @@ ...@@ -2923,6 +2923,9 @@
}, },
{ {
"__id__": 83 "__id__": 83
},
{
"__id__": 85
} }
], ],
"_active": true, "_active": true,
...@@ -3077,7 +3080,7 @@ ...@@ -3077,7 +3080,7 @@
"__id__": 60 "__id__": 60
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 64 "__id__": 64
...@@ -4106,6 +4109,108 @@ ...@@ -4106,6 +4109,108 @@
"_N$cacheMode": 0, "_N$cacheMode": 0,
"_id": "b3rNELFNJADJp9Dj0OnDR+" "_id": "b3rNELFNJADJp9Dj0OnDR+"
}, },
{
"__type__": "cc.Node",
"_name": "star",
"_objFlags": 0,
"_parent": {
"__id__": 60
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 86
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 99,
"height": 109
},
"_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": "eakONcFQhDfr4rjda0cIff"
},
{
"__type__": "dragonBones.ArmatureDisplay",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 85
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_armatureName": "armatureName",
"_animationName": "newAnimation",
"_preCacheMode": 0,
"_cacheMode": 0,
"playTimes": 1,
"premultipliedAlpha": true,
"_armatureKey": "f5c1977d-d6fc-4ab6-9496-39ea8c31d8d7#102525f7-7025-4b84-ba45-e8aef9eee61d",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "f5c1977d-d6fc-4ab6-9496-39ea8c31d8d7"
},
"_N$dragonAtlasAsset": {
"__uuid__": "102525f7-7025-4b84-ba45-e8aef9eee61d"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 1,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$enableBatch": false,
"_id": "8ckTgPX2FOQ4ae1OI7w65U"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "layout_blocks", "_name": "layout_blocks",
...@@ -4117,7 +4222,7 @@ ...@@ -4117,7 +4222,7 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 86 "__id__": 88
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4173,7 +4278,7 @@ ...@@ -4173,7 +4278,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 85 "__id__": 87
}, },
"_enabled": true, "_enabled": true,
"alignMode": 1, "alignMode": 1,
...@@ -4203,9 +4308,6 @@ ...@@ -4203,9 +4308,6 @@
"__id__": 2 "__id__": 2
}, },
"_children": [ "_children": [
{
"__id__": 88
},
{ {
"__id__": 90 "__id__": 90
}, },
...@@ -4220,12 +4322,15 @@ ...@@ -4220,12 +4322,15 @@
}, },
{ {
"__id__": 98 "__id__": 98
},
{
"__id__": 100
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 100 "__id__": 102
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4281,13 +4386,13 @@ ...@@ -4281,13 +4386,13 @@
"_name": "img_keyboard_1", "_name": "img_keyboard_1",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 87 "__id__": 89
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 89 "__id__": 91
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4343,7 +4448,7 @@ ...@@ -4343,7 +4448,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 88 "__id__": 90
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4375,13 +4480,13 @@ ...@@ -4375,13 +4480,13 @@
"_name": "img_keyboard_2", "_name": "img_keyboard_2",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 87 "__id__": 89
}, },
"_children": [], "_children": [],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 91 "__id__": 93
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4437,7 +4542,7 @@ ...@@ -4437,7 +4542,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 90 "__id__": 92
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4469,13 +4574,13 @@ ...@@ -4469,13 +4574,13 @@
"_name": "img_keyboard_3", "_name": "img_keyboard_3",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 87 "__id__": 89
}, },
"_children": [], "_children": [],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 93 "__id__": 95
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4531,7 +4636,7 @@ ...@@ -4531,7 +4636,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 92 "__id__": 94
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4563,13 +4668,13 @@ ...@@ -4563,13 +4668,13 @@
"_name": "img_keyboard_4", "_name": "img_keyboard_4",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 87 "__id__": 89
}, },
"_children": [], "_children": [],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 95 "__id__": 97
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4625,7 +4730,7 @@ ...@@ -4625,7 +4730,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 94 "__id__": 96
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4657,13 +4762,13 @@ ...@@ -4657,13 +4762,13 @@
"_name": "img_keyboard_5", "_name": "img_keyboard_5",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 87 "__id__": 89
}, },
"_children": [], "_children": [],
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 97 "__id__": 99
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4719,7 +4824,7 @@ ...@@ -4719,7 +4824,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 96 "__id__": 98
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4751,13 +4856,13 @@ ...@@ -4751,13 +4856,13 @@
"_name": "label", "_name": "label",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 87 "__id__": 89
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 99 "__id__": 101
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4813,7 +4918,7 @@ ...@@ -4813,7 +4918,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 98 "__id__": 100
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4848,7 +4953,7 @@ ...@@ -4848,7 +4953,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 87 "__id__": 89
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -4909,7 +5014,7 @@ ...@@ -4909,7 +5014,7 @@
"hoverSprite": null, "hoverSprite": null,
"_N$disabledSprite": null, "_N$disabledSprite": null,
"_N$target": { "_N$target": {
"__id__": 87 "__id__": 89
}, },
"_id": "a5CSFc15pHJrUqBqHzlHYf" "_id": "a5CSFc15pHJrUqBqHzlHYf"
}, },
......
...@@ -50,11 +50,23 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -50,11 +50,23 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
gameStart() { gameStart() {
this.answerStr = "";
this.answerNodes = [];
this.updateQuestion(); this.updateQuestion();
this.updateHightLight(); this.updateHightLight();
this.updateWords(); this.updateWords();
} }
nextQuestion() {
// 所有全局变量 默认都是null
this._cantouch = true;
let data = GameNGT14.getIns().nextQuestion();
if (!data) {
//游戏结束
} else {
this.gameStart();
}
}
//----------------------------------------右上题目部分----------------------------------- //----------------------------------------右上题目部分-----------------------------------
private layout_question: cc.Node; private layout_question: cc.Node;
updateQuestion() { updateQuestion() {
...@@ -97,6 +109,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -97,6 +109,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
let base = pg.view.find(item, 'base'); let base = pg.view.find(item, 'base');
// 确定基础layout // 确定基础layout
let layout = pg.view.find(item, 'layout'); let layout = pg.view.find(item, 'layout');
layout.removeAllChildren();
let list: Array<Option> = data.getList(); let list: Array<Option> = data.getList();
list.forEach(option => { list.forEach(option => {
let blocks = option.getList(); let blocks = option.getList();
...@@ -172,6 +185,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -172,6 +185,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
} }
} }
getHightLightNodes() {
let list = GameNGT14.getIns().getHightList();
return this.layout_blocks.children.filter(node => {
return list.some(li => li.compare(node.data))
})
}
// 更新面板高亮 // 更新面板高亮
updateHightLight() { updateHightLight() {
let list = GameNGT14.getIns().getHightList(); let list = GameNGT14.getIns().getHightList();
...@@ -187,14 +206,34 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -187,14 +206,34 @@ export default class SceneComponent extends MyCocosSceneComponent {
first = true; first = true;
pg.view.visible(pg.view.find(node, 'img_focus2'), true) pg.view.visible(pg.view.find(node, 'img_focus2'), true)
} }
} else {
pg.view.visible(pg.view.find(node, 'img_undone'), true)
pg.view.visible(pg.view.find(node, 'img_focus'), false)
pg.view.visible(pg.view.find(node, 'img_focus2'), false)
} }
// else {
// pg.view.visible(pg.view.find(node, 'img_undone'), true)
// pg.view.visible(pg.view.find(node, 'img_focus'), false)
// pg.view.visible(pg.view.find(node, 'img_focus2'), false)
// }
})
}
// 更新面板颜色
updateBlockColor(nodes, nodeName) {
nodes.forEach(node => {
pg.view.visible(pg.view.find(node, 'img_undone'), false)
pg.view.visible(pg.view.find(node, 'img_focus'), false)
pg.view.visible(pg.view.find(node, 'img_keyboard_1'), false)
pg.view.visible(pg.view.find(node, 'img_keyboard_2'), false)
pg.view.visible(pg.view.find(node, 'img_keyboard_3'), false)
pg.view.visible(pg.view.find(node, 'img_keyboard_4'), false)
pg.view.visible(pg.view.find(node, 'img_keyboard_5'), false)
pg.view.visible(pg.view.find(node, 'img_right'), false)
pg.view.visible(pg.view.find(node, 'img_right_wrong'), false)
pg.view.visible(pg.view.find(node, 'img_wrong'), false)
pg.view.visible(pg.view.find(node, nodeName), true)
}) })
} }
// 更新当前面板颜色 // 更新当前面板颜色
private answerStr: string;
private answerNodes: Array<cc.Node>;
updateCurrentNodeColor(node, data) { updateCurrentNodeColor(node, data) {
let label = node.getChildByName('label') let label = node.getChildByName('label')
pg.view.visible(label, true) pg.view.visible(label, true)
...@@ -204,6 +243,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -204,6 +243,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
let block = node.data; let block = node.data;
block.val = data.word; block.val = data.word;
this.answerStr += data.word;
this.answerNodes.push(node);
} }
getBlockNodeByPos(x, y) { getBlockNodeByPos(x, y) {
...@@ -231,8 +272,11 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -231,8 +272,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
node.x = 280 + space.x * (index - 9) node.x = 280 + space.x * (index - 9)
node.y = -110 - space.y * 2; node.y = -110 - space.y * 2;
} }
data.pos = cc.v2(node)
this.layout_words.addChild(node); this.layout_words.addChild(node);
data.pos = cc.v2(node)
//入场动画
node.x = node.x + 1000;
cc.tween(node).delay(0.1 * index).by(0.5, { x: -1000 }).start();
this.updateWord(node, data); this.updateWord(node, data);
}); });
} }
...@@ -274,8 +318,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -274,8 +318,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
onItemTouchEnd(e) { onItemTouchEnd(e) {
let target: cc.Node = e.target; let target: cc.Node = e.target;
let data = target.data; let data = target.data;
if (!this.touching) return; if (!this.touching ||
if (this.touching != data) return; this.touching != data
) {
this.touching = null;
target.x = target.data.pos.x;
target.y = target.data.pos.y;
return;
}
// let rect = cc.rect(target.x, target.y, target.width, target.height); // let rect = cc.rect(target.x, target.y, target.width, target.height);
let rect = cc.rect(target.x, target.y, 1, 1); let rect = cc.rect(target.x, target.y, 1, 1);
//坐标转换 //坐标转换
...@@ -292,12 +342,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -292,12 +342,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
}) })
//是否碰撞 //是否碰撞
if (!collNode) { if (!collNode || !collNode.data.rightVal || !!collNode.data.val) {
this.touching = null; this.touching = null;
target.x = target.data.pos.x; target.x = target.data.pos.x;
target.y = target.data.pos.y; target.y = target.data.pos.y;
return; return;
} }
//是否正确 //是否正确
this.playLocalAudio('move').then(() => { }) this.playLocalAudio('move').then(() => { })
let item = target; let item = target;
...@@ -312,30 +364,80 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -312,30 +364,80 @@ export default class SceneComponent extends MyCocosSceneComponent {
item.off(cc.Node.EventType.TOUCH_CANCEL, this.onItemTouchCancel, this); item.off(cc.Node.EventType.TOUCH_CANCEL, this.onItemTouchCancel, this);
// 判断此行是否完成 // 判断此行是否完成
let lineFull = true; let lineFull = this.answerStr.length == GameNGT14.getIns().getCurrent().answer.length;
let isRight = this.answerStr == GameNGT14.getIns().getCurrent().answer
if (lineFull) { if (lineFull) {
let nodes = this.getHightLightNodes();
if (isRight) {
//执行放大10%
nodes.forEach((node, index) => {
//执行星星动画
this.scheduleOnce(() => {
pg.view.visible(pg.view.find(node, 'star'), true)
cc.tween(node).by(0.2, { scale: 0.1 }).by(0.2, { scale: -0.1 }).start();
if (index == nodes.length - 1) {
this.scheduleOnce(() => {
//执行颜色变right
this.updateBlockColor(nodes, 'img_right')
//播放right音效
this.playLocalAudio('right').then(() => {
pg.event.emit('mouse_05_add')
//其他字母向下掉出
this.layout_words.children.forEach((node, index) => {
cc.tween(node)
.delay(0.05 * index)
.by(0.3, { y: -1000 })
.delay(0.3)
.call(() => {
this.nextQuestion();
})
.start();
})
})
}, 0.3)
}
}, 0.1 * index)
})
} else {
//执行颜色变error
this.updateBlockColor(nodes, 'img_wrong')
//播放error音频
this.playLocalAudio('error').then(() => {
//执行放大10%
nodes.forEach(node => {
cc.tween(node)
.by(0.2, { scale: 0.1 })
.by(0.2, { scale: -0.1 })
.call(() => {
})
.start();
})
this.scheduleOnce(() => {
//执行颜色变right_wrong
this.updateBlockColor(nodes, 'img_right_wrong')
//播放音频right_wrong
this.playLocalAudio('right_wrong')
//播放灰色徽章
pg.event.emit("mouse_10_add_error");
//其他字母向下掉出
this.layout_words.children.forEach((node, index) => {
cc.tween(node)
.delay(0.05 * index)
.by(0.3, { y: -1000 })
.delay(0.1)
.call(() => {
this.nextQuestion();
})
.start();
})
}, 1)
})
}
} else { } else {
// 下一个格子刷新聚焦 // 下一个格子刷新聚焦
this.updateHightLight(); this.updateHightLight();
} }
}).start(); }).start();
// this.playLocalAudio('right').then(() => {
// if (data.audioUrl) {
// pg.audio.playAudioByUrlThen(data.audioUrl).then(() => {
// this.touching = null;
// })
// } else {
// this.touching = null;
// }
// })
// this.touching = null;
// target.x = target.data.pos.x;
// target.y = target.data.pos.y;
// 检测一行是否完成, 完成加星星
// pg.event.emit('mouse_05_add')
return; return;
......
...@@ -15,12 +15,12 @@ const { ccclass, property } = cc._decorator; ...@@ -15,12 +15,12 @@ const { ccclass, property } = cc._decorator;
export default class Ngt_star_10 extends cc.Component { export default class Ngt_star_10 extends cc.Component {
// LIFE-CYCLE CALLBACKS: // LIFE-CYCLE CALLBACKS:
onLoad() { onLoad() {
pg.event.on("mouse_10_add", (isRight = true) => {
this.showBigStar(isRight);
});
pg.event.on("mouse_10_num", (max: number) => { pg.event.on("mouse_10_num", (max: number) => {
this.initStar(max); this.initStar(max);
}); });
pg.event.on("mouse_10_add", (isRight = true) => {
this.showBigStar(isRight);
});
pg.event.on("mouse_10_add_error", (isRight = true) => { pg.event.on("mouse_10_add_error", (isRight = true) => {
this.showErrorStar(); this.showErrorStar();
}); });
......
...@@ -178,6 +178,10 @@ export class GameNGT14 { ...@@ -178,6 +178,10 @@ export class GameNGT14 {
getCurrent(): Question { getCurrent(): Question {
return this.questions[this.current]; return this.questions[this.current];
} }
nextQuestion() {
this.current++;
return this.getCurrent();
}
static ins: GameNGT14; static ins: GameNGT14;
static getIns(): GameNGT14 { static getIns(): GameNGT14 {
if (!GameNGT14.ins) GameNGT14.ins = new GameNGT14(); if (!GameNGT14.ins) GameNGT14.ins = new GameNGT14();
......
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