增加切换列表功能
This commit is contained in:
parent
05356feb23
commit
e38ab3e150
534
assets/comp/wallet/prefab/NftList.prefab
Normal file
534
assets/comp/wallet/prefab/NftList.prefab
Normal file
@ -0,0 +1,534 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "NftList",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_level": 1,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 13
|
||||
},
|
||||
{
|
||||
"__id__": 14
|
||||
},
|
||||
{
|
||||
"__id__": 15
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 16
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 450,
|
||||
"height": 400
|
||||
},
|
||||
"_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.Node",
|
||||
"_name": "content",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 3
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_level": 3,
|
||||
"_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": 450,
|
||||
"height": 120
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 1
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 200,
|
||||
"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": "OneNFT",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 4
|
||||
},
|
||||
{
|
||||
"__id__": 7
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_level": 4,
|
||||
"_components": [],
|
||||
"_prefab": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 120
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -175,
|
||||
"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": "New Sprite",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_level": 5,
|
||||
"_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": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 10,
|
||||
"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__": 4
|
||||
},
|
||||
"_enabled": true,
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061"
|
||||
},
|
||||
"_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__": "e64be85b-3d9f-4109-8e7d-48847666bf2c"
|
||||
},
|
||||
"fileId": "d60oW7FvtHeYQMK3B9YDtO",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "idLabel",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_level": 5,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 8
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 9
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 48.94,
|
||||
"height": 40
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0.5
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -50,
|
||||
"y": -45,
|
||||
"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__": 7
|
||||
},
|
||||
"_enabled": true,
|
||||
"_useOriginalSize": false,
|
||||
"_string": "Label",
|
||||
"_N$string": "Label",
|
||||
"_fontSize": 20,
|
||||
"_lineHeight": 40,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_N$horizontalAlign": 0,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 0,
|
||||
"_N$cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__uuid__": "e64be85b-3d9f-4109-8e7d-48847666bf2c"
|
||||
},
|
||||
"fileId": "fdPjhkyMBEwZHA5g8nn6Bd",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__uuid__": "e64be85b-3d9f-4109-8e7d-48847666bf2c"
|
||||
},
|
||||
"fileId": "d8aF0PaVNDOojtyTIMdXbp",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Layout",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"_layoutSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 450,
|
||||
"height": 120
|
||||
},
|
||||
"_resize": 1,
|
||||
"_N$layoutType": 3,
|
||||
"_N$padding": 0,
|
||||
"_N$cellSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 40,
|
||||
"height": 40
|
||||
},
|
||||
"_N$startAxis": 0,
|
||||
"_N$paddingLeft": 0,
|
||||
"_N$paddingRight": 0,
|
||||
"_N$paddingTop": 0,
|
||||
"_N$paddingBottom": 0,
|
||||
"_N$spacingX": 10,
|
||||
"_N$spacingY": 10,
|
||||
"_N$verticalDirection": 1,
|
||||
"_N$horizontalDirection": 0,
|
||||
"_N$affectedByScale": false,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__uuid__": "e64be85b-3d9f-4109-8e7d-48847666bf2c"
|
||||
},
|
||||
"fileId": "6e2xzjh/1GC5AU8a/D8Qwk",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.ScrollView",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"horizontal": false,
|
||||
"vertical": true,
|
||||
"inertia": true,
|
||||
"brake": 0.5,
|
||||
"elastic": true,
|
||||
"bounceDuration": 1,
|
||||
"scrollEvents": [],
|
||||
"cancelInnerEvents": true,
|
||||
"_N$content": {
|
||||
"__id__": 2
|
||||
},
|
||||
"content": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Mask",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"_spriteFrame": null,
|
||||
"_type": 0,
|
||||
"_segments": 64,
|
||||
"_N$alphaThreshold": 0,
|
||||
"_N$inverted": false,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "d8e744LBIpBeKlOm9Kvb6W7",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"tokenPreb": {
|
||||
"__uuid__": "259e752f-837f-4d16-b21f-3c886e3a7a7e"
|
||||
},
|
||||
"contentNode": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__uuid__": "e64be85b-3d9f-4109-8e7d-48847666bf2c"
|
||||
},
|
||||
"fileId": "edJmq9HR5CfZdb8CAuqySi",
|
||||
"sync": false
|
||||
}
|
||||
]
|
7
assets/comp/wallet/prefab/NftList.prefab.meta
Normal file
7
assets/comp/wallet/prefab/NftList.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "e64be85b-3d9f-4109-8e7d-48847666bf2c",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
286
assets/comp/wallet/prefab/OneNFT.prefab
Normal file
286
assets/comp/wallet/prefab/OneNFT.prefab
Normal file
@ -0,0 +1,286 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "OneNFT",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 5
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_level": 4,
|
||||
"_components": [],
|
||||
"_prefab": {
|
||||
"__id__": 8
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 120
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -175,
|
||||
"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": "New Sprite",
|
||||
"_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": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 10,
|
||||
"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__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061"
|
||||
},
|
||||
"_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": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "d60oW7FvtHeYQMK3B9YDtO",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "idLabel",
|
||||
"_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": 48.94,
|
||||
"height": 40
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0.5
|
||||
},
|
||||
"_position": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -50,
|
||||
"y": -45,
|
||||
"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": "Label",
|
||||
"_N$string": "Label",
|
||||
"_fontSize": 20,
|
||||
"_lineHeight": 40,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_N$horizontalAlign": 0,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 0,
|
||||
"_N$cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "fdPjhkyMBEwZHA5g8nn6Bd",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "d8aF0PaVNDOojtyTIMdXbp",
|
||||
"sync": false
|
||||
}
|
||||
]
|
7
assets/comp/wallet/prefab/OneNFT.prefab.meta
Normal file
7
assets/comp/wallet/prefab/OneNFT.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "259e752f-837f-4d16-b21f-3c886e3a7a7e",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -27,14 +27,17 @@
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_level": 4,
|
||||
"_level": 1,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 11
|
||||
},
|
||||
{
|
||||
"__id__": 12
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 12
|
||||
"__id__": 13
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
@ -176,7 +179,7 @@
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
"__uuid__": "e4b00542-5961-4a6a-8ae5-c19d30ac84a2"
|
||||
},
|
||||
"fileId": "1a8x2zZmNOU6glyFKwUfHp",
|
||||
"sync": false
|
||||
@ -274,7 +277,7 @@
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
"__uuid__": "e4b00542-5961-4a6a-8ae5-c19d30ac84a2"
|
||||
},
|
||||
"fileId": "7efChFqAdDMrznOWA5RJF0",
|
||||
"sync": false
|
||||
@ -372,7 +375,7 @@
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
"__uuid__": "e4b00542-5961-4a6a-8ae5-c19d30ac84a2"
|
||||
},
|
||||
"fileId": "65w39W/ddIsLb50QRubYhg",
|
||||
"sync": false
|
||||
@ -405,13 +408,32 @@
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "6b4b9CWT+hI3JIHIxZt7fsM",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"symbolLabel": {
|
||||
"__id__": 6
|
||||
},
|
||||
"countLabel": {
|
||||
"__id__": 9
|
||||
},
|
||||
"icon": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
"__uuid__": "e4b00542-5961-4a6a-8ae5-c19d30ac84a2"
|
||||
},
|
||||
"fileId": "adoQSiLjZG56t5GXVWQvlL",
|
||||
"sync": false
|
||||
|
@ -4,9 +4,11 @@ import sth = require("./lib/ethSigUtil");
|
||||
import('./lib/fetch');
|
||||
import { ZError } from "./common/ZError";
|
||||
import { AllChains } from "./data/allchain";
|
||||
import { createWalletEvents, WALLET_CHAIN_CHANGE } from "./common/WalletEvent";
|
||||
import { createWalletEvents, WALLET_CHAIN_CHANGE, WALLET_TOKEN_TYPE_CHANGE } from "./common/WalletEvent";
|
||||
import { ERC20Standard } from "./standards/ERC20Standard";
|
||||
import { ERC721Standard } from "./standards/ERC721Standard";
|
||||
import { IAccount, initAccount } from "./data/DataModel";
|
||||
import { DataManage } from "./manage/DataManage";
|
||||
|
||||
var global =
|
||||
(typeof globalThis !== 'undefined' && globalThis) ||
|
||||
@ -42,6 +44,8 @@ export default class JCWallet {
|
||||
public erc20Standard: ERC20Standard
|
||||
public erc721Standard: ERC721Standard
|
||||
public mainHandlers = createWalletEvents()
|
||||
private dataManage = new DataManage()
|
||||
public data: IAccount[] = []
|
||||
|
||||
constructor() {
|
||||
this.web3 = new Web3('https://rpc-testnet.kcc.network')
|
||||
@ -55,6 +59,7 @@ export default class JCWallet {
|
||||
this.web3.eth.accounts.wallet.save(this.password);
|
||||
}
|
||||
window.jc = window.jc || {wallet: this};
|
||||
this.data = this.dataManage.loadData()
|
||||
}
|
||||
|
||||
public init({chains}: {chains: number[]}) {
|
||||
@ -76,11 +81,27 @@ export default class JCWallet {
|
||||
return this._currentChain
|
||||
}
|
||||
|
||||
get currentAccountData() {
|
||||
let address = this.currentAccount().address;
|
||||
const chain = this.currentChain.id
|
||||
let data = this.data.find(o => o.address === address && o.chain === chain)
|
||||
if (data) {
|
||||
return data
|
||||
}
|
||||
data = initAccount(address, chain)
|
||||
return data
|
||||
}
|
||||
|
||||
updateCurrentChain(chainId: number) {
|
||||
const chainData = this.chainMap.get(chainId)
|
||||
this._currentChain = chainData
|
||||
this.web3.eth.setProvider(chainData.rpc)
|
||||
this.mainHandlers.emit(WALLET_CHAIN_CHANGE, chainData)
|
||||
this.updateListType('tokens')
|
||||
}
|
||||
|
||||
updateListType(type: string) {
|
||||
this.mainHandlers.emit(WALLET_TOKEN_TYPE_CHANGE, type)
|
||||
}
|
||||
|
||||
get chainList() {
|
||||
|
@ -18,3 +18,5 @@ let createWalletEvents = () => ({
|
||||
export { createWalletEvents }
|
||||
|
||||
export const WALLET_CHAIN_CHANGE = 'wallet_chain_change'
|
||||
|
||||
export const WALLET_TOKEN_TYPE_CHANGE = 'wallet_token_type_change'
|
||||
|
7
assets/comp/wallet/scripts/config.meta
Normal file
7
assets/comp/wallet/scripts/config.meta
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "172fb670-118a-47d0-889f-9b8ffc5bd786",
|
||||
"isSubpackage": false,
|
||||
"subpackageName": "",
|
||||
"subMetas": {}
|
||||
}
|
71
assets/comp/wallet/scripts/config/chain_config.ts
Normal file
71
assets/comp/wallet/scripts/config/chain_config.ts
Normal file
@ -0,0 +1,71 @@
|
||||
export const DEFALUT_TOKENS = {
|
||||
321: [
|
||||
{
|
||||
type: 'eth',
|
||||
address: 'eth',
|
||||
symbol: 'KCS',
|
||||
decimal: 18
|
||||
},
|
||||
{
|
||||
type: 'erc20',
|
||||
address: '0xcaA011E902103752435AC98657B046B282E36509',
|
||||
symbol: 'CEC',
|
||||
decimal: 18
|
||||
},
|
||||
{
|
||||
type: 'erc20',
|
||||
address: '0xBE023C9D294A4668f0d510E2570CB81B4536cE77',
|
||||
symbol: 'CEG',
|
||||
decimal: 18
|
||||
}
|
||||
],
|
||||
322: [
|
||||
{
|
||||
type: 'eth',
|
||||
address: 'eth',
|
||||
symbol: 'tKCS',
|
||||
decimal: 18
|
||||
},
|
||||
{
|
||||
type: 'erc20',
|
||||
address: '0xdb6D4bB22E2C12686Efff25a79EC78f9f078fe7D',
|
||||
symbol: 'CEC',
|
||||
decimal: 18
|
||||
},
|
||||
{
|
||||
type: 'erc20',
|
||||
address: '0xC5Cd606b3e9B80b758e8274B198c76D929aA094A',
|
||||
symbol: 'CEG',
|
||||
decimal: 18
|
||||
}
|
||||
],
|
||||
97: [
|
||||
{
|
||||
type: 'eth',
|
||||
address: 'eth',
|
||||
symbol: 'BNB',
|
||||
decimal: 18
|
||||
}
|
||||
],
|
||||
56: [
|
||||
{
|
||||
type: 'eth',
|
||||
address: 'eth',
|
||||
symbol: 'BNB',
|
||||
decimal: 18
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export const DEFAULT_NFT_TYPES = {
|
||||
321: {
|
||||
hero: '0x0EB362BD40F2288fF25A6Ee1b487cB0cb4638e0D',
|
||||
weapon: '0x29F67A372AC1c6AcF478A564992D421FE20F2cc8',
|
||||
chip: '0x54B6ED7EDe9355b471985439421Aa1DC7Da6Dc20'
|
||||
},
|
||||
322: {
|
||||
hero: '0x52917087cd4E48bDb5f336012E677f471f9E1C2D',
|
||||
weapon: '0x500AD8A4D50d71Af5cA8eA3b12B914f7aE5466f7',
|
||||
chip: '0x0640958BDb4D7956e1452FacEBD550C6Cf42aC94'
|
||||
}
|
||||
}
|
9
assets/comp/wallet/scripts/config/chain_config.ts.meta
Normal file
9
assets/comp/wallet/scripts/config/chain_config.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "cfb5ceb5-31ef-4881-b740-3d50b184247d",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
43
assets/comp/wallet/scripts/data/DataModel.ts
Normal file
43
assets/comp/wallet/scripts/data/DataModel.ts
Normal file
@ -0,0 +1,43 @@
|
||||
export interface IToken {
|
||||
address: string
|
||||
type: 'eth'|'erc20'
|
||||
default: boolean
|
||||
symbol?: string
|
||||
balance?: number
|
||||
decimal: number
|
||||
image?: string
|
||||
last?: number
|
||||
}
|
||||
|
||||
export interface INFT {
|
||||
address: string
|
||||
tokenId: string
|
||||
image?: string
|
||||
name?: string
|
||||
desc?: string
|
||||
last?: number
|
||||
}
|
||||
|
||||
export interface IAccount {
|
||||
address: string
|
||||
chain: number
|
||||
nickname?: string
|
||||
avatar?: string
|
||||
tokens: IToken[]
|
||||
heros: INFT[]
|
||||
weapons: INFT[]
|
||||
chips: INFT[]
|
||||
}
|
||||
|
||||
export function initAccount(address: string, chain: number): IAccount {
|
||||
let data: IAccount = {
|
||||
address,
|
||||
chain,
|
||||
tokens: [],
|
||||
heros: [],
|
||||
weapons: [],
|
||||
chips: []
|
||||
}
|
||||
//TODO: add default tokens
|
||||
return data
|
||||
}
|
9
assets/comp/wallet/scripts/data/DataModel.ts.meta
Normal file
9
assets/comp/wallet/scripts/data/DataModel.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "26cf8ea3-578a-449c-a7c3-f68f517f7399",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -1,12 +1,9 @@
|
||||
export function GET(url: string) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4 && (xhr.status >= 200 && xhr.status < 400)) {
|
||||
resolve && resolve(xhr.responseText);
|
||||
}
|
||||
};
|
||||
xhr.open("GET", url, true);
|
||||
xhr.send();
|
||||
})
|
||||
import('./fetch')
|
||||
|
||||
export async function GET(url: string) {
|
||||
return fetch(url)
|
||||
}
|
||||
|
||||
export async function GET_JSON(url: string) {
|
||||
return fetch(url).then(res => {return res.json()})
|
||||
}
|
7
assets/comp/wallet/scripts/manage.meta
Normal file
7
assets/comp/wallet/scripts/manage.meta
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "50e7e584-3477-4c9f-88a6-c5db79e582ad",
|
||||
"isSubpackage": false,
|
||||
"subpackageName": "",
|
||||
"subMetas": {}
|
||||
}
|
24
assets/comp/wallet/scripts/manage/DataManage.ts
Normal file
24
assets/comp/wallet/scripts/manage/DataManage.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import { IAccount } from "../data/DataModel";
|
||||
import { singleton } from "../decorator/singleton.decorator";
|
||||
|
||||
const LOCAL_ACCOUNT_DATAS = 'local_account_datas'
|
||||
@singleton
|
||||
export class DataManage{
|
||||
public loadData(){
|
||||
const dataStr = localStorage.getItem(LOCAL_ACCOUNT_DATAS)
|
||||
let result: IAccount[] = []
|
||||
if (dataStr) {
|
||||
try {
|
||||
result = JSON.parse(dataStr)
|
||||
} catch (err) {
|
||||
console.log('load local data error')
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
public saveData(datas: IAccount[]) {
|
||||
const dataStr = JSON.stringify(datas)
|
||||
localStorage.setItem(LOCAL_ACCOUNT_DATAS, dataStr)
|
||||
}
|
||||
}
|
9
assets/comp/wallet/scripts/manage/DataManage.ts.meta
Normal file
9
assets/comp/wallet/scripts/manage/DataManage.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "839e90e9-67f8-4e33-b7fb-fd23fcd31938",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
58
assets/comp/wallet/scripts/ui/ListNode.ts
Normal file
58
assets/comp/wallet/scripts/ui/ListNode.ts
Normal file
@ -0,0 +1,58 @@
|
||||
import { WALLET_TOKEN_TYPE_CHANGE } from "../common/WalletEvent";
|
||||
import { ZError } from "../common/ZError";
|
||||
import { DEFAULT_NFT_TYPES } from "../config/chain_config";
|
||||
import WalletBase from "./WallerBase";
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class ListNode extends WalletBase {
|
||||
|
||||
@property(cc.Prefab)
|
||||
nftListPreb: cc.Prefab = null
|
||||
|
||||
@property(cc.Node)
|
||||
tokenNode: cc.Node = null
|
||||
|
||||
otherNode: Map<string, cc.Node> = new Map()
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
// onLoad () {}
|
||||
|
||||
start () {
|
||||
super.start()
|
||||
this.wallet.mainHandlers.on(WALLET_TOKEN_TYPE_CHANGE, this.onTokenTypeChange.bind(this))
|
||||
}
|
||||
|
||||
// update (dt) {}
|
||||
initOneNftList(type: string) {
|
||||
if (this.otherNode.has(type)) {
|
||||
return this.otherNode.get(type)
|
||||
}
|
||||
const chain = this.wallet.currentChain.id
|
||||
let nftData: any = DEFAULT_NFT_TYPES[chain]
|
||||
if (!nftData) {
|
||||
throw new ZError(10, 'no nft data found')
|
||||
}
|
||||
let node = cc.instantiate(this.nftListPreb)
|
||||
node.active = false
|
||||
node.getComponent('NftList').address = nftData[type]
|
||||
this.node.addChild(node)
|
||||
this.otherNode.set(type, node)
|
||||
return node
|
||||
}
|
||||
|
||||
onTokenTypeChange(type: string) {
|
||||
console.log('on token type change: ', type)
|
||||
for (let key of this.otherNode.keys()) {
|
||||
this.otherNode.get(key).active = key === type
|
||||
}
|
||||
if (type === 'tokens') {
|
||||
this.tokenNode.active = true
|
||||
this.tokenNode.getComponent('TokenList').updateList()
|
||||
} else {
|
||||
this.tokenNode.active = false
|
||||
this.initOneNftList(type).active = true
|
||||
}
|
||||
}
|
||||
}
|
9
assets/comp/wallet/scripts/ui/ListNode.ts.meta
Normal file
9
assets/comp/wallet/scripts/ui/ListNode.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "7646c450-7ab1-45be-9aff-cd98a567ce0e",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -5,11 +5,13 @@ const {ccclass, property} = cc._decorator;
|
||||
@ccclass
|
||||
export default class NftList extends WalletBase {
|
||||
|
||||
@property(cc.Label)
|
||||
label: cc.Label = null;
|
||||
@property(cc.Prefab)
|
||||
tokenPreb: cc.Prefab = null
|
||||
|
||||
@property
|
||||
text: string = 'hello';
|
||||
@property(cc.Node)
|
||||
contentNode: cc.Node = null
|
||||
|
||||
public address: string = ''
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
|
26
assets/comp/wallet/scripts/ui/OneNFT.ts
Normal file
26
assets/comp/wallet/scripts/ui/OneNFT.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { INFT } from "../data/DataModel";
|
||||
import WalletBase from "./WallerBase";
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class OneNFT extends WalletBase {
|
||||
|
||||
@property(cc.Label)
|
||||
nftIDlabel: cc.Label = null;
|
||||
|
||||
@property(cc.Sprite)
|
||||
icon: cc.Sprite = null;
|
||||
|
||||
data: INFT = null
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
// onLoad () {}
|
||||
|
||||
start () {
|
||||
|
||||
}
|
||||
|
||||
// update (dt) {}
|
||||
}
|
9
assets/comp/wallet/scripts/ui/OneNFT.ts.meta
Normal file
9
assets/comp/wallet/scripts/ui/OneNFT.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "bb92d263-508f-4bc8-a9a8-324c8bf51f0e",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
43
assets/comp/wallet/scripts/ui/OneToken.ts
Normal file
43
assets/comp/wallet/scripts/ui/OneToken.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import { IToken } from "../data/DataModel";
|
||||
import WalletBase from "./WallerBase";
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class OneToken extends WalletBase {
|
||||
|
||||
@property(cc.Label)
|
||||
symbolLabel: cc.Label = null;
|
||||
|
||||
@property(cc.Label)
|
||||
countLabel: cc.Label = null;
|
||||
|
||||
@property(cc.Sprite)
|
||||
icon: cc.Sprite = null;
|
||||
|
||||
data: IToken = null
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
// onLoad () {}
|
||||
|
||||
start () {
|
||||
|
||||
}
|
||||
|
||||
// update (dt) {}
|
||||
init(_data: IToken) {
|
||||
this.data = _data
|
||||
if (this.data.symbol) {
|
||||
this.symbolLabel.string = this.data.symbol
|
||||
} else {
|
||||
// TODO: get from remote
|
||||
}
|
||||
|
||||
if (this.data.balance !== undefined) {
|
||||
this.countLabel.string = this.data.balance + ''
|
||||
} else {
|
||||
this.countLabel.string = '-'
|
||||
//TODO: get from remote
|
||||
}
|
||||
}
|
||||
}
|
9
assets/comp/wallet/scripts/ui/OneToken.ts.meta
Normal file
9
assets/comp/wallet/scripts/ui/OneToken.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "6b4b9096-4fe8-48dc-9207-23166dedfb0c",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -1,21 +1,54 @@
|
||||
import { DEFALUT_TOKENS } from "../config/chain_config";
|
||||
import { IToken } from "../data/DataModel";
|
||||
import WalletBase from "./WallerBase";
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class TokenList extends cc.Component {
|
||||
export default class TokenList extends WalletBase {
|
||||
|
||||
@property(cc.Label)
|
||||
label: cc.Label = null;
|
||||
@property(cc.Prefab)
|
||||
tokenPreb: cc.Prefab = null
|
||||
|
||||
@property
|
||||
text: string = 'hello';
|
||||
@property(cc.Node)
|
||||
contentNode: cc.Node = null
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
// onLoad () {}
|
||||
|
||||
start () {
|
||||
|
||||
super.start()
|
||||
this.updateList()
|
||||
}
|
||||
|
||||
// update (dt) {}
|
||||
|
||||
updateList() {
|
||||
this.contentNode.removeAllChildren()
|
||||
const accountData =this.wallet.currentAccountData
|
||||
if (!accountData) {
|
||||
return
|
||||
}
|
||||
if (accountData.tokens.length == 0) {
|
||||
let tokens = this.currentTokens()
|
||||
for (let token of tokens) {
|
||||
accountData.tokens.push(token)
|
||||
}
|
||||
}
|
||||
for (let data of accountData.tokens) {
|
||||
this.addOneToken(data)
|
||||
}
|
||||
}
|
||||
|
||||
currentTokens() {
|
||||
const chain = this.wallet.currentChain.id
|
||||
return DEFALUT_TOKENS[chain] || []
|
||||
}
|
||||
|
||||
addOneToken(data: IToken) {
|
||||
let node = cc.instantiate(this.tokenPreb)
|
||||
node.getComponent('OneToken').init(data)
|
||||
this.contentNode.addChild(node)
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { DEFAULT_NFT_TYPES } from "../config/chain_config";
|
||||
import JCWallet from "../JCWallet";
|
||||
import ButtonGroup, { BTN_SELECT_INDEX_CHANGE } from "./ButtonGroup";
|
||||
import TextBtn from "./TextBtn";
|
||||
@ -21,7 +22,7 @@ export default class TokenTab extends WalletBase {
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
// onLoad () {}
|
||||
private titles = ['Tokens', 'Hero', 'Weapon', 'Chip']
|
||||
private titles = ['tokens']
|
||||
|
||||
start () {
|
||||
super.start()
|
||||
@ -37,7 +38,15 @@ export default class TokenTab extends WalletBase {
|
||||
|
||||
// update (dt) {}
|
||||
showAllBtn() {
|
||||
console.log('show all token tab')
|
||||
this.titles.length = 1
|
||||
const chain = this.wallet.currentChain.id
|
||||
let nftData: any = DEFAULT_NFT_TYPES[chain]
|
||||
if (nftData) {
|
||||
for (let key in nftData) {
|
||||
this.titles.push(key)
|
||||
}
|
||||
}
|
||||
console.log('show all token tab: ', this.titles)
|
||||
for (let i = 0, l = this.titles.length; i < l; i++) {
|
||||
const btn = cc.instantiate(this.btnPreb)
|
||||
const btnM: TextBtn = btn.getComponent(TextBtn)
|
||||
@ -50,5 +59,7 @@ export default class TokenTab extends WalletBase {
|
||||
|
||||
onTokenTypeChange(data: {index: number}) {
|
||||
console.log('on token change: ', JSON.stringify(data))
|
||||
let type = this.titles[data.index]
|
||||
this.wallet.updateListType(type)
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import JCWallet from "../JCWallet";
|
||||
import ChainTab from "./ChainTab";
|
||||
import ListNode from "./ListNode";
|
||||
import WalletBase from "./WallerBase";
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
@ -12,6 +13,11 @@ export default class WalletMainPanel extends WalletBase {
|
||||
})
|
||||
chainTab: ChainTab = null
|
||||
|
||||
@property({
|
||||
type: ListNode
|
||||
})
|
||||
listNode: ListNode = null
|
||||
|
||||
// LIFE-CYCLE CALLBACKS:
|
||||
|
||||
// onLoad () {}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@ import { WALLET_CHAIN_CHANGE } from "../../comp/wallet/scripts/common/WalletEven
|
||||
import JCWallet, { IChainData } from "../../comp/wallet/scripts/JCWallet";
|
||||
import sth = require("../../comp/wallet/scripts/lib/ethSigUtil");
|
||||
import('../../comp/wallet/scripts/lib/fetch');
|
||||
import { GET } from "../../comp/wallet/scripts/lib/Http";
|
||||
import { GET, GET_JSON } from "../../comp/wallet/scripts/lib/Http";
|
||||
import { renderFromTokenMinimalUnit, renderFromWei } from "../../comp/wallet/scripts/util/number.util";
|
||||
|
||||
const {ccclass, property} = cc._decorator;
|
||||
@ -53,11 +53,9 @@ export default class WalletController extends cc.Component {
|
||||
let account = this.wallet.currentAccount()
|
||||
let nonceUrlBase = this.apiBase + '/webapp/index.php?c=Market&a=getNonce'
|
||||
let nonceUrl = `${nonceUrlBase}&account=${account.address}&net_id=322`
|
||||
let res = await GET(nonceUrl);
|
||||
let obj: any = {}
|
||||
obj = JSON.parse(res as string);
|
||||
let obj: any = await GET_JSON(nonceUrl);
|
||||
const nonce = obj.nonce;
|
||||
console.log(res);
|
||||
console.log(obj);
|
||||
const tips:string = 'signrequest'
|
||||
const signMsg = {
|
||||
tips,
|
||||
@ -89,7 +87,7 @@ export default class WalletController extends cc.Component {
|
||||
console.log(`is same: ${account.address.toLowerCase() == resultAddress}`)
|
||||
let loginUrlBase = this.apiBase + '/webapp/index.php?c=Market&a=auth'
|
||||
let loginUrl = `${loginUrlBase}&account=${account.address}&nonce=${nonce}&signature=${result}&tips=${tips.replace(/\ /g, '+')}&net_id=322`
|
||||
let resLogin = await GET(loginUrl);
|
||||
let resLogin = await GET_JSON(loginUrl);
|
||||
console.log(resLogin);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user