提交升级

This commit is contained in:
DESKTOP-5RP3AKU\Jisol 2023-11-28 02:13:05 +08:00
parent 62959f80e4
commit 07db3912cc
46 changed files with 2482 additions and 961 deletions

Binary file not shown.

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "74a175d5-0c0f-465a-883c-8c9af5b40cfe",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "db84da0f-9f72-42b4-aac3-31a93092820f",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "191aa1fb-ff89-4513-89a0-4e251d5cb524",
"files": [],
"subMetas": {},
"userData": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,134 @@
{
"ver": "1.0.26",
"importer": "image",
"imported": true,
"uuid": "b3481cef-e88f-43bd-a899-107d397c50e0",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "b3481cef-e88f-43bd-a899-107d397c50e0@6c48a",
"displayName": "ty_xingxing",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "repeat",
"wrapModeT": "repeat",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "b3481cef-e88f-43bd-a899-107d397c50e0",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "b3481cef-e88f-43bd-a899-107d397c50e0@f9941",
"displayName": "ty_xingxing",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 40,
"height": 39,
"rawWidth": 40,
"rawHeight": 39,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-20,
-19.5,
0,
20,
-19.5,
0,
-20,
19.5,
0,
20,
19.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
39,
40,
39,
0,
0,
40,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-20,
-19.5,
0
],
"maxPos": [
20,
19.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "b3481cef-e88f-43bd-a899-107d397c50e0@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"fixAlphaTransparencyArtifacts": true,
"hasAlpha": true,
"type": "sprite-frame",
"redirect": "b3481cef-e88f-43bd-a899-107d397c50e0@f9941"
}
}

View File

@ -349,7 +349,7 @@ export class TbGRoleUpLevel {
if (_json_.grade === undefined) { throw new Error() } if (_json_.grade === undefined) { throw new Error() }
this.grade = _json_.grade this.grade = _json_.grade
if (_json_.materials === undefined) { throw new Error() } if (_json_.materials === undefined) { throw new Error() }
{ this.materials = []; for(let _ele of _json_.materials) { let _e; _e = new TbGEntity.Resource(_ele); this.materials.push(_e);}} { this.materials = []; for(let _ele of _json_.materials) { let _e; _e = new TbGEntity.TResource(_ele); this.materials.push(_e);}}
} }
/** /**
@ -359,7 +359,7 @@ export class TbGRoleUpLevel {
/** /**
* *
*/ */
readonly materials: TbGEntity.Resource[] readonly materials: TbGEntity.TResource[]
resolve(tables:Tables) resolve(tables:Tables)
{ {
@ -373,7 +373,7 @@ export namespace TbGEntity {
/** /**
* *
*/ */
export class Resource { export class TResource {
constructor(_json_: any) { constructor(_json_: any) {
if (_json_.id === undefined) { throw new Error() } if (_json_.id === undefined) { throw new Error() }
@ -498,6 +498,8 @@ export class TbGRoleBaseAttribute {
constructor(_json_: any) { constructor(_json_: any) {
if (_json_.id === undefined) { throw new Error() } if (_json_.id === undefined) { throw new Error() }
this.id = _json_.id this.id = _json_.id
if (_json_.Blood === undefined) { throw new Error() }
this.Blood = _json_.Blood
if (_json_.Attack === undefined) { throw new Error() } if (_json_.Attack === undefined) { throw new Error() }
this.Attack = _json_.Attack this.Attack = _json_.Attack
if (_json_.Defend === undefined) { throw new Error() } if (_json_.Defend === undefined) { throw new Error() }
@ -508,6 +510,10 @@ export class TbGRoleBaseAttribute {
* Id (0 ) * Id (0 )
*/ */
readonly id: number readonly id: number
/**
*
*/
readonly Blood: number
/** /**
* *
*/ */

View File

@ -8,5 +8,10 @@
"id": 110002, "id": 110002,
"name": "防御", "name": "防御",
"sign": "Defend" "sign": "Defend"
},
{
"id": 110003,
"name": "血量",
"sign": "Blood"
} }
] ]

View File

@ -1,6 +1,7 @@
[ [
{ {
"id": 0, "id": 0,
"Blood": 100,
"Attack": 10, "Attack": 10,
"Defend": 5 "Defend": 5
} }

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "168231ad-d078-4779-8f9f-e44d5227ae32",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -23,25 +23,22 @@
}, },
{ {
"__id__": 8 "__id__": 8
},
{
"__id__": 22
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 14 "__id__": 36
}, },
{ {
"__id__": 16 "__id__": 38
},
{
"__id__": 18
},
{
"__id__": 20
} }
], ],
"_prefab": { "_prefab": {
"__id__": 22 "__id__": 40
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -210,24 +207,81 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Spine", "_name": "角色遮罩",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
"__id__": 1 "__id__": 1
}, },
"_children": [
{
"__id__": 9
}
],
"_active": true,
"_components": [
{
"__id__": 15
},
{
"__id__": 17
},
{
"__id__": 19
}
],
"_prefab": {
"__id__": 21
},
"_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": "Spine",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 8
},
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 9 "__id__": 10
}, },
{ {
"__id__": 11 "__id__": 12
} }
], ],
"_prefab": { "_prefab": {
"__id__": 13 "__id__": 14
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -264,11 +318,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 8 "__id__": 9
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 10 "__id__": 11
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@ -292,11 +346,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 8 "__id__": 9
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 12 "__id__": 13
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@ -348,11 +402,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 1 "__id__": 8
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 15 "__id__": 16
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@ -368,28 +422,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "60HDOce21EU4mT/teH3tKt" "fileId": "91h3J1Qo9NKp8P7pZ/ijRa"
},
{
"__type__": "b3809FuWrhB2ovECDdqMTOs",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 17
},
"spine": {
"__id__": 11
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a8v6Wyt6FBsbms2ouS3gEa"
}, },
{ {
"__type__": "cc.Mask", "__type__": "cc.Mask",
@ -397,11 +430,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 1 "__id__": 8
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 19 "__id__": 18
}, },
"_type": 0, "_type": 0,
"_inverted": false, "_inverted": false,
@ -411,7 +444,7 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "10zYj9H5FENZXD89pQVuyU" "fileId": "bay7jjytVJP6Fzx/k5RFdU"
}, },
{ {
"__type__": "cc.Graphics", "__type__": "cc.Graphics",
@ -419,11 +452,11 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"node": { "node": {
"__id__": 1 "__id__": 8
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 21 "__id__": 20
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@ -457,7 +490,377 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "1broUYdiFORJt5rRvetp3L" "fileId": "4fJHZYu41AYIvcwxfCrJ6o"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "fc1fm88XdG0IiJpjOWJQQH",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "星星",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 23
}
],
"_active": true,
"_components": [
{
"__id__": 31
},
{
"__id__": 33
}
],
"_prefab": {
"__id__": 35
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -41.077,
"y": 40.126,
"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": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 22
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 24
},
{
"__id__": 26
},
{
"__id__": 28
}
],
"_prefab": {
"__id__": 30
},
"_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__": 23
},
"_enabled": true,
"__prefab": {
"__id__": 25
},
"_contentSize": {
"__type__": "cc.Size",
"width": 15.123046875,
"height": 54.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "22LToggJFLz65T8RSXgQ+S"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 23
},
"_enabled": true,
"__prefab": {
"__id__": 27
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "1",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 20,
"_fontSize": 20,
"_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": "4abtrwT6VLZqOPs/7wUWc8"
},
{
"__type__": "cc.LabelOutline",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 23
},
"_enabled": true,
"__prefab": {
"__id__": 29
},
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_width": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "0bN96UC0FDdYVC4Gmw8XkI"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "a7Hwx3lcdMKpr4iJlqOtWX",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 22
},
"_enabled": true,
"__prefab": {
"__id__": 32
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 39
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "ffoTb67zBPv7VLwxcj9Uos"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 22
},
"_enabled": true,
"__prefab": {
"__id__": 34
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "b3481cef-e88f-43bd-a899-107d397c50e0@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "110QuG7J1EEYTogHJ93mar"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "b6faJYRuNA3ImW/X+NRkI4",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 37
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "60HDOce21EU4mT/teH3tKt"
},
{
"__type__": "b3809FuWrhB2ovECDdqMTOs",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 39
},
"spine": {
"__id__": 12
},
"starNode": {
"__id__": 22
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a8v6Wyt6FBsbms2ouS3gEa"
}, },
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "969fb4a4-4ab2-4659-8503-e4ba950b83be",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,791 @@
[
{
"__type__": "cc.Prefab",
"_name": "宠物预览窗口",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "宠物预览窗口",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 8
},
{
"__id__": 22
}
],
"_active": true,
"_components": [
{
"__id__": 30
},
{
"__id__": 32
},
{
"__id__": 34
}
],
"_prefab": {
"__id__": 36
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -134.352,
"y": -148.623,
"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": "Spine",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 5
}
],
"_prefab": {
"__id__": 7
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -85.798,
"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__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 4
},
"_contentSize": {
"__type__": "cc.Size",
"width": 100,
"height": 100
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "5eaQjItvlAsrp/s4neGckz"
},
{
"__type__": "sp.Skeleton",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 6
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_skeletonData": null,
"defaultSkin": "",
"defaultAnimation": "",
"_premultipliedAlpha": true,
"_timeScale": 1,
"_preCacheMode": -1,
"_cacheMode": 0,
"_defaultCacheMode": 0,
"_sockets": [],
"_useTint": false,
"_debugMesh": false,
"_debugBones": false,
"_debugSlots": false,
"_enableBatch": false,
"loop": true,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "3fo+IzfNJI24xTt+l2NFlf"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "e2V1sMadtGB4Y4Z6L/J3A0",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "星星",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 9
}
],
"_active": true,
"_components": [
{
"__id__": 17
},
{
"__id__": 19
}
],
"_prefab": {
"__id__": 21
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -68,
"y": 96.216,
"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": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 8
},
"_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": 15.123046875,
"height": 54.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "41qw3OlLpADr0Lwpashx67"
},
{
"__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": "1",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 20,
"_fontSize": 20,
"_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": "85EWjPVyBKJKbIENMWQgge"
},
{
"__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": "e2AWmVveVDV5PIXM41gvOy"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "a71rIoiKBMkZjUYNYnyYE1",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 8
},
"_enabled": true,
"__prefab": {
"__id__": 18
},
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 39
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "08l8Xi3jhJpa1Bp9Ec7TsB"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 8
},
"_enabled": true,
"__prefab": {
"__id__": 20
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "b3481cef-e88f-43bd-a899-107d397c50e0@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c9okoCKF1D3bKit1FhOlJu"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "90C5iRpBFEBZo4hc/0yfoC",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "等级",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 23
},
{
"__id__": 25
},
{
"__id__": 27
}
],
"_prefab": {
"__id__": 29
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 91.671,
"y": 97.743,
"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__": 22
},
"_enabled": true,
"__prefab": {
"__id__": 24
},
"_contentSize": {
"__type__": "cc.Size",
"width": 64.029296875,
"height": 54.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 1,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "78JIvK0FREbqEhO1kogNv5"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 22
},
"_enabled": true,
"__prefab": {
"__id__": 26
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "Lv 0",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 30,
"_fontSize": 30,
"_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": "b2mKTy6QdPWJJhD7CXdlrR"
},
{
"__type__": "cc.LabelOutline",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 22
},
"_enabled": true,
"__prefab": {
"__id__": 28
},
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_width": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "eaWfe0LjVMFL4LAeesnWN4"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "15tRVHOgZEsbSrCaLbLuf5",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 31
},
"_contentSize": {
"__type__": "cc.Size",
"width": 200,
"height": 250
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "edT/qBxmdNWLuZFmLuO3EP"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 33
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 201,
"g": 201,
"b": 201,
"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": "cdYxPWhL5JjaGfk+yEamDT"
},
{
"__type__": "f4237aKd5BKL7AFpAEQq6kF",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 35
},
"starNode": {
"__id__": 8
},
"levelLabel": {
"__id__": 25
},
"spine": {
"__id__": 5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "bc8qV/Jc9CToUMI6ap2Chd"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "89WDKPsx9CX5sG3Mkwo+WZ",
"instance": null,
"targetOverrides": null
}
]

View File

@ -0,0 +1,13 @@
{
"ver": "1.1.49",
"importer": "prefab",
"imported": true,
"uuid": "561f1c86-f948-432d-8250-f204ff864dbd",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "宠物预览窗口"
}
}

View File

@ -71,7 +71,7 @@ export interface PlayerPetOV{
petId:number, //宠物唯一Id petId:number, //宠物唯一Id
petPlayerId:number; //宠物的玩家Id petPlayerId:number; //宠物的玩家Id
petTbId:number; //宠物配置表Id petTbId:number; //宠物配置表Id
petGrade:number; //宠物等级 petLevel:number; //宠物等级
petStar:number; //宠物星级 petStar:number; //宠物星级
petStarExp:number; //宠物星级经验 petStarExp:number; //宠物星级经验
} }
@ -103,6 +103,8 @@ export const API = {
GetPlayerPets: async () => RData(await app.api.get(`/game/pet/list`),false) as PlayerPetOV[], //获取玩家全部宠物 GetPlayerPets: async () => RData(await app.api.get(`/game/pet/list`),false) as PlayerPetOV[], //获取玩家全部宠物
//petId 需合成的Id pets 被合成的Id列表 //petId 需合成的Id pets 被合成的Id列表
PetUpStar: async (petId:number,pets:number[]) => RData(await app.api.post(`/game/pet/up/star`,{petId,pets}),true) as PlayerPetOV, //提升宠物星 PetUpStar: async (petId:number,pets:number[]) => RData(await app.api.post(`/game/pet/up/star`,{petId,pets}),true) as PlayerPetOV, //提升宠物星
//petId 升级的宠物Id
PetUpLevel: async (petId:number) => RData(await app.api.post(`/game/pet/up/level/${petId}`),true) as PlayerPetOV, //升级宠物
/********** 阵法接口 ******************/ /********** 阵法接口 ******************/
GetPlayerTactical: async () => RData(await app.api.get(`/game/tactical/get`),false) as PlayerTacticalOV, //获取玩家阵法 GetPlayerTactical: async () => RData(await app.api.get(`/game/tactical/get`),false) as PlayerTacticalOV, //获取玩家阵法

View File

@ -75,7 +75,7 @@ export default class PlayerPetData extends BaseData{
if(pet){ if(pet){
//更新数据 //更新数据
Object.assign(pet,resource); Object.assign(pet,resource);
app.event.emit(PlayerPetEvent.UPDATE_INFO) app.event.emit(PlayerPetEvent.UPDATE_INFO,pet)
}else{ }else{
operation = ResourceUpdateType.ADD; operation = ResourceUpdateType.ADD;
this.onUpdateOV(operation,resource); this.onUpdateOV(operation,resource);

View File

@ -3,6 +3,9 @@ import { _decorator, Component, Node } from 'cc';
import { app } from '../../../App'; import { app } from '../../../App';
import { UIPetAnim } from '../../../consts/GData'; import { UIPetAnim } from '../../../consts/GData';
import { v3 } from 'cc'; import { v3 } from 'cc';
import { PlayerPetOV } from '../../../consts/API';
import { Label } from 'cc';
import { PlayerPetEvent } from '../../../data/PlayerPetData';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('PetIcon') @ccclass('PetIcon')
@ -11,12 +14,53 @@ export class PetIcon extends Component {
@property(sp.Skeleton) @property(sp.Skeleton)
spine:sp.Skeleton; spine:sp.Skeleton;
//设置icon @property(Node)
setIcon(petTbId:number){ starNode:Node; //星星
this.spine.skeletonData = app.battleRes.roleSpine[petTbId]; info:PlayerPetOV;
onLoad(){
this.reset();
//监听
app.event.on(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this)
}
protected onDestroy(): void {
app.event.off(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this)
}
//初始化
reset(){
this.starNode.active = false;
}
//信息更新
onUpdateInfo(info:PlayerPetOV){
if(this.info && info.petId == this.info.petId){
this.onUpdateView(); //刷新页面
}
}
//刷新页面
onUpdateView(){
this.spine.skeletonData = app.battleRes.roleSpine[this.info.petTbId];
this.spine.setAnimation(0,UIPetAnim.std,true); this.spine.setAnimation(0,UIPetAnim.std,true);
if(this.info.petStar){
this.starNode.active = true;
this.starNode.getComponentInChildren(Label).string = `${this.info.petStar}`;
}
}
//设置icon
set(info:PlayerPetOV){
this.reset();
this.info = info;
this.onUpdateView();
} }
} }

View File

@ -1,5 +1,6 @@
import { _decorator, Component, Node } from 'cc'; import { _decorator, Component, Node } from 'cc';
import { PetIcon } from './PetIcon'; import { PetIcon } from './PetIcon';
import { PlayerPetOV } from '../../../consts/API';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('PetIconSelect') @ccclass('PetIconSelect')
@ -43,10 +44,10 @@ export class PetIconSelect extends Component {
} }
//设置icon //设置
setIcon(petTbId:number){ set(info:PlayerPetOV){
this.petIcon.setIcon(petTbId); this.petIcon.set(info);
} }

View File

@ -11,7 +11,7 @@ export class PetIconSelectScroll extends JNScrollViewItem<PlayerPetOV> {
select:PetIconSelect; select:PetIconSelect;
protected start(): void { protected start(): void {
this.select.setIcon(this.data.petTbId); this.select.set(this.data);
} }
} }

View File

@ -0,0 +1,9 @@
{
"ver": "1.2.0",
"importer": "directory",
"imported": true,
"uuid": "c1b92428-4724-4f3e-b2c6-416af802434c",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,78 @@
import { sp } from 'cc';
import { _decorator, Component, Node } from 'cc';
import { PlayerPetOV } from '../../../../consts/API';
import { app } from '../../../../App';
import { UIPetAnim } from '../../../../consts/GData';
import { Label } from 'cc';
import { PlayerPetEvent } from '../../../../data/PlayerPetData';
const { ccclass, property } = _decorator;
@ccclass('PetPreviewWindow')
export class PetPreviewWindow extends Component {
@property(Node)
starNode:Node; //星星节点
@property(Label)
levelLabel:Label; //等级
@property(sp.Skeleton)
spine:sp.Skeleton; //宠物Spine
info:PlayerPetOV;
onLoad(){
this.onUpdateInit();
//监听
app.event.on(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this)
}
protected onDestroy(): void {
app.event.off(PlayerPetEvent.UPDATE_INFO,this.onUpdateInfo,this)
}
//初始化
onUpdateInit(){
//隐藏
this.starNode.active = false;
this.levelLabel.node.active = false;
}
//刷新信息
onUpdateInfo(info:PlayerPetOV){
if(this.info && info.petId == this.info.petId){
this.onUpdateView(); //刷新页面
}
}
//刷新页面
onUpdateView(){
this.onUpdateInit();
//显示宠物
this.spine.skeletonData = app.battleRes.roleSpine[this.info.petTbId];
this.spine.setAnimation(0,UIPetAnim.std,true);
//等级
this.levelLabel.node.active = true;
this.levelLabel.string = `Lv ${this.info.petLevel}`;
//如果有星则显示星
if(this.info.petStar){
this.starNode.active = true;
this.starNode.getComponentInChildren(Label).string = `${this.info.petStar}`;
}
}
//绑定显示的宠物
bind(info:PlayerPetOV){
this.info = info;
this.onUpdateView();
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "f423768a-7790-4a2f-b005-a40110aba905",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -12,7 +12,14 @@ export class MainSreepsIcon extends JNScrollViewItem<GOnHookPet> {
icon:PetIconSelect; icon:PetIconSelect;
start(){ start(){
this.icon.setIcon(this.data.petTbId); this.icon.set({
petTbId: this.data.petTbId,
petId: 0,
petPlayerId: 0,
petLevel: 0,
petStar: 0,
petStarExp: 0
});
} }
} }

View File

@ -6,11 +6,12 @@ import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/compone
import { NodeEventType } from 'cc'; import { NodeEventType } from 'cc';
import { sp } from 'cc'; import { sp } from 'cc';
import { app } from '../../App'; import { app } from '../../App';
import { PlayerPetOV } from '../../consts/API'; import { API, PlayerPetOV } from '../../consts/API';
import { UIPetAnim } from '../../consts/GData'; import { UIPetAnim } from '../../consts/GData';
import { GUI } from '../UIConfig'; import { GUI } from '../UIConfig';
import PlayerTacticalData from '../../data/PlayerTacticalData'; import PlayerTacticalData from '../../data/PlayerTacticalData';
import { PetIconSelectScroll } from '../Consts/Pet/PetIconSelectScroll'; import { PetIconSelectScroll } from '../Consts/Pet/PetIconSelectScroll';
import { PetPreviewWindow } from '../Consts/Pet/info/PetPreviewWindow';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
//上阵页面 //上阵页面
@ -21,8 +22,8 @@ export class IntoBattleView extends JNLayerBase {
@property(JNScrollView) @property(JNScrollView)
views:JNScrollView; //宠物列表 views:JNScrollView; //宠物列表
@property(sp.Skeleton) @property(PetPreviewWindow)
spine:sp.Skeleton; //当前选中的宠物 petPreview:PetPreviewWindow; //宠物显示窗口
//宠物数据 //宠物数据
pets:PlayerPetOV[] = []; pets:PlayerPetOV[] = [];
@ -79,8 +80,7 @@ export class IntoBattleView extends JNLayerBase {
current.select.isSelect = true; current.select.isSelect = true;
//显示选中宠物 //显示选中宠物
this.spine.skeletonData = app.battleRes.roleSpine[this.pets[this.index].petTbId]; this.petPreview.bind(this.pets[this.index]);
this.spine.setAnimation(0,UIPetAnim.std,true);
} }
} }
@ -126,6 +126,17 @@ export class IntoBattleView extends JNLayerBase {
} }
//点击升级
async onClickUpLevel(){
if(this.index < 0){
app.layer.Open(GUI.Tips,{text:"请选择宠物."})
return;
}
if(await API.PetUpLevel(this.pets[this.index].petId))
app.layer.Open(GUI.Tips,{text:"升级成功!"})
}
} }

@ -1 +1 @@
Subproject commit 47865f8d0af09462f3cf8594ccde001802df8723 Subproject commit b1ff668cfa5f73ab924bf16904c77cac17817961

View File

@ -17,6 +17,7 @@ import com.google.gson.JsonObject;
public final class TbGRoleBaseAttribute extends AbstractBean { public final class TbGRoleBaseAttribute extends AbstractBean {
public TbGRoleBaseAttribute(JsonObject _buf) { public TbGRoleBaseAttribute(JsonObject _buf) {
id = _buf.get("id").getAsInt(); id = _buf.get("id").getAsInt();
Blood = _buf.get("Blood").getAsInt();
Attack = _buf.get("Attack").getAsInt(); Attack = _buf.get("Attack").getAsInt();
Defend = _buf.get("Defend").getAsInt(); Defend = _buf.get("Defend").getAsInt();
} }
@ -29,6 +30,10 @@ public final class TbGRoleBaseAttribute extends AbstractBean {
* 角色Id (0 则默认) * 角色Id (0 则默认)
*/ */
public final int id; public final int id;
/**
* 默认血量
*/
public final int Blood;
/** /**
* 默认攻击属性 * 默认攻击属性
*/ */
@ -47,6 +52,7 @@ public final class TbGRoleBaseAttribute extends AbstractBean {
public String toString() { public String toString() {
return "{ " return "{ "
+ "(format_field_name __code_style field.name):" + id + "," + "(format_field_name __code_style field.name):" + id + ","
+ "(format_field_name __code_style field.name):" + Blood + ","
+ "(format_field_name __code_style field.name):" + Attack + "," + "(format_field_name __code_style field.name):" + Attack + ","
+ "(format_field_name __code_style field.name):" + Defend + "," + "(format_field_name __code_style field.name):" + Defend + ","
+ "}"; + "}";

View File

@ -17,7 +17,7 @@ import com.google.gson.JsonObject;
public final class TbGRoleUpLevel extends AbstractBean { public final class TbGRoleUpLevel extends AbstractBean {
public TbGRoleUpLevel(JsonObject _buf) { public TbGRoleUpLevel(JsonObject _buf) {
grade = _buf.get("grade").getAsInt(); grade = _buf.get("grade").getAsInt();
{ com.google.gson.JsonArray _json0_ = _buf.get("materials").getAsJsonArray(); int __n0 = _json0_.size(); materials = new cfg.TbGEntity.Resource[__n0]; int __index0=0; for(JsonElement __e0 : _json0_) { cfg.TbGEntity.Resource __v0; __v0 = cfg.TbGEntity.Resource.deserialize(__e0.getAsJsonObject()); materials[__index0++] = __v0; } } { com.google.gson.JsonArray _json0_ = _buf.get("materials").getAsJsonArray(); int __n0 = _json0_.size(); materials = new cfg.TbGEntity.TResource[__n0]; int __index0=0; for(JsonElement __e0 : _json0_) { cfg.TbGEntity.TResource __v0; __v0 = cfg.TbGEntity.TResource.deserialize(__e0.getAsJsonObject()); materials[__index0++] = __v0; } }
} }
public static TbGRoleUpLevel deserialize(JsonObject _buf) { public static TbGRoleUpLevel deserialize(JsonObject _buf) {
@ -31,7 +31,7 @@ public final class TbGRoleUpLevel extends AbstractBean {
/** /**
* 消耗的材料 * 消耗的材料
*/ */
public final cfg.TbGEntity.Resource[] materials; public final cfg.TbGEntity.TResource[] materials;
public static final int __ID__ = -877225318; public static final int __ID__ = -877225318;

View File

@ -17,14 +17,14 @@ import com.google.gson.JsonObject;
/** /**
* 资源信息 * 资源信息
*/ */
public final class Resource extends AbstractBean { public final class TResource extends AbstractBean {
public Resource(JsonObject _buf) { public TResource(JsonObject _buf) {
id = _buf.get("id").getAsInt(); id = _buf.get("id").getAsInt();
value = _buf.get("value").getAsInt(); value = _buf.get("value").getAsInt();
} }
public static Resource deserialize(JsonObject _buf) { public static TResource deserialize(JsonObject _buf) {
return new cfg.TbGEntity.Resource(_buf); return new cfg.TbGEntity.TResource(_buf);
} }
/** /**
@ -36,7 +36,7 @@ public final class Resource extends AbstractBean {
*/ */
public final int value; public final int value;
public static final int __ID__ = -215001824; public static final int __ID__ = 125240784;
@Override @Override
public int getTypeId() { return __ID__; } public int getTypeId() { return __ID__; }

View File

@ -4,7 +4,10 @@ import cn.jisol.game.controller.argsresolver.PlayerMethodArgumentResolver;
import cn.jisol.game.controller.argsresolver.UserMethodArgumentResolver; import cn.jisol.game.controller.argsresolver.UserMethodArgumentResolver;
import cn.jisol.game.controller.game.GPlayerController; import cn.jisol.game.controller.game.GPlayerController;
import cn.jisol.game.interceptor.LoginInterceptor; import cn.jisol.game.interceptor.LoginInterceptor;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
@ -28,10 +31,22 @@ public class WebConfig implements WebMvcConfigurer {
registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/game/**"); registry.addInterceptor(new LoginInterceptor()).addPathPatterns("/game/**");
} }
/**
* 参数解析
* @param resolvers
*/
@Override @Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) { public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
WebMvcConfigurer.super.addArgumentResolvers(resolvers); WebMvcConfigurer.super.addArgumentResolvers(resolvers);
resolvers.add(new UserMethodArgumentResolver()); resolvers.add(new UserMethodArgumentResolver());
resolvers.add(new PlayerMethodArgumentResolver(this.playerController)); resolvers.add(new PlayerMethodArgumentResolver(this.playerController));
} }
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
return interceptor;
}
} }

View File

@ -1,6 +1,7 @@
package cn.jisol.game.controller.exception; package cn.jisol.game.controller.exception;
import cn.jisol.ngame.util.NewsContext; import cn.jisol.ngame.util.NewsContext;
import org.springframework.retry.RetryException;
import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
@ -17,6 +18,13 @@ public class HTTPExceptionHandler {
return NewsContext.onMessage("Token 失效",null,LOGIN_TOKEN); return NewsContext.onMessage("Token 失效",null,LOGIN_TOKEN);
} }
//并发异常
@ExceptionHandler(value = RetryException.class)
@ResponseBody
public NewsContext<String> retryExceptionHandler(RetryException e){
return NewsContext.onFail("服务器忙碌啦~ 一会再试试.");
}
//全局异常 //全局异常
@ExceptionHandler(value = Exception.class) @ExceptionHandler(value = Exception.class)
@ResponseBody @ResponseBody

View File

@ -51,7 +51,7 @@ public class GNoviceController {
return NewsContext.onFail("你已经有宠物了!"); return NewsContext.onFail("你已经有宠物了!");
}else{ }else{
//选择宠物 //选择宠物
if (playerPetService.save(PlayerPet.builder().petPlayerId(player.getPlayerId()).petTbId(petId).petGrade(0).build())){ if (playerPetService.save(PlayerPet.builder().petPlayerId(player.getPlayerId()).petTbId(petId).petLevel(0).build())){
return NewsContext.onSuccess("选择宠物成功"); return NewsContext.onSuccess("选择宠物成功");
}else{ }else{
return NewsContext.onSuccess("选择宠物失败"); return NewsContext.onSuccess("选择宠物失败");

View File

@ -1,10 +1,14 @@
package cn.jisol.game.controller.game; package cn.jisol.game.controller.game;
import cfg.TB.TbGRoleUpLevel;
import cfg.TbGEntity.TResource;
import cn.jisol.game.controller.argsresolver.CurrentPlayer; import cn.jisol.game.controller.argsresolver.CurrentPlayer;
import cn.jisol.game.data.TD; import cn.jisol.game.data.TD;
import cn.jisol.game.entity.game.Player; import cn.jisol.game.entity.game.Player;
import cn.jisol.game.entity.game.PlayerPet; import cn.jisol.game.entity.game.PlayerPet;
import cn.jisol.game.entity.game.Resource;
import cn.jisol.game.service.PlayerPetService; import cn.jisol.game.service.PlayerPetService;
import cn.jisol.game.service.ResourceService;
import cn.jisol.game.vo.news.NewsResource; import cn.jisol.game.vo.news.NewsResource;
import cn.jisol.game.vo.news.ov.ResourceUpdateOV; import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
import cn.jisol.game.vo.pet.PetUpStarOV; import cn.jisol.game.vo.pet.PetUpStarOV;
@ -15,6 +19,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -34,6 +40,8 @@ public class GPlayerPetController {
@Autowired @Autowired
PlayerPetService playerPetService; PlayerPetService playerPetService;
@Autowired
ResourceService resourceService;
//获取玩家宠物列表 //获取玩家宠物列表
@ApiImplicitParams({}) @ApiImplicitParams({})
@ -54,6 +62,7 @@ public class GPlayerPetController {
@ApiOperation(value = "提升宠物星") @ApiOperation(value = "提升宠物星")
@PostMapping("/up/star") @PostMapping("/up/star")
@Transactional @Transactional
@Retryable(value = RetryException.class)
public NewsResource<PlayerPet> onUpStar(@RequestBody PetUpStarOV info, @CurrentPlayer Player player){ public NewsResource<PlayerPet> onUpStar(@RequestBody PetUpStarOV info, @CurrentPlayer Player player){
//判断参数 //判断参数
@ -99,8 +108,8 @@ public class GPlayerPetController {
pet.setPetStar(pet.getPetStar() + 1); pet.setPetStar(pet.getPetStar() + 1);
} }
//保存宠物信息 //保存宠物信息 (保存失败则重试)
playerPetService.updateById(pet); if(!playerPetService.updateById(pet)) throw new RetryException("");
//删除被合成的宠物 //删除被合成的宠物
playerPetService.removeByIds(info.getPets()); playerPetService.removeByIds(info.getPets());
@ -122,15 +131,41 @@ public class GPlayerPetController {
@ApiImplicitParams({}) @ApiImplicitParams({})
@ApiOperation(value = "提升宠物等级") @ApiOperation(value = "提升宠物等级")
@PostMapping("/up/level/{petId}") @PostMapping("/up/level/{petId}")
@Transactional
@Retryable(value = RetryException.class)
public NewsResource<PlayerPet> onUpLevel(@PathVariable Integer petId, @CurrentPlayer Player player){ public NewsResource<PlayerPet> onUpLevel(@PathVariable Integer petId, @CurrentPlayer Player player){
//整理刷新数据
ArrayList<ResourceUpdateOV> resources = new ArrayList<>();
//获取需要升级的宠物 //获取需要升级的宠物
PlayerPet pet = playerPetService.getById(petId); PlayerPet pet = playerPetService.getById(petId);
if(Objects.isNull(pet) || !Objects.equals(pet.getPetPlayerId(), player.getPlayerId())){ if(Objects.isNull(pet) || !Objects.equals(pet.getPetPlayerId(), player.getPlayerId())){
return NewsResource.onFail("你未拥有这个宠物"); return NewsResource.onFail("你未拥有这个宠物");
} }
return NewsResource.onFail("升级成功"); TbGRoleUpLevel resource = TD.DATA.getTbGRoleUpLevel().get(pet.getPetLevel() + 1);
//扣除玩家材料
for (int i = 0; i < resource.materials.length; i++) {
TResource res = resource.materials[i];
Resource data = resourceService.addResourceValue(player.getPlayerId(), res.id, -((long) res.value));
if (Objects.isNull(data)){
return NewsResource.onFail("材料不够");
}else{
//刷新资源
resources.add(ResourceUpdateOV.onUpdate(data)); //刷新资源
}
}
//升级
pet.setPetLevel(pet.getPetLevel() + 1);
//保存
if(!playerPetService.updateById(pet)) throw new RetryException("");
resources.add(ResourceUpdateOV.onPet(ResourceUpdateOV.ResourceUpdateType.UPDATE,pet)); //刷新宠物
return NewsResource.onSuccess("升级成功",pet,resources.toArray(new ResourceUpdateOV[0]));
} }

View File

@ -100,7 +100,7 @@ public class GOnHookController {
if(Objects.nonNull(creeps.remove(creepId))){ if(Objects.nonNull(creeps.remove(creepId))){
//增加玩家金币 (默认添加100) //增加玩家金币 (默认添加100)
Resource res = resourceService.addResourceValue(player.getPlayerId(), ResourceId.Gold, 100L); Resource res = resourceService.addResourceValue(player.getPlayerId(), ResourceId.Gold.id, 100L);
return NewsResource.onSuccess( return NewsResource.onSuccess(
"卖出成功", "卖出成功",
true, true,
@ -135,7 +135,7 @@ public class GOnHookController {
} }
//捕捉 //捕捉
PlayerPet pet = PlayerPet.builder().petPlayerId(player.getPlayerId()).petTbId(onHookPet.getPetTbId()).petGrade(0).build(); PlayerPet pet = PlayerPet.builder().petPlayerId(player.getPlayerId()).petTbId(onHookPet.getPetTbId()).petLevel(0).build();
if(playerPetService.save(pet)){ if(playerPetService.save(pet)){
return NewsContext.onSuccess("捕捉成功",pet); return NewsContext.onSuccess("捕捉成功",pet);
}else{ }else{

View File

@ -3,6 +3,7 @@ package cn.jisol.game.entity.game;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -17,7 +18,9 @@ public class PlayerPet {
private Long petId; //宠物唯一Id private Long petId; //宠物唯一Id
private Long petPlayerId; //宠物的玩家Id private Long petPlayerId; //宠物的玩家Id
private Integer petTbId; //宠物配置表Id private Integer petTbId; //宠物配置表Id
private Integer petGrade; //宠物等级 private Integer petLevel; //宠物等级
private Integer petStar; //宠物星级 private Integer petStar; //宠物星级
private Integer petStarExp; //宠物星级经验 private Integer petStarExp; //宠物星级经验
@Version
private Integer version;
} }

View File

@ -3,6 +3,7 @@ package cn.jisol.game.entity.game;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -19,5 +20,7 @@ public class Resource {
private Long playerId; //玩家Id private Long playerId; //玩家Id
private int resourceTbId; //资源配置表Id private int resourceTbId; //资源配置表Id
private Long resourceValue; //资源数量 private Long resourceValue; //资源数量
@Version
private Integer version;
} }

View File

@ -8,10 +8,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
public interface ResourceService extends IService<Resource> { public interface ResourceService extends IService<Resource> {
//添加某个资源的数量 //添加某个资源的数量
public Resource addResourceValue(Long playerId, ResourceId type, Long value); public Resource addResourceValue(Long playerId, int type, Long value);
//初始化某个资源 //初始化某个资源
public Resource initResource(Long playerId, ResourceId type); public Resource initResource(Long playerId, int type);
public Resource initResource(Resource resource); public Resource initResource(Resource resource);
} }

View File

@ -7,6 +7,8 @@ import cn.jisol.game.mapper.ResourceMapper;
import cn.jisol.game.service.ResourceService; import cn.jisol.game.service.ResourceService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -22,15 +24,14 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
* @return * @return
*/ */
@Override @Override
@Transactional @Retryable(value = RetryException.class)
public Resource addResourceValue(Long playerId, ResourceId type, Long value) { public Resource addResourceValue(Long playerId, int type, Long value) {
//获取玩家资源 //获取玩家资源
Resource res = this.getOne( Resource res = this.getOne(
Wrappers.lambdaQuery(Resource.class) Wrappers.lambdaQuery(Resource.class)
.eq(Resource::getPlayerId, playerId) //玩家 .eq(Resource::getPlayerId, playerId) //玩家
.eq(Resource::getResourceTbId, type.id) //资源 .eq(Resource::getResourceTbId, type) //资源
.last(" for update") //加锁
); );
//如果没有资源则默认给一个0的资源 //如果没有资源则默认给一个0的资源
@ -42,16 +43,20 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
//添加资源 //添加资源
res.setResourceValue(res.getResourceValue() + value); res.setResourceValue(res.getResourceValue() + value);
//保存资源 if(res.getResourceValue() <= 0){
this.saveOrUpdate(res); return null;
}
//保存资源 (保存失败重试)
if (!this.saveOrUpdate(res)) throw new RetryException("");
return res; return res;
} }
//初始化某个资源 //初始化某个资源
@Override @Override
public Resource initResource(Long playerId, ResourceId type) { public Resource initResource(Long playerId, int type) {
Resource resource = Resource.builder().playerId(playerId).resourceTbId(type.id).resourceValue(0L).build(); Resource resource = Resource.builder().playerId(playerId).resourceTbId(type).resourceValue(0L).build();
this.initResource(resource); this.initResource(resource);
return resource; return resource;
} }

View File

@ -8,5 +8,10 @@
"id": 110002, "id": 110002,
"name": "防御", "name": "防御",
"sign": "Defend" "sign": "Defend"
},
{
"id": 110003,
"name": "血量",
"sign": "Blood"
} }
] ]

View File

@ -1,6 +1,7 @@
[ [
{ {
"id": 0, "id": 0,
"Blood": 100,
"Attack": 10, "Attack": 10,
"Defend": 5 "Defend": 5
} }