Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
unit_demo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
unit_demo
Commits
8e467e99
Commit
8e467e99
authored
Sep 17, 2020
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 菜单控制组件完成
parent
eaa67fb7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
866 additions
and
36 deletions
+866
-36
ButtonsNode.js
play/assets/resources/prefabs/ButtonsNode.js
+34
-25
ButtonsNode.prefab
play/assets/resources/prefabs/ButtonsNode.prefab
+112
-2
demo_01_showFireworks.fire
play/assets/tmpGame/scene/demo_01_showFireworks.fire
+662
-1
demo_01_showFireworks.js
play/assets/tmpGame/scene/demo_01_showFireworks.js
+38
-0
demo_01_showFireworks.js.meta
play/assets/tmpGame/scene/demo_01_showFireworks.js.meta
+9
-0
mainPage.js
play/assets/tmpGame/scene/mainPage.js
+11
-8
No files found.
play/assets/resources/prefabs/ButtonsNode.js
View file @
8e467e99
...
...
@@ -18,7 +18,6 @@ cc.Class({
},
start
()
{
this
.
initListeners
();
},
initListeners
()
{
...
...
@@ -26,44 +25,54 @@ cc.Class({
const
BtnPrevious
=
this
.
node
.
getChildByName
(
'
BtnPrevious
'
);
const
BtnBack
=
this
.
node
.
getChildByName
(
'
BtnBack
'
);
const
buttonsNode
=
cc
.
find
(
'
ButtonsNode
'
);
BtnNext
.
active
=
true
;
BtnPrevious
.
active
=
true
;
if
(
!
this
.
_dataList
[
this
.
_currentIdx
+
1
])
{
console
.
log
(
'
汪汪汪
'
)
BtnNext
.
active
=
false
;
}
BtnNext
.
on
(
'
click
'
,
()
=>
{
demoItem
=
this
.
_dataList
[
this
.
_currentIdx
+
1
];
cc
.
director
.
loadScene
(
demoItem
.
sceneName
,
()
=>
{
const
scene
=
cc
.
director
.
getScene
();
const
newButtonNode
=
cc
.
instantiate
(
buttonsNode
);
newButtonNode
.
parent
=
scene
;
newButtonNode
.
x
=
0
;
newButtonNode
.
y
=
0
;
newButtonNode
.
getComponent
(
'
ButtonsNode
'
).
setDataList
(
demoList
,
idx
);
});
});
if
(
!
this
.
_dataList
[
this
.
_currentIdx
-
1
])
{
console
.
log
(
'
喵喵喵
'
)
BtnPrevious
.
active
=
false
;
}
BtnPrevious
.
on
(
'
click
'
,
()
=>
{
demoItem
=
this
.
_dataList
[
this
.
_currentIdx
-
1
];
cc
.
director
.
loadScene
(
demoItem
.
sceneName
,
()
=>
{
const
scene
=
cc
.
director
.
getScene
();
const
newButtonNode
=
cc
.
instantiate
(
buttonsNode
);
newButtonNode
.
parent
=
scene
;
newButtonNode
.
x
=
0
;
newButtonNode
.
y
=
0
;
newButtonNode
.
getComponent
(
'
ButtonsNode
'
).
setDataList
(
demoList
,
idx
);
cc
.
resources
.
load
(
'
prefabs/ButtonsNode
'
,
cc
.
Prefab
,
(
err
,
ButtonsNode
)
=>
{
const
dataList
=
this
.
_dataList
;
const
currentIdx
=
this
.
_currentIdx
;
BtnNext
.
on
(
'
click
'
,
()
=>
{
demoItem
=
this
.
_dataList
[
this
.
_currentIdx
+
1
];
cc
.
director
.
loadScene
(
demoItem
.
sceneName
,
()
=>
{
const
newButtonNode
=
cc
.
instantiate
(
ButtonsNode
);
newButtonNode
.
parent
=
cc
.
find
(
'
Canvas
'
);
newButtonNode
.
x
=
0
;
newButtonNode
.
y
=
0
;
newButtonNode
.
getComponent
(
'
ButtonsNode
'
).
setDataList
(
dataList
,
currentIdx
+
1
);
});
});
BtnPrevious
.
on
(
'
click
'
,
()
=>
{
demoItem
=
this
.
_dataList
[
this
.
_currentIdx
-
1
];
cc
.
director
.
loadScene
(
demoItem
.
sceneName
,
()
=>
{
const
newButtonNode
=
cc
.
instantiate
(
ButtonsNode
);
newButtonNode
.
parent
=
cc
.
find
(
'
Canvas
'
);
newButtonNode
.
x
=
0
;
newButtonNode
.
y
=
0
;
newButtonNode
.
getComponent
(
'
ButtonsNode
'
).
setDataList
(
dataList
,
currentIdx
-
1
);
});
});
});
BtnBack
.
on
(
'
click
'
,
()
=>
{
cc
.
director
.
loadScene
(
'
mainPage
'
);
BtnBack
.
on
(
'
click
'
,
()
=>
{
cc
.
director
.
loadScene
(
'
mainPage
'
);
});
});
},
setDataList
(
dataList
,
currentIdx
)
{
this
.
_dataList
=
dataList
;
this
.
_currentIdx
=
currentIdx
;
this
.
initListeners
();
},
// update (dt) {},
...
...
play/assets/resources/prefabs/ButtonsNode.prefab
View file @
8e467e99
...
...
@@ -25,16 +25,19 @@
},
{
"__id__": 24
},
{
"__id__": 35
}
],
"_active": true,
"_components": [
{
"__id__": 3
5
"__id__": 3
8
}
],
"_prefab": {
"__id__": 3
6
"__id__": 3
9
},
"_opacity": 255,
"_color": {
...
...
@@ -1406,6 +1409,113 @@
"fileId": "aa1/O6kH1CT62jMktS6TUP",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "New Sprite(Splash)",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 36
}
],
"_prefab": {
"__id__": 37
},
"_opacity": 100,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 112,
"b": 244,
"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.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 35
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_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": {
"__uuid__": "ffa620db-880d-4ed4-8dd1-00133559ac52"
},
"fileId": "e04yZ0G1dPgoekC5dZ6w45",
"sync": false
},
{
"__type__": "abb52OcegZE5rPyTByt2ykw",
"_name": "",
...
...
play/assets/tmpGame/scene/demo_01_showFireworks.fire
View file @
8e467e99
[{"__type__":"cc.SceneAsset","_name":"","_objFlags":0,"_native":"","scene":{"__id__":1}},{"__type__":"cc.Scene","_objFlags":0,"_parent":null,"_children":[{"__id__":2}],"_active":true,"_components":[],"_prefab":null,"_opacity":255,"_color":{"__type__":"cc.Color","r":255,"g":255,"b":255,"a":255},"_contentSize":{"__type__":"cc.Size","width":0,"height":0},"_anchorPoint":{"__type__":"cc.Vec2","x":0,"y":0},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[0,0,0,0,0,0,1,1,1,1]},"_is3DNode":true,"_groupIndex":0,"groupIndex":0,"autoReleaseAssets":false,"_id":"324247e8-c584-495d-87b3-015a69fee444"},{"__type__":"cc.Node","_name":"Canvas","_objFlags":0,"_parent":{"__id__":1},"_children":[{"__id__":3}],"_active":true,"_components":[{"__id__":5},{"__id__":6}],"_prefab":null,"_opacity":255,"_color":{"__type__":"cc.Color","r":255,"g":255,"b":255,"a":255},"_contentSize":{"__type__":"cc.Size","width":960,"height":640},"_anchorPoint":{"__type__":"cc.Vec2","x":0.5,"y":0.5},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[480,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":"a5esZu+45LA5mBpvttspPD"},{"__type__":"cc.Node","_name":"Main Camera","_objFlags":0,"_parent":{"__id__":2},"_children":[],"_active":true,"_components":[{"__id__":4}],"_prefab":null,"_opacity":255,"_color":{"__type__":"cc.Color","r":255,"g":255,"b":255,"a":255},"_contentSize":{"__type__":"cc.Size","width":960,"height":640},"_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":"e1WoFrQ79G7r4ZuQE3HlNb"},{"__type__":"cc.Camera","_name":"","_objFlags":0,"node":{"__id__":3},"_enabled":true,"_cullingMask":4294967295,"_clearFlags":7,"_backgroundColor":{"__type__":"cc.Color","r":0,"g":0,"b":0,"a":255},"_depth":-1,"_zoomRatio":1,"_targetTexture":null,"_fov":60,"_orthoSize":10,"_nearClip":1,"_farClip":4096,"_ortho":true,"_rect":{"__type__":"cc.Rect","x":0,"y":0,"width":1,"height":1},"_renderStages":1,"_alignWithScreen":true,"_id":"81GN3uXINKVLeW4+iKSlim"},{"__type__":"cc.Canvas","_name":"","_objFlags":0,"node":{"__id__":2},"_enabled":true,"_designResolution":{"__type__":"cc.Size","width":960,"height":640},"_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"}]
\ No newline at end of file
[
{
"__type__": "cc.SceneAsset",
"_name": "",
"_objFlags": 0,
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_is3DNode": true,
"_groupIndex": 0,
"groupIndex": 0,
"autoReleaseAssets": true,
"_id": "939f8174-7301-4e99-a098-b078e3093fc7"
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
},
{
"__id__": 5
}
],
"_active": true,
"_components": [
{
"__id__": 12
},
{
"__id__": 13
},
{
"__id__": 14
}
],
"_prefab": null,
"_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": [
640,
360,
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": "a5esZu+45LA5mBpvttspPD"
},
{
"__type__": "cc.Node",
"_name": "Main Camera",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 960,
"height": 640
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
791.547219058977,
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": "e1WoFrQ79G7r4ZuQE3HlNb"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_cullingMask": 4294967295,
"_clearFlags": 7,
"_backgroundColor": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_depth": -1,
"_zoomRatio": 1,
"_targetTexture": null,
"_fov": 60,
"_orthoSize": 10,
"_nearClip": 1,
"_farClip": 4096,
"_ortho": true,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_renderStages": 1,
"_alignWithScreen": true,
"_id": "81GN3uXINKVLeW4+iKSlim"
},
{
"__type__": "cc.Node",
"_name": "fire",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 6
}
],
"_active": true,
"_components": [
{
"__id__": 11
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-250,
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": "fdcVqWm+lN7LhNkndC/XrT"
},
{
"__type__": "cc.Node",
"_name": "Background",
"_objFlags": 512,
"_parent": {
"__id__": 5
},
"_children": [
{
"__id__": 7
}
],
"_active": true,
"_components": [
{
"__id__": 9
},
{
"__id__": 10
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 40
},
"_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": "47TFSYh7NMGqJEvIxpQRRg"
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 512,
"_parent": {
"__id__": 6
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 8
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 40
},
"_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": "98rzGCFMNMb7+Mi9PMQo1w"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_useOriginalSize": false,
"_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": "0dvVfEGXtDdY+aOgTTCWsL"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
},
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "e6YUv4jrVC15B9DhiHnsl4"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 6
},
"_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": "86zmVLZYpLpKCXQ4JZLFMN"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_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"
},
"hoverSprite": {
"__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952"
},
"_N$disabledSprite": {
"__uuid__": "29158224-f8dd-4661-a796-1ffab537140e"
},
"_N$target": {
"__id__": 6
},
"_id": "cfEkr3GjVI3JZhhIAVfRlF"
},
{
"__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__": "a6c50tyZhtDz7+uQZrDMG4+",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_id": "ebve0q/11Fq7yItSIg8Cta"
}
]
\ No newline at end of file
play/assets/tmpGame/scene/demo_01_showFireworks.js
0 → 100644
View file @
8e467e99
// Learn cc.Class:
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
cc
.
Class
({
extends
:
cc
.
Component
,
properties
:
{
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
},
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
start
()
{
},
// update (dt) {},
});
play/assets/tmpGame/scene/demo_01_showFireworks.js.meta
0 → 100644
View file @
8e467e99
{
"ver": "1.0.8",
"uuid": "a6c50b72-661b-43cf-bfae-419ac3306e3e",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/scene/mainPage.js
View file @
8e467e99
...
...
@@ -20,6 +20,9 @@ cc.Class({
const
demoList
=
[{
sceneName
:
'
demo_01_showFireworks
'
,
label
:
'
烟花效果
'
},
{
sceneName
:
'
demo_01_showFireworks
'
,
label
:
'
烟花效果
'
}];
demoList
.
forEach
((
demoItem
,
idx
)
=>
{
...
...
@@ -34,16 +37,16 @@ cc.Class({
button
.
x
=
(
width
/
widthLength
)
*
((
idx
%
widthLength
)
-
(
widthLength
-
1
)
/
2
);
button
.
y
=
300
-
Math
.
floor
(
idx
/
widthLength
)
*
50
;
const
buttonsNode
=
cc
.
find
(
'
ButtonsNode
'
);
button
.
on
(
'
click
'
,
()
=>
{
cc
.
director
.
loadScene
(
demoItem
.
sceneName
,
()
=>
{
const
scene
=
cc
.
director
.
getScene
();
const
newButtonNode
=
cc
.
instantiate
(
buttonsNode
);
newButtonNode
.
parent
=
scene
;
newButtonNode
.
x
=
0
;
newButtonNode
.
y
=
0
;
newButtonNode
.
getComponent
(
'
ButtonsNode
'
).
setDataList
(
demoList
,
idx
);
cc
.
resources
.
load
(
'
prefabs/ButtonsNode
'
,
cc
.
Prefab
,
function
(
err
,
ButtonsNode
)
{
const
newButtonNode
=
cc
.
instantiate
(
ButtonsNode
);
newButtonNode
.
getComponent
(
'
ButtonsNode
'
).
setDataList
(
demoList
,
idx
);
newButtonNode
.
parent
=
cc
.
find
(
'
Canvas
'
);
newButtonNode
.
x
=
0
;
newButtonNode
.
y
=
0
;
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment