调整返回按钮

This commit is contained in:
ifengzp 2020-04-02 01:45:37 +08:00
parent 6fc3f3c7a9
commit e74442f8bb
12 changed files with 272 additions and 664 deletions

View File

@ -82,21 +82,18 @@
}, },
{ {
"__id__": 18 "__id__": 18
},
{
"__id__": 26
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 31 "__id__": 26
}, },
{ {
"__id__": 32 "__id__": 27
}, },
{ {
"__id__": 33 "__id__": 28
} }
], ],
"_prefab": null, "_prefab": null,
@ -1263,217 +1260,6 @@
"handler": "playAnim", "handler": "playAnim",
"customEventData": "" "customEventData": ""
}, },
{
"__type__": "cc.Node",
"_name": "back",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 27
},
{
"__id__": 28
},
{
"__id__": 29
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 153,
"b": 40,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 160,
"height": 180
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-603,
307,
0,
0,
0,
0,
1,
0.4,
0.4,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "d43LpbJbpEHYvYDn0sRXrQ"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 26
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "714299b3-6ffd-4ba5-a166-296176854549"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "b6YNh/03pP1L3TMThZLzqH"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 26
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 9,
"_left": 32,
"_right": 0,
"_top": 32,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "91xaq7InpJNZkGZEWUuQvF"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 26
},
"_enabled": true,
"_normalMaterial": {
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
},
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 30
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 3,
"transition": 3,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"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": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "561kUZytdBqZOCaHSX7016"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 2
},
"component": "",
"_componentId": "e54affUF7NGeZytNFcwLhOd",
"handler": "backToHome",
"customEventData": ""
},
{ {
"__type__": "cc.Canvas", "__type__": "cc.Canvas",
"_name": "", "_name": "",

View File

@ -90,8 +90,4 @@ export default class Coin_fly_to_wallet extends cc.Component {
} }
return points; return points;
} }
backToHome() {
cc.director.loadScene('Home');
}
} }

View File

@ -0,0 +1,21 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class BackHomeBtn extends cc.Component {
static instance: BackHomeBtn = null;
start() {
cc.game.addPersistRootNode(this.node);
BackHomeBtn.instance = this;
this.toggleActive(false);
}
toggleActive(flag: boolean) {
this.node.active = flag;
}
backToHome() {
this.toggleActive(false);
cc.director.loadScene('Home');
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "f673b6fd-1d6c-4444-a3f8-ad4361ce0e36",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -15,6 +15,9 @@
"_children": [ "_children": [
{ {
"__id__": 2 "__id__": 2
},
{
"__id__": 25
} }
], ],
"_active": true, "_active": true,
@ -1008,5 +1011,229 @@
"__uuid__": "3c27b0d3-bf66-47a2-b6a8-09ca24132944" "__uuid__": "3c27b0d3-bf66-47a2-b6a8-09ca24132944"
}, },
"_id": "b6rKGs6AhPW6YpRPz4nSN6" "_id": "b6rKGs6AhPW6YpRPz4nSN6"
},
{
"__type__": "cc.Node",
"_name": "back_home_btn",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 26
},
{
"__id__": 27
},
{
"__id__": 28
},
{
"__id__": 30
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 160,
"height": 180
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
64,
682,
0,
0,
0,
0,
1,
0.4,
0.4,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "03nkgB1lhAC6SB+oYRz2BD"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "714299b3-6ffd-4ba5-a166-296176854549"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "e0o7Fj2i1K9bPaH3R3OoeJ"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 9,
"_left": 32,
"_right": 0,
"_top": 32,
"_bottom": 269,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 180,
"_id": "4dkqHl7udCF5gqNOEjqw+t"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
},
"_enabled": true,
"_normalMaterial": {
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
},
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.1,
"clickEvents": [
{
"__id__": 29
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 3,
"transition": 3,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"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": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "e1eNaT6RVJu5tQq3e6IEik"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 25
},
"component": "",
"_componentId": "f673bb9HWxERKP4rUNhzg42",
"handler": "backToHome",
"customEventData": ""
},
{
"__type__": "f673bb9HWxERKP4rUNhzg42",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
},
"_enabled": true,
"_id": "f1IGHg+lpP16AlzNEKM60q"
} }
] ]

View File

@ -1,3 +1,4 @@
import BackHomeBtn from "./BackHomeBtn";
const {ccclass, property} = cc._decorator; const {ccclass, property} = cc._decorator;
enum sceneList { enum sceneList {
"Infinite_bg_scroll" = "背景无限滚动", "Infinite_bg_scroll" = "背景无限滚动",
@ -23,6 +24,7 @@ export default class Home extends cc.Component {
scrollItem.getChildByName("label").getComponent(cc.Label).string = sceneList[key]; scrollItem.getChildByName("label").getComponent(cc.Label).string = sceneList[key];
scrollItem.on(cc.Node.EventType.TOUCH_END, () => { scrollItem.on(cc.Node.EventType.TOUCH_END, () => {
BackHomeBtn.instance.toggleActive(true);
cc.tween(scrollItem) cc.tween(scrollItem)
.to(0.1, { scale: 1.05 }) .to(0.1, { scale: 1.05 })
.to(0.1, { scale: 1 }) .to(0.1, { scale: 1 })

View File

@ -79,21 +79,18 @@
}, },
{ {
"__id__": 17 "__id__": 17
},
{
"__id__": 21
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 26 "__id__": 21
}, },
{ {
"__id__": 27 "__id__": 22
}, },
{ {
"__id__": 28 "__id__": 23
} }
], ],
"_prefab": null, "_prefab": null,
@ -892,217 +889,6 @@
"_originalHeight": 0, "_originalHeight": 0,
"_id": "adPsMOv+RCV71hnLv17WyO" "_id": "adPsMOv+RCV71hnLv17WyO"
}, },
{
"__type__": "cc.Node",
"_name": "back",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 22
},
{
"__id__": 23
},
{
"__id__": 25
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 153,
"b": 40,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 160,
"height": 180
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-603,
307,
0,
0,
0,
0,
1,
0.4,
0.4,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "86f6s/HCxOQ6VrJc8vemso"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "714299b3-6ffd-4ba5-a166-296176854549"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "4dAryXjoJKaJzvwvrhVEhF"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
},
"_enabled": true,
"_normalMaterial": {
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
},
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 24
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 3,
"transition": 3,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"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": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "bd4IWeYKdNQLHLq8GprTxL"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 2
},
"component": "",
"_componentId": "58a09IoQgtOp59qWxU/tUY+",
"handler": "backToHome",
"customEventData": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 21
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 9,
"_left": 32,
"_right": 0,
"_top": 32,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "07jtcBXohLW6fdpG3FAM0o"
},
{ {
"__type__": "cc.Canvas", "__type__": "cc.Canvas",
"_name": "", "_name": "",

View File

@ -24,8 +24,4 @@ export default class Infinite_bg_scroll extends cc.Component {
this.bg1.x -= temp; this.bg1.x -= temp;
this.bg2.x -= temp; this.bg2.x -= temp;
} }
backToHome() {
cc.director.loadScene('Home');
}
} }

View File

@ -79,18 +79,15 @@
}, },
{ {
"__id__": 10 "__id__": 10
},
{
"__id__": 16
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 21 "__id__": 16
}, },
{ {
"__id__": 22 "__id__": 17
} }
], ],
"_prefab": null, "_prefab": null,
@ -701,217 +698,6 @@
"_originalHeight": 0, "_originalHeight": 0,
"_id": "a7UA7z1GdOLpJ6QjJ2fdEI" "_id": "a7UA7z1GdOLpJ6QjJ2fdEI"
}, },
{
"__type__": "cc.Node",
"_name": "back",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 17
},
{
"__id__": 18
},
{
"__id__": 19
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 153,
"b": 40,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 160,
"height": 180
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-603,
307,
0,
0,
0,
0,
1,
0.4,
0.4,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": "73y+C9V1hOZYIGA0QFSYO5"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "714299b3-6ffd-4ba5-a166-296176854549"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "93aOWl48RIwI8jbBfT+yJ2"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 9,
"_left": 32,
"_right": 0,
"_top": 32,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "1fNKsixQtPhox/BnQlUVQu"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 16
},
"_enabled": true,
"_normalMaterial": {
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
},
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 20
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 3,
"transition": 3,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"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": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "33Hg2eaMBHNZXL9xdowM07"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 10
},
"component": "",
"_componentId": "ea7dbuck+9ApJnQTq/C4vpv",
"handler": "backToHome",
"customEventData": ""
},
{ {
"__type__": "cc.Canvas", "__type__": "cc.Canvas",
"_name": "", "_name": "",

View File

@ -16,10 +16,6 @@ export default class Roller extends cc.Component {
this.initTouchEvent(); this.initTouchEvent();
} }
backToHome() {
cc.director.loadScene("Home");
}
initTouchEvent() { initTouchEvent() {
this.node.on(cc.Node.EventType.TOUCH_START, this.touchStartEvent, this); this.node.on(cc.Node.EventType.TOUCH_START, this.touchStartEvent, this);
this.node.on(cc.Node.EventType.TOUCH_MOVE, this.touchMoveEvent, this); this.node.on(cc.Node.EventType.TOUCH_MOVE, this.touchMoveEvent, this);

View File

@ -797,7 +797,9 @@
"mirrorCameraNode": { "mirrorCameraNode": {
"__id__": 14 "__id__": 14
}, },
"tempCameraSpriteNode": null, "tempCameraSpriteNode": {
"__id__": 10
},
"_id": "19Lhxf6jxHWZ4TYr8xS5s4" "_id": "19Lhxf6jxHWZ4TYr8xS5s4"
} }
] ]

View File

@ -39,5 +39,6 @@
"live": { "live": {
"enable": false "enable": false
} }
} },
"start-scene": "current"
} }