mirror of
https://github.com/ifengzp/cocos-awesome.git
synced 2025-10-09 08:36:03 +00:00
完成首页
This commit is contained in:
1012
assets/Scene/Home/Home.fire
Executable file
1012
assets/Scene/Home/Home.fire
Executable file
File diff suppressed because it is too large
Load Diff
7
assets/Scene/Home/Home.fire.meta
Executable file
7
assets/Scene/Home/Home.fire.meta
Executable file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.2.6",
|
||||
"uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
39
assets/Scene/Home/Home.ts
Normal file
39
assets/Scene/Home/Home.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
const {ccclass, property} = cc._decorator;
|
||||
enum sceneList {
|
||||
"Infinite_bg_scroll" = "背景无限滚动",
|
||||
"Joystick" = "遥控杆",
|
||||
"Coin_fly_to_wallet" = "金币落袋"
|
||||
}
|
||||
|
||||
@ccclass
|
||||
export default class Home extends cc.Component {
|
||||
@property(cc.Node)
|
||||
scrollContent: cc.Node = null;
|
||||
@property(cc.Prefab)
|
||||
scrollItemPrefab: cc.Prefab = null;
|
||||
|
||||
onLoad() {
|
||||
this.initScrollItem();
|
||||
}
|
||||
|
||||
initScrollItem() {
|
||||
for (let key in sceneList) {
|
||||
let scrollItem = cc.instantiate(this.scrollItemPrefab);
|
||||
|
||||
scrollItem.getChildByName("label").getComponent(cc.Label).string = sceneList[key];
|
||||
scrollItem.on(cc.Node.EventType.TOUCH_END, () => {
|
||||
cc.tween(scrollItem)
|
||||
.to(0.1, { scale: 1.05 })
|
||||
.to(0.1, { scale: 1 })
|
||||
.start();
|
||||
this.loadScene(key);
|
||||
}, this);
|
||||
|
||||
this.scrollContent.addChild(scrollItem);
|
||||
}
|
||||
}
|
||||
|
||||
loadScene(key) {
|
||||
cc.director.loadScene(key);
|
||||
}
|
||||
}
|
9
assets/Scene/Home/Home.ts.meta
Normal file
9
assets/Scene/Home/Home.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "e1b90feb-a217-4493-849d-9a611900d683",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
230
assets/Scene/Home/ScrollItemPrefab.prefab
Normal file
230
assets/Scene/Home/ScrollItemPrefab.prefab
Normal file
@@ -0,0 +1,230 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "item",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 5
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 6
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 600,
|
||||
"height": 80
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
-50,
|
||||
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": "label",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 3
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 4
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 0,
|
||||
"height": 42.84
|
||||
},
|
||||
"_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.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_useOriginalSize": false,
|
||||
"_string": "",
|
||||
"_N$string": "",
|
||||
"_fontSize": 34,
|
||||
"_lineHeight": 34,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_styleFlags": 0,
|
||||
"_underlineHeight": 0,
|
||||
"_N$horizontalAlign": 1,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 0,
|
||||
"_N$cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__uuid__": "3c27b0d3-bf66-47a2-b6a8-09ca24132944"
|
||||
},
|
||||
"fileId": "5fsPWB4+dB6ofv9Y3zSWuP",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "847da4e2-76e3-4ff9-9314-713438721842"
|
||||
},
|
||||
"_type": 1,
|
||||
"_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__": "3c27b0d3-bf66-47a2-b6a8-09ca24132944"
|
||||
},
|
||||
"fileId": "42ek6+2rFCX6JVYDIZhLy9",
|
||||
"sync": false
|
||||
}
|
||||
]
|
8
assets/Scene/Home/ScrollItemPrefab.prefab.meta
Normal file
8
assets/Scene/Home/ScrollItemPrefab.prefab.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"ver": "1.2.6",
|
||||
"uuid": "3c27b0d3-bf66-47a2-b6a8-09ca24132944",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
Reference in New Issue
Block a user