Commit 2f224257 authored by 范雪寒's avatar 范雪寒

fix: bugs

parent 618dfdb1
......@@ -17,7 +17,7 @@
"__id__": 2
},
{
"__id__": 70
"__id__": 72
}
],
"_active": false,
......@@ -96,13 +96,13 @@
"_active": true,
"_components": [
{
"__id__": 67
"__id__": 69
},
{
"__id__": 68
"__id__": 70
},
{
"__id__": 69
"__id__": 71
}
],
"_prefab": null,
......@@ -1063,13 +1063,13 @@
"__id__": 25
},
{
"__id__": 46
"__id__": 48
},
{
"__id__": 49
"__id__": 51
},
{
"__id__": 52
"__id__": 54
}
],
"_active": true,
......@@ -1159,6 +1159,9 @@
},
{
"__id__": 44
},
{
"__id__": 46
}
],
"_active": true,
......@@ -1965,7 +1968,7 @@
},
{
"__type__": "cc.Node",
"_name": "hole_2",
"_name": "icon_bigstar",
"_objFlags": 0,
"_parent": {
"__id__": 25
......@@ -1986,6 +1989,100 @@
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 278,
"height": 275
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
300.959,
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": "31ELgkCyJLDo+xA8HORNic"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 42
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "34d97abe-f3fb-4599-9d5a-55e730f6d897"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "698kruQypGSLxixeCT5p1A"
},
{
"__type__": "cc.Node",
"_name": "hole_2",
"_objFlags": 0,
"_parent": {
"__id__": 25
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 45
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 260,
......@@ -2030,7 +2127,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 42
"__id__": 44
},
"_enabled": true,
"_materials": [
......@@ -2068,7 +2165,7 @@
"_active": true,
"_components": [
{
"__id__": 45
"__id__": 47
}
],
"_prefab": null,
......@@ -2124,7 +2221,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 44
"__id__": 46
},
"_enabled": true,
"_materials": [
......@@ -2160,7 +2257,7 @@
},
"_children": [
{
"__id__": 47
"__id__": 49
}
],
"_active": true,
......@@ -2218,13 +2315,13 @@
"_name": "Berlin Sans FB",
"_objFlags": 0,
"_parent": {
"__id__": 46
"__id__": 48
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 48
"__id__": 50
}
],
"_prefab": null,
......@@ -2280,7 +2377,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 47
"__id__": 49
},
"_enabled": true,
"_materials": [
......@@ -2319,7 +2416,7 @@
},
"_children": [
{
"__id__": 50
"__id__": 52
}
],
"_active": true,
......@@ -2377,13 +2474,13 @@
"_name": "star",
"_objFlags": 0,
"_parent": {
"__id__": 49
"__id__": 51
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 51
"__id__": 53
}
],
"_prefab": null,
......@@ -2439,7 +2536,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 50
"__id__": 52
},
"_enabled": true,
"_materials": [
......@@ -2482,9 +2579,6 @@
"__id__": 24
},
"_children": [
{
"__id__": 53
},
{
"__id__": 55
},
......@@ -2502,6 +2596,9 @@
},
{
"__id__": 65
},
{
"__id__": 67
}
],
"_active": true,
......@@ -2559,13 +2656,13 @@
"_name": "end",
"_objFlags": 0,
"_parent": {
"__id__": 52
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 54
"__id__": 56
}
],
"_prefab": null,
......@@ -2621,7 +2718,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 53
"__id__": 55
},
"_enabled": true,
"_clip": {
......@@ -2640,13 +2737,13 @@
"_name": "wrong",
"_objFlags": 0,
"_parent": {
"__id__": 52
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 56
"__id__": 58
}
],
"_prefab": null,
......@@ -2702,7 +2799,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 55
"__id__": 57
},
"_enabled": true,
"_clip": {
......@@ -2721,13 +2818,13 @@
"_name": "right",
"_objFlags": 0,
"_parent": {
"__id__": 52
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 58
"__id__": 60
}
],
"_prefab": null,
......@@ -2783,7 +2880,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 57
"__id__": 59
},
"_enabled": true,
"_clip": {
......@@ -2802,13 +2899,13 @@
"_name": "appear",
"_objFlags": 0,
"_parent": {
"__id__": 52
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 60
"__id__": 62
}
],
"_prefab": null,
......@@ -2864,7 +2961,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 59
"__id__": 61
},
"_enabled": true,
"_clip": {
......@@ -2883,13 +2980,13 @@
"_name": "star",
"_objFlags": 0,
"_parent": {
"__id__": 52
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 62
"__id__": 64
}
],
"_prefab": null,
......@@ -2945,7 +3042,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 61
"__id__": 63
},
"_enabled": true,
"_clip": {
......@@ -2964,13 +3061,13 @@
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 52
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 64
"__id__": 66
}
],
"_prefab": null,
......@@ -3026,7 +3123,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 63
"__id__": 65
},
"_enabled": true,
"_clip": {
......@@ -3045,13 +3142,13 @@
"_name": "big_star",
"_objFlags": 0,
"_parent": {
"__id__": 52
"__id__": 54
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 66
"__id__": 68
}
],
"_prefab": null,
......@@ -3107,7 +3204,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 65
"__id__": 67
},
"_enabled": true,
"_clip": {
......@@ -3185,9 +3282,6 @@
"__id__": 1
},
"_children": [
{
"__id__": 71
},
{
"__id__": 73
},
......@@ -3208,6 +3302,9 @@
},
{
"__id__": 85
},
{
"__id__": 87
}
],
"_active": false,
......@@ -3265,13 +3362,13 @@
"_name": "sahua",
"_objFlags": 0,
"_parent": {
"__id__": 70
"__id__": 72
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 72
"__id__": 74
}
],
"_prefab": null,
......@@ -3327,7 +3424,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 71
"__id__": 73
},
"_enabled": true,
"_materials": [
......@@ -3359,13 +3456,13 @@
"_name": "sahua",
"_objFlags": 0,
"_parent": {
"__id__": 70
"__id__": 72
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 74
"__id__": 76
}
],
"_prefab": null,
......@@ -3421,7 +3518,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 73
"__id__": 75
},
"_enabled": true,
"_materials": [
......@@ -3453,13 +3550,13 @@
"_name": "sahua",
"_objFlags": 0,
"_parent": {
"__id__": 70
"__id__": 72
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 76
"__id__": 78
}
],
"_prefab": null,
......@@ -3515,7 +3612,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 75
"__id__": 77
},
"_enabled": true,
"_materials": [
......@@ -3547,13 +3644,13 @@
"_name": "sahua",
"_objFlags": 0,
"_parent": {
"__id__": 70
"__id__": 72
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 78
"__id__": 80
}
],
"_prefab": null,
......@@ -3609,7 +3706,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 77
"__id__": 79
},
"_enabled": true,
"_materials": [
......@@ -3641,13 +3738,13 @@
"_name": "sahua",
"_objFlags": 0,
"_parent": {
"__id__": 70
"__id__": 72
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 80
"__id__": 82
}
],
"_prefab": null,
......@@ -3703,7 +3800,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 79
"__id__": 81
},
"_enabled": true,
"_materials": [
......@@ -3735,13 +3832,13 @@
"_name": "sahua",
"_objFlags": 0,
"_parent": {
"__id__": 70
"__id__": 72
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 82
"__id__": 84
}
],
"_prefab": null,
......@@ -3797,7 +3894,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 81
"__id__": 83
},
"_enabled": true,
"_materials": [
......@@ -3829,13 +3926,13 @@
"_name": "sahua",
"_objFlags": 0,
"_parent": {
"__id__": 70
"__id__": 72
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 84
"__id__": 86
}
],
"_prefab": null,
......@@ -3891,7 +3988,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 83
"__id__": 85
},
"_enabled": true,
"_materials": [
......@@ -3923,13 +4020,13 @@
"_name": "sahua",
"_objFlags": 0,
"_parent": {
"__id__": 70
"__id__": 72
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 86
"__id__": 88
}
],
"_prefab": null,
......@@ -3985,7 +4082,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 85
"__id__": 87
},
"_enabled": true,
"_materials": [
......
......@@ -99,7 +99,7 @@ cc.Class({
},
getDefaultData() {
const dataJson = '{"groupArr":[{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"aaa"},{"type":"text","isRight":"0","text":"bbb"},{"type":"text","isRight":"0","text":"ccc"}]}]}';
const dataJson = '{"groupArr":[{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"bdpq"},{"type":"text","isRight":"0","text":"ooo"}]},{"ques":"","optionArr":[{"type":"text","isRight":"1","text":"pad"},{"type":"text","isRight":"0","text":"ggff"},{"type":"text","isRight":"0","text":"OOO"}]}]}';
const data1 = JSON.parse(dataJson);
return data1;
},
......@@ -249,7 +249,7 @@ cc.Class({
bigStarArr: null,
initStar() {
const gArr = this.data.groupArr;
if (gArr.length < 1) {
if (gArr.length <= 1) {
return;
}
......@@ -269,6 +269,11 @@ cc.Class({
starTop.active = false;
starBg.star = starTop;
const starBig = getSprNode('icon_bigstar');
starBg.addChild(starBig);
starBig.active = false;
starBg.starBig = starBig;
this.bigStarArr.push(starBg);
}
},
......@@ -322,8 +327,7 @@ cc.Class({
},
startBtnClicked() {
this.showQuestion();
playAudio(this.btnClip, () => {
this.showQuestion(() => {
cc.tween(this)
.delay(0.3)
.call(() => {
......@@ -331,6 +335,7 @@ cc.Class({
})
.start();
});
playAudio(this.btnClip);
},
restartBtnClicked() {
......@@ -341,6 +346,9 @@ cc.Class({
},
hideBigStar() {
if (!this.bigStarArr) {
return;
}
for (let i = 0; i < this.bigStarArr.length; i++) {
cc.tween(this.bigStarArr[i].star)
.to(0.5, { scale: 0 }, { easing: 'cubicOut' })
......@@ -353,18 +361,22 @@ cc.Class({
const btn = cc.find('Canvas/btn_laba')
btn.addComponent(cc.Button);
btn.on('click', () => {
this.showQuestion();
playAudio(this.btnClip);
playAudio(this.btnClip, () => {
this.showQuestion();
});
})
},
showQuestion() {
showQuestion(func) {
var anim = cc.find('Canvas/btn_laba').getComponent(cc.Animation);
anim.play();
playAudioByUrl(this.curGroup.audio_url, () => {
anim.stop();
if (func && typeof (func) == 'function') {
func();
}
});
......@@ -604,35 +616,54 @@ cc.Class({
},
showBigStar() {
if (!this.bigStarArr || this.bigStarArr.length <= 0) {
this.checkGameEnd();
return;
}
const bigStarBg = this.bigStarArr[this.groupIndex];
const star = bigStarBg.star;
star.active = true;
star.opacity = 0;
star.scale = 7 * this._mapScaleMin;
star.rotation = 0;
star.scale = 1;
star.angle = 0;
const canvas = cc.find('Canvas');
const starBig = bigStarBg.starBig;
starBig.active = true;
starBig.scale = 1;
starBig.angle = -90;
const pos = star.parent.convertToNodeSpaceAR(canvas.convertToWorldSpaceAR(cc.v2(0, -canvas.height / 2)));
star.x = pos.x;
star.y = pos.y;
const canvas = cc.find('Canvas');
const startPos = star.parent.convertToNodeSpaceAR(canvas.convertToWorldSpaceAR(cc.v2(0, -canvas.height / 2)));
starBig.x = startPos.x;
starBig.y = startPos.y;
star.x = startPos.x;
star.y = startPos.y;
const time = 1;
cc.tween(star)
.delay(time / 3)
.to(time * 2 / 3, { x: 0 })
.to(time, { x: 0 }, { easing: 'quadIn' })
.start();
cc.tween(star)
.to(time, { y: 0 }, { easing: 'quadInOut' })
.to(time, { angle: -720 })
.start();
cc.tween(star)
.to(time, { scale: 1, opacity: 255, rotation: 360 }, { easing: 'quadOut' })
.to(time, { y: 0, scale: 1, opacity: 255 }, { easing: 'quadOut' })
.call(() => {
this.checkGameEnd();
})
.start();
cc.tween(starBig)
.to(time, { x: 0 }, { easing: 'quadIn' })
.start();
cc.tween(starBig)
.to(time, { angle: -720 - 90 })
.start();
cc.tween(starBig)
.to(time, { y: 0, scale: 0 }, { easing: 'quadOut' })
.start();
playAudio(this.bigStarClip);
},
......@@ -645,11 +676,13 @@ cc.Class({
return;
}
await asyncDelay(3);
await asyncDelay(1);
this.initCurGroup();
this.showOnePenguin();
this.showQuestion();
this.showQuestion(()=>{
this.showOnePenguin();
});
},
gameEnd() {
......@@ -741,7 +774,7 @@ cc.Class({
cc.Color.fromHEX(color, 'c1431d');
labelNode.color = color;
labelNode.y = 5;
labelNode.y = -2.5;
textPanel.label = label;
......
......@@ -72,7 +72,7 @@ export function setSprNodeMaxLen(sprNode, maxW, maxH) {
export function getSpriteFrimeByUrl(url, cb) {
cc.loader.load({url}, (err, img) => {
cc.loader.load({ url }, (err, img) => {
const spriteFrame = new cc.SpriteFrame(img)
if (cb) {
cb(spriteFrame);
......@@ -100,24 +100,28 @@ export function getSprNodeByUrl(url, cb) {
export function playAudio(audioClip, cb=null) {
if (audioClip) {
export function playAudio(audioClip, cb = null) {
if (audioClip) {
const audioId = cc.audioEngine.playEffect(audioClip, false, 0.8);
if (cb) {
cc.audioEngine.setFinishCallback(audioId, () => {
cb();
});
}
}
}
}
export function playAudioByUrl(audio_url, cb=null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
export function playAudioByUrl(audio_url, cb = null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
playAudio(audioClip, cb);
});
}
});
} else {
if (cb && typeof (cb) == 'function') {
cb();
}
}
}
......
{
"ver": "2.3.5",
"uuid": "d3a49532-95aa-4e7c-928b-a27b02497a8f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 278,
"height": 275,
"platformSettings": {},
"subMetas": {
"icon_bigstar": {
"ver": "1.0.4",
"uuid": "34d97abe-f3fb-4599-9d5a-55e730f6d897",
"rawTextureUuid": "d3a49532-95aa-4e7c-928b-a27b02497a8f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 278,
"height": 275,
"rawWidth": 278,
"rawHeight": 275,
"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