更新登录

This commit is contained in:
DESKTOP-5RP3AKU\Jisol 2023-11-08 02:32:54 +08:00
parent 0b9cf0ea9b
commit c4e2798430
34 changed files with 3330 additions and 53 deletions

View File

@ -44,22 +44,25 @@
},
{
"__id__": 113
},
{
"__id__": 128
}
],
"_active": true,
"_components": [
{
"__id__": 128
"__id__": 143
},
{
"__id__": 130
"__id__": 145
},
{
"__id__": 132
"__id__": 147
}
],
"_prefab": {
"__id__": 134
"__id__": 149
},
"_lpos": {
"__type__": "cc.Vec3",
@ -2358,7 +2361,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": -257.954,
"y": 414.543,
"y": 444.499,
"z": 0
},
"_lrot": {
@ -2721,7 +2724,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": -122.84,
"y": 414.543,
"y": 444.499,
"z": 0
},
"_lrot": {
@ -3053,6 +3056,369 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "Button-004",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 129
}
],
"_active": true,
"_components": [
{
"__id__": 135
},
{
"__id__": 137
},
{
"__id__": 139
}
],
"_prefab": {
"__id__": 142
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -257.216,
"y": 388.865,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 512,
"__editorExtras__": {},
"_parent": {
"__id__": 128
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 130
},
{
"__id__": 132
}
],
"_prefab": {
"__id__": 134
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 129
},
"_enabled": true,
"__prefab": {
"__id__": 131
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "0dYLifIW9OqYbvWJwA9FIw"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 129
},
"_enabled": true,
"__prefab": {
"__id__": 133
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_string": "清除登录",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 20,
"_fontSize": 20,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 1,
"_enableWrapText": false,
"_font": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "78eEBfEAJCZ76oiIOAdJLy"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "0bQ8J+1HpGQJw+S7QHXV1Z",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 128
},
"_enabled": true,
"__prefab": {
"__id__": 136
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "b4khKqgSZBh58V5TThdbxj"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 128
},
"_enabled": true,
"__prefab": {
"__id__": 138
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "72VDDxVNFE76GqA+sf39oX"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 128
},
"_enabled": true,
"__prefab": {
"__id__": 140
},
"clickEvents": [
{
"__id__": 141
}
],
"_interactable": true,
"_transition": 2,
"_normalColor": {
"__type__": "cc.Color",
"r": 214,
"g": 214,
"b": 214,
"a": 255
},
"_hoverColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_pressedColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_normalSprite": {
"__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_hoverSprite": {
"__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_pressedSprite": {
"__uuid__": "544e49d6-3f05-4fa8-9a9e-091f98fc2ce8@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_disabledSprite": {
"__uuid__": "951249e0-9f16-456d-8b85-a6ca954da16b@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_duration": 0.1,
"_zoomScale": 1.2,
"_target": {
"__id__": 128
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f2hvwmdOlKJZs7O6wGRUDM"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "15051raQgZN6J5ICgY2OfSS",
"handler": "onClickToken",
"customEventData": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "37fEjaHr5OLJgNvj0MHHmo",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
@ -3063,7 +3429,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 129
"__id__": 144
},
"_contentSize": {
"__type__": "cc.Size",
@ -3091,7 +3457,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 131
"__id__": 146
},
"_alignFlags": 45,
"_target": null,
@ -3127,7 +3493,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 133
"__id__": 148
},
"frameText": {
"__id__": 19

View File

@ -45,7 +45,7 @@
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 720,
"x": 0,
"y": 0,
"z": 0
},
@ -758,8 +758,8 @@
},
"_alignFlags": 45,
"_target": null,
"_left": 720,
"_right": -720,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "1a5aef95-e0fa-4f73-816a-78c297501d3d",
"files": [],
"subMetas": {},
"userData": {}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.49",
"importer": "prefab",
"imported": true,
"uuid": "ab426a3a-eda6-4ddb-a87f-9eff7359e351",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "LoginView"
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "048f388d-5001-44c6-b9ee-10d65348b551",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,601 @@
[
{
"__type__": "cc.Prefab",
"_name": "TipsView",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "TipsView",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 22
},
{
"__id__": 24
},
{
"__id__": 26
}
],
"_prefab": {
"__id__": 28
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "tips",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
},
{
"__id__": 9
}
],
"_active": true,
"_components": [
{
"__id__": 17
},
{
"__id__": 19
}
],
"_prefab": {
"__id__": 21
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 490,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "bg",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
},
{
"__id__": 6
}
],
"_prefab": {
"__id__": 8
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": {
"__id__": 5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 500,
"height": 80
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "bcShr1JEFCyIp8BaO1nE+o"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 3
},
"_enabled": true,
"__prefab": {
"__id__": 7
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_spriteFrame": {
"__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f70O4oDUJDA7XXDFf5bytv"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "19ZAH9lVNDN7qtcsLjO0zS",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 10
},
{
"__id__": 12
},
{
"__id__": 14
}
],
"_prefab": {
"__id__": 16
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
},
"_enabled": true,
"__prefab": {
"__id__": 11
},
"_contentSize": {
"__type__": "cc.Size",
"width": 148,
"height": 54.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "3auNhBKbFIDrRZBSoyfsPl"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
},
"_enabled": true,
"__prefab": {
"__id__": 13
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "这是一个提示",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 24,
"_fontSize": 24,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_isItalic": false,
"_isBold": true,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "29UjfyEClH24RGffdP33o3"
},
{
"__type__": "cc.LabelOutline",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 9
},
"_enabled": true,
"__prefab": {
"__id__": 15
},
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_width": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "4eoEbFXjNLCrsBdIXgKOB5"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "eap34/Hj9C2Z/ZH5X2XSmX",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 18
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "80aM9gzLxLGb+zb/MnhRiR"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 20
},
"_alignFlags": 1,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 100,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 0,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c4w4iM4n1AdJY5o2IqHxM5"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "9a0GHPs5FIgIRrpt3OoezN",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 23
},
"_contentSize": {
"__type__": "cc.Size",
"width": 720,
"height": 1280
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "1dgJxmIH5HIpXD6y0/xMwI"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 25
},
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 100,
"_originalHeight": 100,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "582zBz6m5DKqmkTkiS/LE0"
},
{
"__type__": "76584YE7/1K9rPvckaow3Jg",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 27
},
"text": {
"__id__": 12
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "2dwIuZkhpJJbECbfdTbZNH"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "08xLpDDa9NlK3pgR7XiOqb",
"instance": null,
"targetOverrides": null
}
]

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.49",
"importer": "prefab",
"imported": true,
"uuid": "e6448a2d-8905-4c78-b693-d7cb42c22021",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "TipsView"
}
}

View File

@ -14,20 +14,21 @@ import { JsonLoad, JsonUtil } from "../../extensions/ngame/assets/ngame/util/Jso
import NGameMessage from "../../extensions/ngame/assets/ngame/util/NGameMessage";
import axios from "../../extensions/ngame/assets/plugins/axios.js";
import GBattleModeManager from "./battle/GBattleModeManager";
import { GLayer, UIConfig } from "./ui/UIConfig";
import { GLayer, GUI, UIConfig } from "./ui/UIConfig";
import JLoaderSystem from "../../extensions/ngame/assets/ngame/system/JLoaderSystem";
import { sp } from "cc";
import { SpriteFrame } from "cc";
import Loading from "../../extensions/ngame/assets/ngame/util/Loading";
import { TB, Tables } from "../resources/config/data/schema";
import { JsonAsset } from "cc";
import { GAction } from "./GActionEnum";
import { GAction } from "./consts/GActionEnum";
import { StorageData, StorageEnum } from "./consts/GData";
let IP = "localhost";
let IP = "kyu.jisol.cn";
//重写UI
class JNGLayer extends JNLayer{
layers: string[] = [GLayer.View];
layers: string[] = [GLayer.View,GLayer.Popup,GLayer.Tips];
views: { [key: string]: JNLayerInfo; } = UIConfig;
}
@ -37,12 +38,27 @@ class JNGSocket extends JNSocket{
this.on(GAction.TOKEN_EXPIRED,this.onTokenExpired.bind(this));
await super.onInit();
}
public url() {
return `ws://${IP}:8080/websocket/b113a866e5664f46b386c12c985d394a`;
public url():Promise<string> {
return new Promise<string>(resolve => {
//获取Token
let token = StorageData.get(StorageEnum.Token);
if(token){
resolve(`ws://${IP}:8080/websocket/${token}`)
return;
}
const loginResolve = (token:string) => {
resolve(`ws://${IP}:8080/websocket/${token}`);
}
//如果没有Token则弹出登入页面
app.layer.Open(GUI.Login,loginResolve);
});
}
//Token失效
onTokenExpired(){
console.log("onTokenExpired");
//清除Token
StorageData.delect(StorageEnum.Token);
}
}

View File

@ -1,9 +0,0 @@
export const GData = {
layer: {
World: 1,
}
}

View File

@ -23,11 +23,11 @@ export class Main extends Component {
{path:"proto/GDemo"}
]);
// //发生帧同步开始
// app.socket.Send(JNSyncAction.NSyncFrameStart);
//发生帧同步开始
app.socket.Send(JNSyncAction.NSyncFrameStart);
// // 创建世界
// director.getScene().addChild(instantiate(this.WorldPrefab));
// 创建世界
director.getScene().addChild(instantiate(this.WorldPrefab));
}

View File

@ -7,7 +7,7 @@ import { size } from "cc";
import { Size } from "cc";
import { v3 } from "cc";
import { Vec2 } from "cc";
import { GData } from "../../../GData";
import { GData } from "../../../consts/GData";
const { ccclass, property } = _decorator;
export interface GButtleDefaultInfo{

View File

@ -2,7 +2,7 @@ import { UITransform } from "cc";
import { Node } from "cc";
import { sp } from "cc";
import JNSkeleton from "../../../../../extensions/ngame/assets/ngame/sync/frame/game/spine/JNFrameSkeleton";
import { GData } from "../../../GData";
import { GData } from "../../../consts/GData";
import GNode from "./GNode";
export default class GEffectUtil {

View File

@ -1,5 +1,5 @@
import { Node } from "cc";
import { GData } from "../../../GData";
import { GData } from "../../../consts/GData";
import { UITransform } from "cc";

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "c8e51348-b270-4894-9e0e-d27172e9324e",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,32 @@
import { app } from "../App";
import { GUI } from "../ui/UIConfig";
const http = app.api;
const RData = (data:any) => {
if(data.data.state == 200){
return data.data.data;
}else{
//弹出提示
app.layer.Open(GUI.Tips,{text:data.data.msg});
return null;
}
}
export interface UserVO{
userId:number, //玩家Id
userName:string, //玩家名称
userPass:string, //玩家密码
}
export interface UserLoginVO{
token:string, //token
user:UserVO, //玩家信息
}
export const API = {
UserRegister : async () => RData(await http.post(`/user/register`)) as UserVO,
UserLogin : async (account:string,password:string) => RData(await http.post(`/user/login`,{userId:account,userPass:password})) as UserLoginVO,
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "503f2086-2c48-470c-90e0-98e92c5dd354",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -2,7 +2,7 @@
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "b0d5a426-cf84-4bbb-b06f-533234076520",
"uuid": "ed7dee3c-9396-4f08-bd29-deb690ca6cf8",
"files": [],
"subMetas": {},
"userData": {}

View File

@ -0,0 +1,30 @@
import { sys } from "cc";
export enum StorageEnum{
Token = "Storage_Token", // Token
}
export class StorageData {
static get(key:string):string{
return sys.localStorage.getItem(key);
}
static set(key:string,value:string){
sys.localStorage.setItem(key,value);
}
static delect(key:string){
sys.localStorage.removeItem(key);
}
}
export const GData = {
layer: {
World: 1,
}
}

View File

@ -2,7 +2,7 @@
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "e04ba6b5-5d91-4424-969a-8faa3dacf167",
"uuid": "d784fece-1a89-44ad-9119-29b965912c7d",
"files": [],
"subMetas": {},
"userData": {}

View File

@ -4,6 +4,8 @@ import { Toggle } from 'cc';
import { JNSyncAction } from '../../../../extensions/ngame/assets/ngame/sync/JNSyncAction';
import { director } from 'cc';
import { WorldCanvas } from '../../WorldCanvas';
import { StorageData, StorageEnum } from '../../consts/GData';
import { GUI } from '../UIConfig';
const { ccclass, property } = _decorator;
@ccclass('HomeView')
@ -39,10 +41,17 @@ export class HomeView extends JNGLayerBase {
//前往PVP
onClickGoPVP(){
director.getScene().getComponentInChildren(WorldCanvas).index = 0;
app.layer.Open(GUI.Tips,{text:"切换成功 请点击重置"});
}
//前往无尽
onClickGoOnHook(){
director.getScene().getComponentInChildren(WorldCanvas).index = 1;
app.layer.Open(GUI.Tips,{text:"切换成功 请点击重置"});
}
//清除Token
onClickToken(){
StorageData.delect(StorageEnum.Token);
app.layer.Open(GUI.Tips,{text:"清除成功"});
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "beb0794b-9e15-4b22-8b23-48017459df89",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,58 @@
import { _decorator, Component, Node } from 'cc';
import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
import { API } from '../../consts/API';
import { EditBox } from 'cc';
import { app } from '../../App';
import { GUI } from '../UIConfig';
import { StorageData, StorageEnum } from '../../consts/GData';
const { ccclass, property } = _decorator;
@ccclass('LoginView')
export class LoginView extends JNLayerBase {
resolve:(token:string) => void;
@property(EditBox)
account:EditBox;
@property(EditBox)
password:EditBox;
onJNLoad(resolve?: (token:string) => void): void {
super.onJNLoad();
this.resolve = resolve;
}
//点击登录
async onClickLogin(){
//校验
if(!(this.account.string.length) || !(this.password.string.length)){
app.layer.Open(GUI.Tips,{text:"请输入账号密码"});
return;
}
//登录账号
let info = await API.UserLogin(this.account.string,this.password.string);
if(info){
app.layer.Open(GUI.Tips,{text:"登录成功"});
//保存Token
StorageData.set(StorageEnum.Token,info.token);
this.resolve(info.token);
this.onJNClose();
}
}
//点击注册账号
async onClickRegister(){
//注册账号
let info = await API.UserRegister();
//显示提示
app.layer.Open(GUI.Tips,{text:"注册成功"});
//显示账号和密码
this.account.string = `${info.userId}`;
this.password.string = info.userPass;
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "d36bcaa8-bb30-419b-be25-ed9f10aef387",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "072aa010-a6b8-4ff4-b104-5bc19b5ac2fb",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,35 @@
import { _decorator, Component, Node } from 'cc';
import JNLayerBase from '../../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase';
import { app } from '../../../App';
import { Label } from 'cc';
const { ccclass, property } = _decorator;
export interface TipsArgs{
text?:string; //内容
time?:number; //显示时间
}
@ccclass('TipsView')
export class TipsView extends JNLayerBase {
@property(Label)
text:Label;
onJNLoad(data: TipsArgs = {}): void {
if(!data) data = {};
data.text = data.text || "这是一个提示";
data.time = data.time || 3;
//显示弹窗内容
this.text.string = data.text;
this.scheduleOnce(() => {
this.onJNClose();
},data.time)
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "76584604-effd-4af6-b3ef-7246a8c37260",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -3,15 +3,39 @@ import { JNLayerAnim, JNLayerInfo } from "../../../extensions/ngame/assets/ngame
export enum GLayer{
View = "View",
Popup = "Popup",
Tips = "Tips",
}
export enum GUI{
Loading = "Loading",
Home = "Home",
/** 系统UI */
Login = "Login", //登录页面
Loading = "Loading", //加载页面
Tips = "Tips", //提示
Home = "Home", //主页面
}
export const UIConfig:{ [key: string]: JNLayerInfo; } = {
[GUI.Loading]:{
//系统UI
const UISystemConfig:{ [key: string]: JNLayerInfo; } = {
[GUI.Tips]:{
layer:GLayer.Tips,
uri: "prefab/ui/System/Tips/TipsView",
anims:{
front:JNLayerAnim.BackOutOpen,
back:JNLayerAnim.BackInClose
}
},
[GUI.Login]:{
layer:GLayer.Popup,
uri: "prefab/ui/System/LoginView",
anims:{
front:JNLayerAnim.BackOutOpen,
back:JNLayerAnim.BackInClose
}
},
[GUI.Loading]:{
layer:GLayer.View,
uri: "prefab/ui/Loading/LoadingView",
anims:{
@ -19,7 +43,10 @@ export const UIConfig:{ [key: string]: JNLayerInfo; } = {
backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)}
},
},
[GUI.Home]:{
}
export const UIConfig:{ [key: string]: JNLayerInfo; } = {
[GUI.Home]:{
layer:GLayer.View,
uri: "prefab/ui/Home/HomeView",
anims:{
@ -29,5 +56,6 @@ export const UIConfig:{ [key: string]: JNLayerInfo; } = {
backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)}
},
},
...UISystemConfig
}

@ -1 +1 @@
Subproject commit 661098aefe9d7e1c6f0d3a4c587b3b15cc27abd8
Subproject commit dd626085f5719916c1732693c1e09546e1ef4756

@ -1 +1 @@
Subproject commit a23b0bc24282b113594d777e7db34d03379f07b6
Subproject commit b2141048e531cd2d44bea27887b570d0a2f300cd

View File

@ -3,9 +3,8 @@ package cn.jisol.game.controller;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.RandomUtil;
import cn.jisol.game.data.Cache;
import cn.jisol.game.dto.LoginDTO;
import cn.jisol.game.vo.LoginVO;
import cn.jisol.game.entity.User;
import cn.jisol.game.service.UserService;
import cn.jisol.game.service.impl.UserServiceImpl;
import cn.jisol.ngame.util.NewsContext;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@ -44,7 +43,7 @@ public class UserController {
@ApiImplicitParams({})
@ApiOperation(value = "登录账号")
@PostMapping("/login")
public NewsContext<LoginDTO> login(@RequestBody User user){
public NewsContext<LoginVO> login(@RequestBody User user){
if(Objects.isNull(user.getUserId()) || Objects.isNull(user.getUserPass())){
return NewsContext.onFail("登录失败");
}
@ -56,7 +55,7 @@ public class UserController {
//生成Token
String token = IdUtil.simpleUUID();
Cache.TOKEN.put(token,user);
return NewsContext.onSuccess("登录成功", LoginDTO.builder().user(user).token(token).build());
return NewsContext.onSuccess("登录成功", LoginVO.builder().user(user).token(token).build());
}else{
return NewsContext.onFail("登录失败");
}

View File

@ -1,15 +1,16 @@
package cn.jisol.game.listener;
import cfg.Tables;
import cn.hutool.core.io.resource.ResourceUtil;
import cn.jisol.game.data.TD;
import com.google.gson.JsonParser;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import org.springframework.util.ResourceUtils;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
@Component
public class InitGameListener {
@ -18,11 +19,10 @@ public class InitGameListener {
public void onApplicationEvent(ContextRefreshedEvent event) {
try {
InputStream fileInputStream;
TD.DATA = new Tables(file -> {
System.out.println("加载配置表:"+file);
return JsonParser.parseReader(
new FileReader(ResourceUtils.getFile("classpath:json/"+file+".json"))
);
return JsonParser.parseString(ResourceUtil.readUtf8Str("json/"+file+".json"));
});
} catch (IOException e) {
e.printStackTrace();

View File

@ -1,4 +1,4 @@
package cn.jisol.game.dto;
package cn.jisol.game.vo;
import cn.jisol.game.entity.User;
import io.swagger.annotations.ApiModel;
@ -8,7 +8,7 @@ import lombok.Data;
@ApiModel(value = "登录返回")
@Builder
@Data
public class LoginDTO {
public class LoginVO {
User user; //玩家信息
String token; //登录token
}