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
eaa67fb7
Commit
eaa67fb7
authored
Sep 17, 2020
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 将预制节点放到resources文件夹里
parent
3ae5f23b
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
120 additions
and
1462 deletions
+120
-1462
resources.meta
play/assets/resources.meta
+12
-0
prefabs.meta
play/assets/resources/prefabs.meta
+0
-0
ButtonsNode.js
play/assets/resources/prefabs/ButtonsNode.js
+70
-0
ButtonsNode.js.meta
play/assets/resources/prefabs/ButtonsNode.js.meta
+0
-0
ButtonsNode.prefab
play/assets/resources/prefabs/ButtonsNode.prefab
+26
-12
ButtonsNode.prefab.meta
play/assets/resources/prefabs/ButtonsNode.prefab.meta
+0
-0
ButtonsNode.js
play/assets/tmpGame/prefabs/ButtonsNode.js
+0
-38
mainPage.fire
play/assets/tmpGame/scene/mainPage.fire
+4
-1411
mainPage.js
play/assets/tmpGame/scene/mainPage.js
+8
-1
No files found.
play/assets/resources.meta
0 → 100644
View file @
eaa67fb7
{
"ver": "1.1.2",
"uuid": "75835c75-5df7-4594-bb63-56f33654da79",
"isBundle": true,
"bundleName": "resources",
"priority": 8,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
play/assets/
tmpGame
/prefabs.meta
→
play/assets/
resources
/prefabs.meta
View file @
eaa67fb7
File moved
play/assets/resources/prefabs/ButtonsNode.js
0 → 100644
View file @
eaa67fb7
// 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
:
{
},
ctor
()
{
this
.
_dataList
=
null
;
this
.
_currentIdx
=
0
;
},
start
()
{
this
.
initListeners
();
},
initListeners
()
{
const
BtnNext
=
this
.
node
.
getChildByName
(
'
BtnNext
'
);
const
BtnPrevious
=
this
.
node
.
getChildByName
(
'
BtnPrevious
'
);
const
BtnBack
=
this
.
node
.
getChildByName
(
'
BtnBack
'
);
const
buttonsNode
=
cc
.
find
(
'
ButtonsNode
'
);
if
(
!
this
.
_dataList
[
this
.
_currentIdx
+
1
])
{
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
])
{
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
);
});
});
BtnBack
.
on
(
'
click
'
,
()
=>
{
cc
.
director
.
loadScene
(
'
mainPage
'
);
});
},
setDataList
(
dataList
,
currentIdx
)
{
this
.
_dataList
=
dataList
;
this
.
_currentIdx
=
currentIdx
;
},
// update (dt) {},
});
play/assets/
tmpGame
/prefabs/ButtonsNode.js.meta
→
play/assets/
resources
/prefabs/ButtonsNode.js.meta
View file @
eaa67fb7
File moved
play/assets/
tmpGame
/prefabs/ButtonsNode.prefab
→
play/assets/
resources
/prefabs/ButtonsNode.prefab
View file @
eaa67fb7
...
...
@@ -28,9 +28,13 @@
}
],
"_active": true,
"_components": [],
"_components": [
{
"__id__": 35
}
],
"_prefab": {
"__id__": 3
5
"__id__": 3
6
},
"_opacity": 255,
"_color": {
...
...
@@ -325,7 +329,7 @@
"__id__": 1
},
"asset": {
"__
id__": 0
"__
uuid__": "ffa620db-880d-4ed4-8dd1-00133559ac52"
},
"fileId": "f7UGNL7UVGk4CTBReMALGN",
"sync": false
...
...
@@ -395,7 +399,7 @@
"__id__": 1
},
"asset": {
"__
id__": 0
"__
uuid__": "ffa620db-880d-4ed4-8dd1-00133559ac52"
},
"fileId": "7bl06GQFdGLa/C8+8YqOF7",
"sync": false
...
...
@@ -515,7 +519,7 @@
"__id__": 1
},
"asset": {
"__
id__": 0
"__
uuid__": "ffa620db-880d-4ed4-8dd1-00133559ac52"
},
"fileId": "5fVxX0MPlFjKczib59bpkl",
"sync": false
...
...
@@ -766,7 +770,7 @@
"__id__": 1
},
"asset": {
"__
id__": 0
"__
uuid__": "ffa620db-880d-4ed4-8dd1-00133559ac52"
},
"fileId": "69vL47dSFMiYTImeroVZPx",
"sync": false
...
...
@@ -836,7 +840,7 @@
"__id__": 1
},
"asset": {
"__
id__": 0
"__
uuid__": "ffa620db-880d-4ed4-8dd1-00133559ac52"
},
"fileId": "02nTlGH8pMYKr9XuX25KFp",
"sync": false
...
...
@@ -956,7 +960,7 @@
"__id__": 1
},
"asset": {
"__
id__": 0
"__
uuid__": "ffa620db-880d-4ed4-8dd1-00133559ac52"
},
"fileId": "416mO1C4lJEb9hSe7wx3Jg",
"sync": false
...
...
@@ -1207,7 +1211,7 @@
"__id__": 1
},
"asset": {
"__
id__": 0
"__
uuid__": "ffa620db-880d-4ed4-8dd1-00133559ac52"
},
"fileId": "771uGcSddClYMu7NGmbLaH",
"sync": false
...
...
@@ -1277,7 +1281,7 @@
"__id__": 1
},
"asset": {
"__
id__": 0
"__
uuid__": "ffa620db-880d-4ed4-8dd1-00133559ac52"
},
"fileId": "4b75kT7rVHTruaArhQn4G5",
"sync": false
...
...
@@ -1397,18 +1401,28 @@
"__id__": 1
},
"asset": {
"__
id__": 0
"__
uuid__": "ffa620db-880d-4ed4-8dd1-00133559ac52"
},
"fileId": "aa1/O6kH1CT62jMktS6TUP",
"sync": false
},
{
"__type__": "abb52OcegZE5rPyTByt2ykw",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__
id__": 0
"__
uuid__": "ffa620db-880d-4ed4-8dd1-00133559ac52"
},
"fileId": "d7OJrcCmJLEIoN3nqNXoZJ",
"sync": false
...
...
play/assets/
tmpGame
/prefabs/ButtonsNode.prefab.meta
→
play/assets/
resources
/prefabs/ButtonsNode.prefab.meta
View file @
eaa67fb7
File moved
play/assets/tmpGame/prefabs/ButtonsNode.js
deleted
100644 → 0
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/scene/mainPage.fire
View file @
eaa67fb7
This diff is collapsed.
Click to expand it.
play/assets/tmpGame/scene/mainPage.js
View file @
eaa67fb7
...
...
@@ -34,9 +34,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
);
});
});
});
...
...
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