增加系统菜单

This commit is contained in:
cebgcontract 2022-06-20 19:21:02 +08:00
parent ecd3818bc2
commit 98f299ce0d
27 changed files with 2101 additions and 184 deletions

View File

@ -0,0 +1,420 @@
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false
},
{
"__type__": "cc.Node",
"_name": "iconBtn",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 5
}
],
"_active": true,
"_level": 1,
"_components": [
{
"__id__": 8
},
{
"__id__": 9
},
{
"__id__": 10
}
],
"_prefab": {
"__id__": 12
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 120,
"height": 150
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_position": {
"__type__": "cc.Vec3",
"x": -133,
"y": 60,
"z": 0
},
"_scale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_rotationX": 0,
"_rotationY": 0,
"_quat": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_skewX": 0,
"_skewY": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_level": 5,
"_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": 60,
"height": 60
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_position": {
"__type__": "cc.Vec3",
"x": 0,
"y": 27,
"z": 0
},
"_scale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_rotationX": 0,
"_rotationY": 0,
"_quat": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_skewX": 0,
"_skewY": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "94d7ae57-38a7-4f0b-80ea-163c8808f1c7"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_state": 0,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "edefc8c1-62a6-49f9-8610-13865e5b0e32"
},
"fileId": "660eT0cY5P4r0d/7ztvIiy",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "titleLabel",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_level": 5,
"_components": [
{
"__id__": 6
}
],
"_prefab": {
"__id__": 7
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100.88,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_position": {
"__type__": "cc.Vec3",
"x": 0,
"y": -38,
"z": 0
},
"_scale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_rotationX": 0,
"_rotationY": 0,
"_quat": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_skewX": 0,
"_skewY": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_useOriginalSize": false,
"_string": "Import Account",
"_N$string": "Import Account",
"_fontSize": 15,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_batchAsBitmap": false,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "edefc8c1-62a6-49f9-8610-13865e5b0e32"
},
"fileId": "86ehui2nhEXr73aDPfEK2X",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": false,
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "13d3eb87-b218-4fb7-b7c2-31e8a58b67bc"
},
"_type": 1,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_state": 0,
"_atlas": null,
"_id": ""
},
{
"__type__": "32f5cLy2UpGYby3r5V1Y5Qz",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"btnSprite": {
"__id__": 3
},
"titleLabel": {
"__id__": 6
},
"_id": ""
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 11
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 3,
"transition": 3,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 214,
"g": 214,
"b": 214,
"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": ""
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "32f5cLy2UpGYby3r5V1Y5Qz",
"handler": "onBtnClicked",
"customEventData": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "edefc8c1-62a6-49f9-8610-13865e5b0e32"
},
"fileId": "f4h7lbA1ZFI7ll+ROJ2r+E",
"sync": false
}
]

View File

@ -0,0 +1,7 @@
{
"ver": "1.0.1",
"uuid": "edefc8c1-62a6-49f9-8610-13865e5b0e32",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"subMetas": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -0,0 +1,31 @@
{
"ver": "2.2.0",
"uuid": "9f0a0c71-b5fb-4fd4-be80-f51884e4ffdc",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"subMetas": {
"change-account": {
"ver": "1.0.4",
"uuid": "94d7ae57-38a7-4f0b-80ea-163c8808f1c7",
"rawTextureUuid": "9f0a0c71-b5fb-4fd4-be80-f51884e4ffdc",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 6,
"trimY": 6,
"width": 116,
"height": 116,
"rawWidth": 128,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,31 @@
{
"ver": "2.2.0",
"uuid": "df5ebe68-91ad-4ca7-817b-6ac939b07114",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"subMetas": {
"cloud-download": {
"ver": "1.0.4",
"uuid": "8917c4b9-d880-44a8-950b-1bea01707e86",
"rawTextureUuid": "df5ebe68-91ad-4ca7-817b-6ac939b07114",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 128,
"height": 128,
"rawWidth": 128,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,31 @@
{
"ver": "2.2.0",
"uuid": "31025bca-460e-4a00-99e4-ea5ef22f9cee",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"subMetas": {
"cloud-upload": {
"ver": "1.0.4",
"uuid": "ee2ddc55-f2ed-4cbe-a5cb-0e54b85bf647",
"rawTextureUuid": "31025bca-460e-4a00-99e4-ea5ef22f9cee",
"trimType": "custom",
"trimThreshold": 0,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 128,
"height": 128,
"rawWidth": 128,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,31 @@
{
"ver": "2.2.0",
"uuid": "999a2bf0-452d-459d-b628-bdd629dfbcbc",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"subMetas": {
"export-account": {
"ver": "1.0.4",
"uuid": "eb181377-d56b-4ee2-b3cc-9ec7367080eb",
"rawTextureUuid": "999a2bf0-452d-459d-b628-bdd629dfbcbc",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 128,
"height": 128,
"rawWidth": 128,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,31 @@
{
"ver": "2.2.0",
"uuid": "65611a37-8ff6-4e95-adf2-cf0ab12721c6",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"subMetas": {
"history": {
"ver": "1.0.4",
"uuid": "c2eed000-f86f-4a6b-b25e-338e9e8f012f",
"rawTextureUuid": "65611a37-8ff6-4e95-adf2-cf0ab12721c6",
"trimType": "custom",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 128,
"height": 128,
"rawWidth": 128,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,31 @@
{
"ver": "2.2.0",
"uuid": "34edec32-02b1-417b-be02-63a9d1407cc1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"subMetas": {
"import-account": {
"ver": "1.0.4",
"uuid": "90bf1e2d-12ad-46e5-a4e8-a38ee60dffa4",
"rawTextureUuid": "34edec32-02b1-417b-be02-63a9d1407cc1",
"trimType": "custom",
"trimThreshold": 0,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 128,
"height": 128,
"rawWidth": 128,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,31 @@
{
"ver": "2.2.0",
"uuid": "f13e3a2a-cb07-497c-8378-9bede375158f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"subMetas": {
"menu": {
"ver": "1.0.4",
"uuid": "79264fc6-64dd-4649-844f-f050dba8ecce",
"rawTextureUuid": "f13e3a2a-cb07-497c-8378-9bede375158f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -0.5,
"trimX": 17,
"trimY": 18,
"width": 94,
"height": 93,
"rawWidth": 128,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -0,0 +1,31 @@
{
"ver": "2.2.0",
"uuid": "cda1b892-d230-407d-896a-fb0e5754644d",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"subMetas": {
"new-account": {
"ver": "1.0.4",
"uuid": "67fd1c96-89a2-4949-b807-226052342b6c",
"rawTextureUuid": "cda1b892-d230-407d-896a-fb0e5754644d",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 128,
"height": 128,
"rawWidth": 128,
"rawHeight": 128,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -17,14 +17,14 @@
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 425,
"height": 404,
"rawWidth": 425,
"rawHeight": 404,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"width": 40,
"height": 39,
"rawWidth": 40,
"rawHeight": 39,
"borderTop": 11,
"borderBottom": 10,
"borderLeft": 11,
"borderRight": 10,
"subMetas": {}
}
}

View File

@ -0,0 +1,26 @@
const {ccclass, property} = cc._decorator;
@ccclass
export default class IconBtn extends cc.Component {
@property(cc.Sprite)
btnSprite: cc.Sprite = null
@property(cc.Label)
titleLabel: cc.Label = null
callback: (title: string) => void
start () {
}
init(title: string, icon: cc.SpriteFrame) {
this.btnSprite.spriteFrame = icon
this.titleLabel.string = title
}
bindCallback(method: (title: string) => void) {
this.callback = method
}
onBtnClicked() {
this.callback && this.callback(this.titleLabel.string)
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "32f5c2f2-d94a-4661-bcb7-af9575639433",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -0,0 +1,85 @@
import { ZError } from "../common/ZError";
const {ccclass, property} = cc._decorator;
@ccclass
export default class MenuPanel extends cc.Component {
@property(cc.Prefab)
btnPreb: cc.Prefab = null;
@property(cc.Node)
contentNode: cc.Node = null;
@property({
type: [cc.SpriteFrame]
})
icons: cc.SpriteFrame[] = []
inited = false
btns = [
{title: 'Add Account', callback: this.onAddAccount.bind(this)},
{title: 'Import Account', callback: this.onImportAccount.bind(this)},
{title: 'Export Account', callback: this.onExportAccount.bind(this)},
{title: 'Backup Wallet', callback: this.onBackupWallet.bind(this)},
{title: 'Restore Wallet', callback: this.onRestoreWallet.bind(this)},
{title: 'Activity', callback: this.onActivity.bind(this)},
]
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
this.layoutBtns()
}
// update (dt) {}
onCloseClick() {
this.node.active = false
}
layoutBtns() {
if (this.inited) {
return
}
this.contentNode.removeAllChildren()
let count = Math.min(this.btns.length, this.icons.length)
for (let i = 0; i < count; i++) {
this.addOneBtn(this.btns[i], this.icons[i])
}
this.inited = true
}
addOneBtn(data: any, icon: cc.SpriteFrame) {
let btn = cc.instantiate(this.btnPreb)
btn.getComponent('IconBtn').init(data.title, icon)
btn.getComponent('IconBtn').bindCallback(this.onIconBtnClicked.bind(this))
this.contentNode.addChild(btn)
}
onIconBtnClicked(title: string) {
let obj = this.btns.find(o => o.title === title)
obj && obj.callback && obj.callback()
}
onAddAccount() {
console.log(this.inited)
console.log('onAddAccount: ')
}
onImportAccount() {
console.log('onImportAccount: ')
}
onExportAccount() {
console.log('onExportAccount: ')
}
onBackupWallet() {
console.log('onBackupWallet: ')
}
onRestoreWallet() {
console.log('onRestoreWallet: ')
}
onActivity() {
console.log('onActivity: ')
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "f2e8569b-6753-4373-9f28-052acf9b4e7b",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@ -45,7 +45,7 @@ export default class WalletInfo extends WalletBase {
formatAddress() {
if (this.accountId.length >= 10) {
return this.accountId.substring(0, 8) + '...' + this.accountId.substring(this.accountId.length - 8)
return this.accountId.substring(0, 6) + '...' + this.accountId.substring(this.accountId.length - 4)
} else if (this.accountId.length > 0 && this.accountId.length < 10) {
return this.accountId
} else {

View File

@ -18,6 +18,9 @@ export default class WalletMainPanel extends WalletBase {
})
listNode: ListNode = null
@property(cc.Node)
menuPanel: cc.Node = null
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
@ -41,4 +44,8 @@ export default class WalletMainPanel extends WalletBase {
}
}
onMenuClick() {
this.menuPanel.active = true
}
}

File diff suppressed because it is too large Load Diff