修改菜单和qr的显示方式
This commit is contained in:
parent
d6ea4330a1
commit
8d7930fd08
1041
assets/comp/wallet/prefab/MenuNode.prefab
Normal file
1041
assets/comp/wallet/prefab/MenuNode.prefab
Normal file
File diff suppressed because it is too large
Load Diff
7
assets/comp/wallet/prefab/MenuNode.prefab.meta
Normal file
7
assets/comp/wallet/prefab/MenuNode.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.1",
|
||||||
|
"uuid": "0bfa7bbc-42ab-4204-9fe7-3cd9b56eb045",
|
||||||
|
"optimizationPolicy": "AUTO",
|
||||||
|
"asyncLoadAssets": false,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
415
assets/comp/wallet/prefab/QrNode.prefab
Normal file
415
assets/comp/wallet/prefab/QrNode.prefab
Normal file
@ -0,0 +1,415 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"__type__": "cc.Prefab",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"_native": "",
|
||||||
|
"data": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"optimizationPolicy": 0,
|
||||||
|
"asyncLoadAssets": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Node",
|
||||||
|
"_name": "QrNode",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"_parent": null,
|
||||||
|
"_children": [
|
||||||
|
{
|
||||||
|
"__id__": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 8
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_active": true,
|
||||||
|
"_level": 1,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 11
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": {
|
||||||
|
"__id__": 12
|
||||||
|
},
|
||||||
|
"_opacity": 255,
|
||||||
|
"_color": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 255,
|
||||||
|
"g": 255,
|
||||||
|
"b": 255,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 1024,
|
||||||
|
"height": 512
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5
|
||||||
|
},
|
||||||
|
"_position": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 512,
|
||||||
|
"y": 256,
|
||||||
|
"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": "New Sprite(Splash)",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"_parent": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"_children": [],
|
||||||
|
"_active": true,
|
||||||
|
"_level": 4,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 3
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 4
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__id__": 5
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": {
|
||||||
|
"__id__": 7
|
||||||
|
},
|
||||||
|
"_opacity": 97,
|
||||||
|
"_color": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 0,
|
||||||
|
"g": 0,
|
||||||
|
"b": 0,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 1024,
|
||||||
|
"height": 512
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5
|
||||||
|
},
|
||||||
|
"_position": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"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__": "a23235d1-15db-4b95-8439-a2e005bfff91"
|
||||||
|
},
|
||||||
|
"_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.Widget",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"node": {
|
||||||
|
"__id__": 2
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"alignMode": 1,
|
||||||
|
"_target": null,
|
||||||
|
"_alignFlags": 45,
|
||||||
|
"_left": 0,
|
||||||
|
"_right": 0,
|
||||||
|
"_top": 0,
|
||||||
|
"_bottom": 0,
|
||||||
|
"_verticalCenter": 0,
|
||||||
|
"_horizontalCenter": 0,
|
||||||
|
"_isAbsLeft": true,
|
||||||
|
"_isAbsRight": true,
|
||||||
|
"_isAbsTop": true,
|
||||||
|
"_isAbsBottom": true,
|
||||||
|
"_isAbsHorizontalCenter": true,
|
||||||
|
"_isAbsVerticalCenter": true,
|
||||||
|
"_originalWidth": 100,
|
||||||
|
"_originalHeight": 100,
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Button",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"node": {
|
||||||
|
"__id__": 2
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"duration": 0.1,
|
||||||
|
"zoomScale": 1.2,
|
||||||
|
"clickEvents": [
|
||||||
|
{
|
||||||
|
"__id__": 6
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_N$interactable": true,
|
||||||
|
"_N$enableAutoGrayEffect": false,
|
||||||
|
"_N$transition": 0,
|
||||||
|
"transition": 0,
|
||||||
|
"_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": "287f2RBg4FGULo0MNLU+fmM",
|
||||||
|
"handler": "hideMe",
|
||||||
|
"customEventData": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.PrefabInfo",
|
||||||
|
"root": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"asset": {
|
||||||
|
"__uuid__": "0f14a371-be16-44a1-adcf-319d54c7ba3d"
|
||||||
|
},
|
||||||
|
"fileId": "892rmrF1lJTpW9wI5hBgto",
|
||||||
|
"sync": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.Node",
|
||||||
|
"_name": "qrImgNode",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"_parent": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"_children": [],
|
||||||
|
"_active": true,
|
||||||
|
"_level": 4,
|
||||||
|
"_components": [
|
||||||
|
{
|
||||||
|
"__id__": 9
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_prefab": {
|
||||||
|
"__id__": 10
|
||||||
|
},
|
||||||
|
"_opacity": 255,
|
||||||
|
"_color": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 255,
|
||||||
|
"g": 255,
|
||||||
|
"b": 255,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"_contentSize": {
|
||||||
|
"__type__": "cc.Size",
|
||||||
|
"width": 300,
|
||||||
|
"height": 300
|
||||||
|
},
|
||||||
|
"_anchorPoint": {
|
||||||
|
"__type__": "cc.Vec2",
|
||||||
|
"x": 0.5,
|
||||||
|
"y": 0.5
|
||||||
|
},
|
||||||
|
"_position": {
|
||||||
|
"__type__": "cc.Vec3",
|
||||||
|
"x": 0,
|
||||||
|
"y": 0,
|
||||||
|
"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__": "360a3jV8pdLLaS9OFBYhZwv",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"node": {
|
||||||
|
"__id__": 8
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"lightColor": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 255,
|
||||||
|
"g": 255,
|
||||||
|
"b": 255,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"deepColor": {
|
||||||
|
"__type__": "cc.Color",
|
||||||
|
"r": 0,
|
||||||
|
"g": 0,
|
||||||
|
"b": 0,
|
||||||
|
"a": 255
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.PrefabInfo",
|
||||||
|
"root": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"asset": {
|
||||||
|
"__uuid__": "0f14a371-be16-44a1-adcf-319d54c7ba3d"
|
||||||
|
},
|
||||||
|
"fileId": "7fdBt6xvJCbZha0tOFrOnZ",
|
||||||
|
"sync": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "287f2RBg4FGULo0MNLU+fmM",
|
||||||
|
"_name": "",
|
||||||
|
"_objFlags": 0,
|
||||||
|
"node": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"_enabled": true,
|
||||||
|
"qrComp": {
|
||||||
|
"__id__": 9
|
||||||
|
},
|
||||||
|
"_id": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__type__": "cc.PrefabInfo",
|
||||||
|
"root": {
|
||||||
|
"__id__": 1
|
||||||
|
},
|
||||||
|
"asset": {
|
||||||
|
"__uuid__": "0f14a371-be16-44a1-adcf-319d54c7ba3d"
|
||||||
|
},
|
||||||
|
"fileId": "60aR5zcbNMJKABPX77Q5lw",
|
||||||
|
"sync": false
|
||||||
|
}
|
||||||
|
]
|
7
assets/comp/wallet/prefab/QrNode.prefab.meta
Normal file
7
assets/comp/wallet/prefab/QrNode.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.1",
|
||||||
|
"uuid": "0f14a371-be16-44a1-adcf-319d54c7ba3d",
|
||||||
|
"optimizationPolicy": "AUTO",
|
||||||
|
"asyncLoadAssets": false,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
@ -22,3 +22,5 @@ export const WALLET_CHAIN_CHANGE = 'wallet_chain_change'
|
|||||||
export const WALLET_ACCOUNT_CHANGE = 'wallet_account_change'
|
export const WALLET_ACCOUNT_CHANGE = 'wallet_account_change'
|
||||||
|
|
||||||
export const WALLET_TOKEN_TYPE_CHANGE = 'wallet_token_type_change'
|
export const WALLET_TOKEN_TYPE_CHANGE = 'wallet_token_type_change'
|
||||||
|
|
||||||
|
export const WALLET_SHOW_QR = 'wallet_show_qr'
|
||||||
|
17
assets/comp/wallet/scripts/ui/QrNode.ts
Normal file
17
assets/comp/wallet/scripts/ui/QrNode.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import QRCodeComp from "./comp/QRCodeComp";
|
||||||
|
|
||||||
|
const {ccclass, property} = cc._decorator;
|
||||||
|
|
||||||
|
@ccclass
|
||||||
|
export default class QrNode extends cc.Component {
|
||||||
|
@property(QRCodeComp)
|
||||||
|
qrComp: QRCodeComp = null
|
||||||
|
|
||||||
|
showQr(val: string) {
|
||||||
|
this.qrComp.renderQr(val)
|
||||||
|
}
|
||||||
|
|
||||||
|
hideMe() {
|
||||||
|
this.node.active = false
|
||||||
|
}
|
||||||
|
}
|
9
assets/comp/wallet/scripts/ui/QrNode.ts.meta
Normal file
9
assets/comp/wallet/scripts/ui/QrNode.ts.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.5",
|
||||||
|
"uuid": "287f2441-8381-4650-ba34-30d2d4f9f98c",
|
||||||
|
"isPlugin": false,
|
||||||
|
"loadPluginInWeb": true,
|
||||||
|
"loadPluginInNative": true,
|
||||||
|
"loadPluginInEditor": false,
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import { formatPrice } from "../common/chain.util";
|
import { formatPrice } from "../common/chain.util";
|
||||||
import { WALLET_CHAIN_CHANGE } from "../common/WalletEvent";
|
import { WALLET_CHAIN_CHANGE, WALLET_SHOW_QR } from "../common/WalletEvent";
|
||||||
import { Bind } from "../decorator/AutoUpdateUI";
|
import { Bind } from "../decorator/AutoUpdateUI";
|
||||||
import JCWallet, { IChainData } from "../JCWallet";
|
import JCWallet, { IChainData } from "../JCWallet";
|
||||||
import { renderFromTokenMinimalUnit } from "../util/number.util";
|
import { renderFromTokenMinimalUnit } from "../util/number.util";
|
||||||
@ -18,15 +18,14 @@ export default class WalletInfo extends WalletBase {
|
|||||||
@property(cc.Label)
|
@property(cc.Label)
|
||||||
balanceLabel: cc.Label = null;
|
balanceLabel: cc.Label = null;
|
||||||
|
|
||||||
@property(cc.Node)
|
|
||||||
qrNode: cc.Node = null;
|
|
||||||
|
|
||||||
@property(HashIcon)
|
@property(HashIcon)
|
||||||
avatar: HashIcon = null;
|
avatar: HashIcon = null;
|
||||||
|
|
||||||
accountId: string = '';
|
accountId: string = '';
|
||||||
|
|
||||||
balance: string = ''
|
balance: string = ''
|
||||||
|
@property(cc.Node)
|
||||||
|
parentNode: cc.Node = null
|
||||||
|
|
||||||
// LIFE-CYCLE CALLBACKS:
|
// LIFE-CYCLE CALLBACKS:
|
||||||
|
|
||||||
@ -87,13 +86,7 @@ export default class WalletInfo extends WalletBase {
|
|||||||
const address = this.wallet.currentAccount().address
|
const address = this.wallet.currentAccount().address
|
||||||
const chainId = this.wallet.currentChain.id
|
const chainId = this.wallet.currentChain.id
|
||||||
let qrUrl = `ethereum:${address}@${chainId}`
|
let qrUrl = `ethereum:${address}@${chainId}`
|
||||||
this.showQr(qrUrl)
|
// this.showQr(qrUrl)
|
||||||
}
|
this.wallet.mainHandlers.emit(WALLET_SHOW_QR, qrUrl)
|
||||||
hideQr() {
|
|
||||||
this.qrNode.active = false
|
|
||||||
}
|
|
||||||
showQr(val: string) {
|
|
||||||
this.qrNode.active = true
|
|
||||||
this.qrNode.getChildByName('qrImgNode').getComponent('QRCodeComp').showQr(val)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { WALLET_SHOW_QR } from "../common/WalletEvent";
|
||||||
import JCWallet from "../JCWallet";
|
import JCWallet from "../JCWallet";
|
||||||
import ChainTab from "./ChainTab";
|
import ChainTab from "./ChainTab";
|
||||||
import ListNode from "./ListNode";
|
import ListNode from "./ListNode";
|
||||||
@ -18,8 +19,14 @@ export default class WalletMainPanel extends WalletBase {
|
|||||||
})
|
})
|
||||||
listNode: ListNode = null
|
listNode: ListNode = null
|
||||||
|
|
||||||
@property(cc.Node)
|
@property(cc.Prefab)
|
||||||
menuPanel: cc.Node = null
|
menuPreb: cc.Prefab = null
|
||||||
|
|
||||||
|
@property(cc.Prefab)
|
||||||
|
qrPreb: cc.Prefab = null
|
||||||
|
|
||||||
|
subNodeMap: Map<string, cc.Node> = new Map()
|
||||||
|
|
||||||
|
|
||||||
// LIFE-CYCLE CALLBACKS:
|
// LIFE-CYCLE CALLBACKS:
|
||||||
|
|
||||||
@ -27,6 +34,7 @@ export default class WalletMainPanel extends WalletBase {
|
|||||||
|
|
||||||
start () {
|
start () {
|
||||||
super.start()
|
super.start()
|
||||||
|
this.wallet.mainHandlers.on(WALLET_SHOW_QR, this.showQrNode.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
// update (dt) {}
|
// update (dt) {}
|
||||||
@ -44,8 +52,27 @@ export default class WalletMainPanel extends WalletBase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private fetchNode(tag: string, preb: cc.Prefab) {
|
||||||
|
if (!this.subNodeMap.has(tag)) {
|
||||||
|
const node = cc.instantiate(preb)
|
||||||
|
node.x = 0
|
||||||
|
node.y = 0
|
||||||
|
this.node.addChild(node)
|
||||||
|
this.subNodeMap.set(tag, node)
|
||||||
|
}
|
||||||
|
return this.subNodeMap.get(tag)
|
||||||
|
}
|
||||||
|
|
||||||
onMenuClick() {
|
onMenuClick() {
|
||||||
this.menuPanel.active = true
|
const tag = 'menu-node'
|
||||||
|
const node = this.fetchNode(tag, this.menuPreb)
|
||||||
|
node.active = true
|
||||||
|
}
|
||||||
|
|
||||||
|
showQrNode(val: string) {
|
||||||
|
const tag = 'qr-node'
|
||||||
|
const node = this.fetchNode(tag, this.qrPreb)
|
||||||
|
node.getComponent('QrNode').showQr(val)
|
||||||
|
node.active = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,9 @@ import { QR } from '../../lib/qrcode';
|
|||||||
@ccclass
|
@ccclass
|
||||||
export default class QRCodeComp extends cc.Component {
|
export default class QRCodeComp extends cc.Component {
|
||||||
|
|
||||||
@property({
|
@property(cc.Color)
|
||||||
type: cc.Color
|
|
||||||
})
|
|
||||||
lightColor: cc.Color = cc.Color.WHITE
|
lightColor: cc.Color = cc.Color.WHITE
|
||||||
@property({
|
@property(cc.Color)
|
||||||
type: cc.Color
|
|
||||||
})
|
|
||||||
deepColor: cc.Color = cc.Color.BLACK
|
deepColor: cc.Color = cc.Color.BLACK
|
||||||
|
|
||||||
preVal:string = ''
|
preVal:string = ''
|
||||||
@ -24,7 +20,7 @@ export default class QRCodeComp extends cc.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update (dt) {}
|
// update (dt) {}
|
||||||
showQr(val: string) {
|
renderQr(val: string) {
|
||||||
if (this.preVal === val) {
|
if (this.preVal === val) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user