Commit ff7f7c72 authored by 范雪寒's avatar 范雪寒

feat: 更改为prefab的形式,便于导出

parent 7f038a34
File added
{
"ver": "1.1.2",
"uuid": "aafdf165-a49b-4d39-9272-f86513fed793",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "StarScore",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 6
}
],
"_active": true,
"_components": [
{
"__id__": 15
}
],
"_prefab": {
"__id__": 16
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_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": ""
},
{
"__type__": "cc.Node",
"_name": "layout",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 4
}
],
"_prefab": {
"__id__": 5
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 50,
"height": 500
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 1,
"y": 1
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
600,
320,
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": ""
},
{
"__type__": "cc.Layout",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_layoutSize": {
"__type__": "cc.Size",
"width": 50,
"height": 500
},
"_resize": 0,
"_N$layoutType": 3,
"_N$cellSize": {
"__type__": "cc.Size",
"width": 40,
"height": 40
},
"_N$startAxis": 1,
"_N$paddingLeft": 0,
"_N$paddingRight": 0,
"_N$paddingTop": 0,
"_N$paddingBottom": 0,
"_N$spacingX": 10,
"_N$spacingY": 10,
"_N$verticalDirection": 1,
"_N$horizontalDirection": 1,
"_N$affectedByScale": true,
"_id": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 2,
"_target": null,
"_alignFlags": 33,
"_left": 0,
"_right": 40,
"_top": 40,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "98QDT4j/ZP8JxEnUEDU0j8",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "StarBase",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 7
}
],
"_active": true,
"_components": [
{
"__id__": 13
}
],
"_prefab": {
"__id__": 14
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 62,
"height": 66
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-833.71,
-508.737,
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": ""
},
{
"__type__": "cc.Node",
"_name": "Star",
"_objFlags": 0,
"_parent": {
"__id__": 6
},
"_children": [
{
"__id__": 8
}
],
"_active": false,
"_components": [
{
"__id__": 11
}
],
"_prefab": {
"__id__": 12
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 62,
"height": 69
},
"_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": ""
},
{
"__type__": "cc.Node",
"_name": "StarBig",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 9
}
],
"_prefab": {
"__id__": 10
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"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,
0,
0,
0,
0,
-0.7071067811865475,
0.7071067811865476,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": -90
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "b00d89ac-54ee-4b06-878a-acef8c97f0df"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "c0jvvYWS5EbZXy198BfKF0",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "f72965fe-cf21-4551-adcb-6bdc04be67a0"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "6alefhtH9DRoDtggQRJAoB",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "542bf56d-a861-4e7d-8235-cd0cb39a7ba9"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "a7ZpDZc/BBB5NyG9IaSlNq",
"sync": false
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.9",
"uuid": "cb251ca0-8be4-41e6-9c06-6461d59ff7c0",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
const {ccclass, property} = cc._decorator;
@ccclass
export default class StarScore extends cc.Component {
starLength = 0;
addStar() {
this.starLength++;
let length = this.starLength;
const starLayout = cc.find('layout', this.node);
starLayout.removeAllChildren();
const paddingY = starLayout.getComponent(cc.Layout).spacingY;
for (let i = 0; i < length; i++) {
const starBase = cc.instantiate(cc.find('StarBase', this.node));
starBase.name = `starBase_${i}`;
starBase.scale = this.Between(0.5, (starLayout.height / length - paddingY) / starBase.height, 1);
starBase.parent = starLayout;
}
this.currentStarIdx = 0;
}
currentStarIdx = 0;
showStar() {
const starBase = cc.find(`layout/starBase_${this.currentStarIdx}`, this.node);
if (!starBase) {
return;
}
const star = starBase.getChildByName('Star');
const starBig = star.getChildByName('StarBig');
starBig.scale = 1;
star.active = true;
star.scaleX = 0.7 / starBase.scale;
star.scaleY = 1 / starBase.scale;
star.angle = 90;
const canvas = cc.find('Canvas');
const startPos = this.exchangeNodePos(star.parent, canvas, cc.v2(0, -canvas.height / 2));
const middlePos = this.exchangeNodePos(star.parent, canvas, cc.v2(0, -canvas.height / 4));
star.x = startPos.x;
star.y = startPos.y - starBig.height;
console.log('middlePos = ' + JSON.stringify(middlePos));
cc.tween(star)
.to(0.3, { y: middlePos.y + 80 }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y + 40, scaleX: 1.2 / starBase.scale, scaleY: 0.8 / starBase.scale }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y, scaleX: 1 / starBase.scale, scaleY: 1 / starBase.scale }, { easing: 'quadOut' })
.delay(0.1)
.to(0.8, { angle: -720, scale: 1 })
.start();
cc.tween(star)
.delay(0.6)
.to(0.8, { x: 0 }, { easing: 'quadIn' })
.start();
cc.tween(star)
.delay(0.6)
.to(0.8, { y: 0 }, { easing: 'quadOut' })
.start();
cc.tween(starBig)
.delay(0.6)
.to(0.8, { scale: 0 }, { easing: 'quadOut' })
.call(() => {
// this.checkGameEnd();
})
.start();
this.currentStarIdx++;
}
Between(a, b, c) {
return [a, b, c].sort()[1];
}
exchangeNodePos(targetNode, baseNode, basePos) {
return targetNode.convertToNodeSpaceAR(baseNode.convertToWorldSpaceAR(cc.v2(basePos.x, basePos.y)));
}
}
{
"ver": "1.0.8",
"uuid": "0857bc6c-6ff1-4e05-966e-0c1db1fa3dc2",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
......@@ -15,9 +15,6 @@
"_children": [
{
"__id__": 2
},
{
"__id__": 27
}
],
"_active": true,
......@@ -78,22 +75,22 @@
"__id__": 5
},
{
"__id__": 8
"__id__": 22
},
{
"__id__": 16
"__id__": 30
}
],
"_active": true,
"_components": [
{
"__id__": 24
"__id__": 38
},
{
"__id__": 25
"__id__": 39
},
{
"__id__": 26
"__id__": 40
}
],
"_prefab": null,
......@@ -244,22 +241,98 @@
},
{
"__type__": "cc.Node",
"_name": "layout",
"_name": "StarScore",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_children": [
{
"__id__": 6
},
{
"__id__": 10
}
],
"_active": true,
"_components": [
{
"__id__": 6
"__id__": 19
},
{
"__id__": 20
}
],
"_prefab": {
"__id__": 21
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_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": "056t30NDVIarSH0ZbCRb1m"
},
{
"__type__": "cc.Node",
"_name": "layout",
"_objFlags": 0,
"_parent": {
"__id__": 5
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 7
},
{
"__id__": 8
}
],
"_prefab": null,
"_prefab": {
"__id__": 9
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
......@@ -312,7 +385,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
"__id__": 6
},
"_enabled": true,
"_layoutSize": {
......@@ -344,10 +417,10 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
"__id__": 6
},
"_enabled": true,
"alignMode": 1,
"alignMode": 2,
"_target": null,
"_alignFlags": 33,
"_left": 0,
......@@ -366,28 +439,38 @@
"_originalHeight": 0,
"_id": "d7gnmxSWJPV4wGWih5+7Hx"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 5
},
"asset": {
"__uuid__": "cb251ca0-8be4-41e6-9c06-6461d59ff7c0"
},
"fileId": "98QDT4j/ZP8JxEnUEDU0j8",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "BtnShowStar",
"_name": "StarBase",
"_objFlags": 0,
"_parent": {
"__id__": 2
"__id__": 5
},
"_children": [
{
"__id__": 9
"__id__": 11
}
],
"_active": true,
"_components": [
{
"__id__": 14
},
{
"__id__": 15
"__id__": 17
}
],
"_prefab": null,
"_prefab": {
"__id__": 18
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
......@@ -398,8 +481,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 40
"width": 62,
"height": 66
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -410,8 +493,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
200,
-310,
-833.71,
-508.737,
0,
0,
0,
......@@ -433,30 +516,29 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "1dJvlXTo9NSpvfMQHJ7D8m"
"_id": "caYUJQLsRA5raLY3euWf0C"
},
{
"__type__": "cc.Node",
"_name": "Background",
"_objFlags": 512,
"_name": "Star",
"_objFlags": 0,
"_parent": {
"__id__": 8
"__id__": 10
},
"_children": [
{
"__id__": 10
"__id__": 12
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 12
},
{
"__id__": 13
"__id__": 15
}
],
"_prefab": null,
"_prefab": {
"__id__": 16
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
......@@ -467,8 +549,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 40
"width": 62,
"height": 69
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -502,35 +584,37 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "d1o3DwgQJOA731lniEE8ch"
"_id": "1ei0HhhfNI55S64CkxHS+5"
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 512,
"_name": "StarBig",
"_objFlags": 0,
"_parent": {
"__id__": 9
"__id__": 11
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 11
"__id__": 13
}
],
"_prefab": null,
"_prefab": {
"__id__": 14
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 40
"width": 278,
"height": 275
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -546,8 +630,8 @@
0,
0,
0,
0,
1,
-0.7071067811865475,
0.7071067811865476,
1,
1,
1
......@@ -557,21 +641,21 @@
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
"z": -90
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "b9XwNjhRFDQ484uhJJDHKa"
"_id": "3f7u5hhEZJvaLGSJYAKli0"
},
{
"__type__": "cc.Label",
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
"__id__": 12
},
"_enabled": true,
"_materials": [
......@@ -581,30 +665,40 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "播放",
"_N$string": "播放",
"_fontSize": 20,
"_lineHeight": 40,
"_enableWrapText": false,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 1,
"_N$cacheMode": 1,
"_id": "77QON6XRxLWbPlcJmOVdfp"
"_spriteFrame": {
"__uuid__": "b00d89ac-54ee-4b06-878a-acef8c97f0df"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "aebDpLzF5N5aVHTOPJ56UN"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 5
},
"asset": {
"__uuid__": "cb251ca0-8be4-41e6-9c06-6461d59ff7c0"
},
"fileId": "c0jvvYWS5EbZXy198BfKF0",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
"__id__": 11
},
"_enabled": true,
"_materials": [
......@@ -615,10 +709,10 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
"__uuid__": "f72965fe-cf21-4551-adcb-6bdc04be67a0"
},
"_type": 1,
"_sizeMode": 0,
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
......@@ -629,134 +723,79 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "73VqOCOstGeIWvE3JqS/V7"
"_id": "0civ9QyulAUbDVzlMv7XVa"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 9
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 5
},
"_enabled": true,
"alignMode": 0,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 100,
"_originalHeight": 40,
"_id": "071bHfRGxKUrsYWhCAdWe/"
"asset": {
"__uuid__": "cb251ca0-8be4-41e6-9c06-6461d59ff7c0"
},
"fileId": "6alefhtH9DRoDtggQRJAoB",
"sync": false
},
{
"__type__": "cc.Button",
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
"__id__": 10
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 2,
"transition": 2,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 230,
"g": 230,
"b": 230,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 200,
"g": 200,
"b": 200,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 200,
"g": 200,
"b": 200,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 120,
"g": 120,
"b": 120,
"a": 200
},
"_N$normalSprite": {
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
},
"_N$pressedSprite": {
"__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
},
"pressedSprite": {
"__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
},
"_N$hoverSprite": {
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "542bf56d-a861-4e7d-8235-cd0cb39a7ba9"
},
"hoverSprite": {
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_N$disabledSprite": {
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "6cOaTXFFhMNL1V2Pj1N8xd"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 5
},
"_N$target": {
"__id__": 9
"asset": {
"__uuid__": "cb251ca0-8be4-41e6-9c06-6461d59ff7c0"
},
"_id": "9eXZnPPItIwaJ6QyH6KKd/"
"fileId": "a7ZpDZc/BBB5NyG9IaSlNq",
"sync": false
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
"__id__": 5
},
"_enabled": true,
"alignMode": 1,
"alignMode": 2,
"_target": null,
"_alignFlags": 20,
"_alignFlags": 45,
"_left": 0,
"_right": 213,
"_right": 0,
"_top": 0,
"_bottom": 30,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 200,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
......@@ -765,27 +804,50 @@
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "953bIyAnlI8Li4AkmntVgA"
"_id": "e9GKWUSm1B8JoaC3orwy/L"
},
{
"__type__": "0857bxsb/FOBZZuDB2x+j3C",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"label": null,
"text": "hello",
"_id": "feUJnYCjZAE724ocsgAGel"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 5
},
"asset": {
"__uuid__": "cb251ca0-8be4-41e6-9c06-6461d59ff7c0"
},
"fileId": "",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "BtnAddStar",
"_name": "BtnShowStar",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 17
"__id__": 23
}
],
"_active": true,
"_components": [
{
"__id__": 22
"__id__": 28
},
{
"__id__": 23
"__id__": 29
}
],
"_prefab": null,
......@@ -811,7 +873,7 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-200,
200,
-310,
0,
0,
......@@ -834,27 +896,27 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "0ceHmZk1hGO4j0cKMB8KsG"
"_id": "1dJvlXTo9NSpvfMQHJ7D8m"
},
{
"__type__": "cc.Node",
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__": 16
"__id__": 22
},
"_children": [
{
"__id__": 18
"__id__": 24
}
],
"_active": true,
"_components": [
{
"__id__": 20
"__id__": 26
},
{
"__id__": 21
"__id__": 27
}
],
"_prefab": null,
......@@ -903,20 +965,20 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "83JdtqpLhIsoN6oCCXXi1H"
"_id": "d1o3DwgQJOA731lniEE8ch"
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 17
"__id__": 23
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 19
"__id__": 25
}
],
"_prefab": null,
......@@ -965,14 +1027,14 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "d57GBcQSpCi6cec1I7sN8j"
"_id": "b9XwNjhRFDQ484uhJJDHKa"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
"__id__": 24
},
"_enabled": true,
"_materials": [
......@@ -982,8 +1044,8 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "增加星星",
"_N$string": "增加星星",
"_string": "播放",
"_N$string": "播放",
"_fontSize": 20,
"_lineHeight": 40,
"_enableWrapText": false,
......@@ -998,14 +1060,14 @@
"_N$fontFamily": "Arial",
"_N$overflow": 1,
"_N$cacheMode": 1,
"_id": "bdtX88qdFJsJyQtT9jmZMT"
"_id": "77QON6XRxLWbPlcJmOVdfp"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
"__id__": 23
},
"_enabled": true,
"_materials": [
......@@ -1030,14 +1092,14 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "baaIwLupVGqatQGUxpQOkO"
"_id": "73VqOCOstGeIWvE3JqS/V7"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 17
"__id__": 23
},
"_enabled": true,
"alignMode": 0,
......@@ -1057,14 +1119,14 @@
"_isAbsVerticalCenter": true,
"_originalWidth": 100,
"_originalHeight": 40,
"_id": "97S5yj4PhCVI5UFMrd//gL"
"_id": "071bHfRGxKUrsYWhCAdWe/"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
"__id__": 22
},
"_enabled": true,
"_normalMaterial": null,
......@@ -1137,71 +1199,27 @@
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 17
"__id__": 23
},
"_id": "175x0yGZhMuYnDccKEjZC+"
"_id": "9eXZnPPItIwaJ6QyH6KKd/"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
"__id__": 22
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 20,
"_left": 0,
"_right": 0,
"_right": 213,
"_top": 0,
"_bottom": 30,
"_verticalCenter": 0,
"_horizontalCenter": -200,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "28REOmxdtFIYG6KHBo6VmY"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_fitWidth": false,
"_fitHeight": true,
"_id": "59Cd0ovbdF4byw5sbjJDx7"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_horizontalCenter": 200,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
......@@ -1210,34 +1228,27 @@
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "29zXboiXFBKoIV4PQ2liTe"
},
{
"__type__": "52c4dVvmxZDkr2ojYl0ZDZW",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": "e1/+u9dO9NBJk48O/QUQdP"
"_id": "953bIyAnlI8Li4AkmntVgA"
},
{
"__type__": "cc.Node",
"_name": "StarBase",
"_name": "BtnAddStar",
"_objFlags": 0,
"_parent": {
"__id__": 1
"__id__": 2
},
"_children": [
{
"__id__": 28
"__id__": 31
}
],
"_active": true,
"_components": [
{
"__id__": 32
"__id__": 36
},
{
"__id__": 37
}
],
"_prefab": null,
......@@ -1251,8 +1262,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 62,
"height": 66
"width": 100,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -1263,8 +1274,8 @@
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-193.71,
-148.737,
-200,
-310,
0,
0,
0,
......@@ -1286,24 +1297,27 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "caYUJQLsRA5raLY3euWf0C"
"_id": "0ceHmZk1hGO4j0cKMB8KsG"
},
{
"__type__": "cc.Node",
"_name": "Star",
"_objFlags": 0,
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__": 27
"__id__": 30
},
"_children": [
{
"__id__": 29
"__id__": 32
}
],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 31
"__id__": 34
},
{
"__id__": 35
}
],
"_prefab": null,
......@@ -1317,8 +1331,8 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 62,
"height": 69
"width": 100,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -1352,35 +1366,35 @@
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "1ei0HhhfNI55S64CkxHS+5"
"_id": "83JdtqpLhIsoN6oCCXXi1H"
},
{
"__type__": "cc.Node",
"_name": "StarBig",
"_objFlags": 0,
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 28
"__id__": 31
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 30
"__id__": 33
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 278,
"height": 275
"width": 100,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
......@@ -1396,8 +1410,8 @@
0,
0,
0,
-0.7071067811865475,
0.7071067811865476,
0,
1,
1,
1,
1
......@@ -1407,21 +1421,21 @@
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": -90
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "3f7u5hhEZJvaLGSJYAKli0"
"_id": "d57GBcQSpCi6cec1I7sN8j"
},
{
"__type__": "cc.Sprite",
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 29
"__id__": 32
},
"_enabled": true,
"_materials": [
......@@ -1431,29 +1445,30 @@
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "b00d89ac-54ee-4b06-878a-acef8c97f0df"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "aebDpLzF5N5aVHTOPJ56UN"
"_string": "增加星星",
"_N$string": "增加星星",
"_fontSize": 20,
"_lineHeight": 40,
"_enableWrapText": false,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 1,
"_N$cacheMode": 1,
"_id": "bdtX88qdFJsJyQtT9jmZMT"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 28
"__id__": 31
},
"_enabled": true,
"_materials": [
......@@ -1464,10 +1479,10 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "f72965fe-cf21-4551-adcb-6bdc04be67a0"
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
},
"_type": 0,
"_sizeMode": 1,
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
......@@ -1478,38 +1493,196 @@
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "0civ9QyulAUbDVzlMv7XVa"
"_id": "baaIwLupVGqatQGUxpQOkO"
},
{
"__type__": "cc.Sprite",
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 27
"__id__": 31
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "542bf56d-a861-4e7d-8235-cd0cb39a7ba9"
"alignMode": 0,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 100,
"_originalHeight": 40,
"_id": "97S5yj4PhCVI5UFMrd//gL"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 30
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 2,
"transition": 2,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 230,
"g": 230,
"b": 230,
"a": 255
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "6cOaTXFFhMNL1V2Pj1N8xd"
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 200,
"g": 200,
"b": 200,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 200,
"g": 200,
"b": 200,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 120,
"g": 120,
"b": 120,
"a": 200
},
"_N$normalSprite": {
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
},
"_N$pressedSprite": {
"__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
},
"pressedSprite": {
"__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a"
},
"_N$hoverSprite": {
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
},
"hoverSprite": {
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
},
"_N$disabledSprite": {
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 31
},
"_id": "175x0yGZhMuYnDccKEjZC+"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 30
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 20,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 30,
"_verticalCenter": 0,
"_horizontalCenter": -200,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "28REOmxdtFIYG6KHBo6VmY"
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 1280,
"height": 720
},
"_fitWidth": false,
"_fitHeight": true,
"_id": "59Cd0ovbdF4byw5sbjJDx7"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "29zXboiXFBKoIV4PQ2liTe"
},
{
"__type__": "52c4dVvmxZDkr2ojYl0ZDZW",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": "e1/+u9dO9NBJk48O/QUQdP"
}
]
\ No newline at end of file
......@@ -22,86 +22,11 @@ cc.Class({
BtnShowStar.on('click', this.showStar.bind(this));
},
starLength: null,
addStar() {
if (!this.starLength) {
this.starLength = 0;
}
this.starLength++;
let length = this.starLength;
const starLayout = cc.find('Canvas/layout');
starLayout.removeAllChildren();
const paddingY = starLayout.getComponent(cc.Layout).spacingY;
for (let i = 0; i < length; i++) {
const starBase = cc.instantiate(cc.find('StarBase'));
starBase.name = `starBase_${i}`;
starBase.scale = this.Between(0.5, (starLayout.height / length - paddingY) / starBase.height, 1);
starBase.parent = starLayout;
}
this.currentStarIdx = 0;
cc.find('Canvas/StarScore').getComponent('StarScore').addStar();
},
currentStarIdx: null,
showStar() {
if (!this.currentStarIdx) {
this.currentStarIdx = 0;
}
const starBase = cc.find(`Canvas/layout/starBase_${this.currentStarIdx}`);
if (!starBase) {
return;
}
const star = starBase.getChildByName('Star');
const starBig = star.getChildByName('StarBig');
starBig.scale = 1;
star.active = true;
star.scaleX = 0.7 / starBase.scale;
star.scaleY = 1 / starBase.scale;
star.angle = 90;
const canvas = cc.find('Canvas');
const startPos = this.exchangeNodePos(star.parent, canvas, cc.v2(0, -canvas.height / 2));
const middlePos = this.exchangeNodePos(star.parent, canvas, cc.v2(0, -canvas.height / 4));
star.x = startPos.x;
star.y = startPos.y - starBig.height;
console.log('middlePos = ' + JSON.stringify(middlePos));
const time = 1;
cc.tween(star)
.to(0.3, { y: middlePos.y + 80 }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y + 40, scaleX: 1.2 / starBase.scale, scaleY: 0.8 / starBase.scale }, { easing: 'quadOut' })
.to(0.1, { y: middlePos.y, scaleX: 1 / starBase.scale, scaleY: 1 / starBase.scale }, { easing: 'quadOut' })
.delay(0.1)
.to(0.8, { angle: -720, scale: 1 })
.start();
cc.tween(star)
.delay(0.6)
.to(0.8, { x: 0 }, { easing: 'quadIn' })
.start();
cc.tween(star)
.delay(0.6)
.to(0.8, { y: 0 }, { easing: 'quadOut' })
.start();
cc.tween(starBig)
.delay(0.6)
.to(0.8, { scale: 0 }, { easing: 'quadOut' })
.call(() => {
// this.checkGameEnd();
})
.start();
this.currentStarIdx++;
},
Between(a, b, c) {
return [a, b, c].sort()[1];
cc.find('Canvas/StarScore').getComponent('StarScore').showStar();
},
exchangeNodePos(targetNode, baseNode, basePos) {
return targetNode.convertToNodeSpaceAR(baseNode.convertToWorldSpaceAR(cc.v2(basePos.x, basePos.y)));
},
});
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