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
3ae5f23b
Commit
3ae5f23b
authored
Sep 17, 2020
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 创建预制
parent
83ecdba1
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
2918 additions
and
32 deletions
+2918
-32
ButtonsNode.js
play/assets/tmpGame/prefabs/ButtonsNode.js
+38
-0
ButtonsNode.js.meta
play/assets/tmpGame/prefabs/ButtonsNode.js.meta
+9
-0
ButtonsNode.prefab
play/assets/tmpGame/prefabs/ButtonsNode.prefab
+1416
-0
ButtonsNode.prefab.meta
play/assets/tmpGame/prefabs/ButtonsNode.prefab.meta
+8
-0
mainPage.fire
play/assets/tmpGame/scene/mainPage.fire
+1423
-16
mainPage.js
play/assets/tmpGame/scene/mainPage.js
+24
-16
No files found.
play/assets/tmpGame/prefabs/ButtonsNode.js
0 → 100644
View file @
3ae5f23b
// 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/prefabs/ButtonsNode.js.meta
0 → 100644
View file @
3ae5f23b
{
"ver": "1.0.8",
"uuid": "abb5239c-7a06-44e6-b3f2-4c1caddb2930",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/prefabs/ButtonsNode.prefab
0 → 100644
View file @
3ae5f23b
This diff is collapsed.
Click to expand it.
play/assets/tmpGame/prefabs/ButtonsNode.prefab.meta
0 → 100644
View file @
3ae5f23b
{
"ver": "1.2.7",
"uuid": "ffa620db-880d-4ed4-8dd1-00133559ac52",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
play/assets/tmpGame/scene/mainPage.fire
View file @
3ae5f23b
This diff is collapsed.
Click to expand it.
play/assets/tmpGame/scene/mainPage.js
View file @
3ae5f23b
...
@@ -9,29 +9,37 @@ cc.Class({
...
@@ -9,29 +9,37 @@ cc.Class({
extends
:
cc
.
Component
,
extends
:
cc
.
Component
,
properties
:
{
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:
// LIFE-CYCLE CALLBACKS:
// onLoad () {},
// onLoad () {},
start
()
{
start
()
{
const
demoList
=
[{
sceneName
:
'
demo_01_showFireworks
'
,
label
:
'
烟花效果
'
}];
demoList
.
forEach
((
demoItem
,
idx
)
=>
{
const
button
=
cc
.
instantiate
(
cc
.
find
(
'
Canvas/New Button
'
));
const
label
=
cc
.
find
(
'
Background/Label
'
,
button
);
label
.
getComponent
(
cc
.
Label
).
string
=
demoItem
.
label
;
const
width
=
1200
;
const
widthLength
=
4
;
button
.
parent
=
this
.
node
;
button
.
x
=
(
width
/
widthLength
)
*
((
idx
%
widthLength
)
-
(
widthLength
-
1
)
/
2
);
button
.
y
=
300
-
Math
.
floor
(
idx
/
widthLength
)
*
50
;
button
.
on
(
'
click
'
,
()
=>
{
cc
.
director
.
loadScene
(
demoItem
.
sceneName
,
()
=>
{
});
});
});
},
},
// update (dt) {},
// update (dt) {},
...
...
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