diff --git a/DataTables/Datas/宠物系统/宠物装备/锻造装备等级.xlsx b/DataTables/Datas/宠物系统/宠物装备/锻造装备等级.xlsx index db4a9f56..29cf32fb 100644 Binary files a/DataTables/Datas/宠物系统/宠物装备/锻造装备等级.xlsx and b/DataTables/Datas/宠物系统/宠物装备/锻造装备等级.xlsx differ diff --git a/DataTables/Datas/常用/资源表.xlsx b/DataTables/Datas/常用/资源表.xlsx index 061efbd3..746e960a 100644 Binary files a/DataTables/Datas/常用/资源表.xlsx and b/DataTables/Datas/常用/资源表.xlsx differ diff --git a/JisolGameCocos/assets/resources/config/json/tbgresource.json b/JisolGameCocos/assets/resources/config/json/tbgresource.json index fb678f6b..1c53050b 100644 --- a/JisolGameCocos/assets/resources/config/json/tbgresource.json +++ b/JisolGameCocos/assets/resources/config/json/tbgresource.json @@ -2,11 +2,19 @@ { "id": 90001, "name": "金币", - "tig": "金币 (目前叫做金币 名称还没有定) 游戏的基础资源 用于升级宠物" + "tig": "金币 (目前叫做金币 名称还没有定) 游戏的基础资源 用于升级宠物", + "args": "" }, { "id": 90002, "name": "锻造石", - "tig": "锻造石 可以锻造装备的石头" + "tig": "锻造石 可以锻造装备的石头", + "args": "" + }, + { + "id": 90003, + "name": "通用加速卷", + "tig": "加速卷 用来加速一切需要时间的东西 减少冷却:60s", + "args": "60" } ] \ No newline at end of file diff --git a/JisolGameCocos/assets/resources/prefab/ui/主页/野怪/野怪列表ICON.prefab b/JisolGameCocos/assets/resources/prefab/ui/主页/野怪/野怪列表ICON.prefab index 92b95baa..f9317ca2 100644 --- a/JisolGameCocos/assets/resources/prefab/ui/主页/野怪/野怪列表ICON.prefab +++ b/JisolGameCocos/assets/resources/prefab/ui/主页/野怪/野怪列表ICON.prefab @@ -80,7 +80,7 @@ "__id__": 2 }, "asset": { - "__uuid__": "e59969f5-99a0-4259-ba3e-71093a65cfd8", + "__uuid__": "3c0c1512-6b85-4399-af17-6ae6e06501a9", "__expectedType__": "cc.Prefab" }, "fileId": "02c3tqHwFAbp7zhkA22zq9", @@ -95,7 +95,7 @@ }, { "__type__": "cc.PrefabInstance", - "fileId": "92tNwwtwJEj5SOclnRjbw5", + "fileId": "1asoyJ7qBC44uU32WZ3CHG", "prefabRootNode": { "__id__": 1 }, @@ -125,7 +125,7 @@ "propertyPath": [ "_name" ], - "value": "选择宠物ICON" + "value": "选择配置表宠物ICON" }, { "__type__": "cc.TargetInfo", @@ -200,7 +200,7 @@ { "__type__": "cc.TargetInfo", "localID": [ - "a8v6Wyt6FBsbms2ouS3gEa" + "a8JEoJ8qZF7LgdYzDLu2Xj" ] }, { @@ -290,7 +290,7 @@ { "__type__": "cc.TargetInfo", "localID": [ - "d4qo68UJJHyonQhZ4UFX08" + "21ztShzLlCzbg4YxM6PqNE" ] } ] \ No newline at end of file diff --git a/JisolGameCocos/assets/resources/prefab/ui/主页/锻造台/锻造台.prefab b/JisolGameCocos/assets/resources/prefab/ui/主页/锻造台/锻造台.prefab index f203b168..15ace0e1 100644 --- a/JisolGameCocos/assets/resources/prefab/ui/主页/锻造台/锻造台.prefab +++ b/JisolGameCocos/assets/resources/prefab/ui/主页/锻造台/锻造台.prefab @@ -28,23 +28,23 @@ "__id__": 109 }, { - "__id__": 152 + "__id__": 153 } ], "_active": true, "_components": [ { - "__id__": 169 + "__id__": 170 }, { - "__id__": 171 + "__id__": 172 }, { - "__id__": 173 + "__id__": 174 } ], "_prefab": { - "__id__": 175 + "__id__": 176 }, "_lpos": { "__type__": "cc.Vec3", @@ -1700,17 +1700,17 @@ "_active": true, "_components": [ { - "__id__": 144 + "__id__": 145 }, { - "__id__": 146 + "__id__": 147 }, { - "__id__": 148 + "__id__": 149 } ], "_prefab": { - "__id__": 151 + "__id__": 152 }, "_lpos": { "__type__": "cc.Vec3", @@ -2096,11 +2096,11 @@ "__id__": 139 }, { - "__id__": 141 + "__id__": 142 } ], "_prefab": { - "__id__": 143 + "__id__": 144 }, "_lpos": { "__type__": "cc.Vec3", @@ -2292,6 +2292,8 @@ "__id__": 0 }, "fileId": "f7l1O1NSJIyqaTx4ZhrX+I", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -2379,7 +2381,11 @@ "__prefab": { "__id__": 140 }, - "clickEvents": [], + "clickEvents": [ + { + "__id__": 141 + } + ], "_interactable": true, "_transition": 3, "_normalColor": { @@ -2437,6 +2443,16 @@ "__type__": "cc.CompPrefabInfo", "fileId": "b7lvydUiJKCLmbPfX3P0H1" }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 1 + }, + "component": "", + "_componentId": "9b2f1EJsLxM/JeOdoryoJsl", + "handler": "onClickUpForgingBench", + "customEventData": "" + }, { "__type__": "cc.BlockInputEvents", "_name": "", @@ -2447,7 +2463,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 142 + "__id__": 143 }, "_id": "" }, @@ -2478,7 +2494,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 145 + "__id__": 146 }, "_contentSize": { "__type__": "cc.Size", @@ -2506,7 +2522,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 147 + "__id__": 148 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2551,11 +2567,11 @@ }, "_enabled": true, "__prefab": { - "__id__": 149 + "__id__": 150 }, "clickEvents": [ { - "__id__": 150 + "__id__": 151 } ], "_interactable": true, @@ -2634,6 +2650,8 @@ "__id__": 0 }, "fileId": "51PZvcuWZIko9Ta8D+mTRP", + "instance": null, + "targetOverrides": null, "nestedPrefabInstanceRoots": null }, { @@ -2646,23 +2664,23 @@ }, "_children": [ { - "__id__": 153 + "__id__": 154 } ], "_active": true, "_components": [ { - "__id__": 161 + "__id__": 162 }, { - "__id__": 163 + "__id__": 164 }, { - "__id__": 165 + "__id__": 166 } ], "_prefab": { - "__id__": 168 + "__id__": 169 }, "_lpos": { "__type__": "cc.Vec3", @@ -2699,23 +2717,23 @@ "_objFlags": 512, "__editorExtras__": {}, "_parent": { - "__id__": 152 + "__id__": 153 }, "_children": [], "_active": true, "_components": [ { - "__id__": 154 + "__id__": 155 }, { - "__id__": 156 + "__id__": 157 }, { - "__id__": 158 + "__id__": 159 } ], "_prefab": { - "__id__": 160 + "__id__": 161 }, "_lpos": { "__type__": "cc.Vec3", @@ -2752,11 +2770,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 153 + "__id__": 154 }, "_enabled": true, "__prefab": { - "__id__": 155 + "__id__": 156 }, "_contentSize": { "__type__": "cc.Size", @@ -2780,11 +2798,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 153 + "__id__": 154 }, "_enabled": true, "__prefab": { - "__id__": 157 + "__id__": 158 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2825,11 +2843,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 153 + "__id__": 154 }, "_enabled": true, "__prefab": { - "__id__": 159 + "__id__": 160 }, "_color": { "__type__": "cc.Color", @@ -2864,11 +2882,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 152 + "__id__": 153 }, "_enabled": true, "__prefab": { - "__id__": 162 + "__id__": 163 }, "_contentSize": { "__type__": "cc.Size", @@ -2892,11 +2910,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 152 + "__id__": 153 }, "_enabled": true, "__prefab": { - "__id__": 164 + "__id__": 165 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2937,15 +2955,15 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 152 + "__id__": 153 }, "_enabled": true, "__prefab": { - "__id__": 166 + "__id__": 167 }, "clickEvents": [ { - "__id__": 167 + "__id__": 168 } ], "_interactable": true, @@ -2997,7 +3015,7 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 152 + "__id__": 153 }, "_id": "" }, @@ -3036,7 +3054,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 170 + "__id__": 171 }, "_contentSize": { "__type__": "cc.Size", @@ -3064,7 +3082,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 172 + "__id__": 173 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -3109,7 +3127,10 @@ }, "_enabled": true, "__prefab": { - "__id__": 174 + "__id__": 175 + }, + "forgingLevel": { + "__id__": 121 }, "petView": null, "equips": { @@ -3133,7 +3154,7 @@ "instance": null, "targetOverrides": [ { - "__id__": 176 + "__id__": 177 } ], "nestedPrefabInstanceRoots": [ @@ -3175,7 +3196,7 @@ { "__type__": "cc.TargetOverrideInfo", "source": { - "__id__": 173 + "__id__": 174 }, "sourceInfo": null, "propertyPath": [ @@ -3185,7 +3206,7 @@ "__id__": 89 }, "targetInfo": { - "__id__": 177 + "__id__": 178 } }, { diff --git a/JisolGameCocos/assets/resources/prefab/ui/宠物装备/弹出锻造装备页面.prefab b/JisolGameCocos/assets/resources/prefab/ui/宠物装备/弹出锻造装备页面.prefab index 23ae3996..354f00b1 100644 --- a/JisolGameCocos/assets/resources/prefab/ui/宠物装备/弹出锻造装备页面.prefab +++ b/JisolGameCocos/assets/resources/prefab/ui/宠物装备/弹出锻造装备页面.prefab @@ -197,7 +197,7 @@ "__id__": 4 }, "asset": { - "__uuid__": "910454d9-bf71-4438-b8a4-be60494c4e51", + "__uuid__": "1e601f1b-ff4a-43e0-b0fe-9513cd3d22d3", "__expectedType__": "cc.Prefab" }, "fileId": "02c3tqHwFAbp7zhkA22zq9", @@ -208,7 +208,7 @@ }, { "__type__": "cc.PrefabInstance", - "fileId": "5c30X8apVG4YDQxUZ8YWHN", + "fileId": "fd//KmV/NL2Ky4HVID9Lnz", "prefabRootNode": { "__id__": 1 }, @@ -238,7 +238,7 @@ "propertyPath": [ "_name" ], - "value": "配置表装备ICON" + "value": "宠物装备ICON" }, { "__type__": "cc.TargetInfo", @@ -991,7 +991,7 @@ { "__type__": "cc.TargetInfo", "localID": [ - "44EB+AGx5L2JYyIDyepY5j" + "f1s983e4pH04ok2jfdVZwa" ] } ] \ No newline at end of file diff --git a/JisolGameCocos/assets/resources/prefab/ui/常用预制体/宠物/icon/宠物ICON.prefab b/JisolGameCocos/assets/resources/prefab/ui/常用预制体/宠物/icon/宠物ICON.prefab index 6c3bd5ae..42341dde 100644 --- a/JisolGameCocos/assets/resources/prefab/ui/常用预制体/宠物/icon/宠物ICON.prefab +++ b/JisolGameCocos/assets/resources/prefab/ui/常用预制体/宠物/icon/宠物ICON.prefab @@ -26,19 +26,22 @@ }, { "__id__": 22 + }, + { + "__id__": 36 } ], "_active": true, "_components": [ { - "__id__": 36 + "__id__": 44 }, { - "__id__": 38 + "__id__": 46 } ], "_prefab": { - "__id__": 40 + "__id__": 48 }, "_lpos": { "__type__": "cc.Vec3", @@ -810,6 +813,171 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": null }, + { + "__type__": "cc.Node", + "_name": "等级", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 37 + }, + { + "__id__": 39 + }, + { + "__id__": 41 + } + ], + "_prefab": { + "__id__": 43 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -33.647, + "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__": 36 + }, + "_enabled": true, + "__prefab": { + "__id__": 38 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 66.265625, + "height": 54.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "4c5h6T0flJt5JRab2+oYMO" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 36 + }, + "_enabled": true, + "__prefab": { + "__id__": 40 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "Lv 100", + "_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": "62+4SzXqFA8qi5LTvf4hNx" + }, + { + "__type__": "cc.LabelOutline", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 36 + }, + "_enabled": true, + "__prefab": { + "__id__": 42 + }, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_width": 2, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "76GD7mt+pBzIkY1rSwIkaJ" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "21MjGY6ndKiZ3M6O5l/pbL", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, { "__type__": "cc.UITransform", "_name": "", @@ -820,7 +988,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 37 + "__id__": 45 }, "_contentSize": { "__type__": "cc.Size", @@ -848,7 +1016,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 39 + "__id__": 47 }, "spine": { "__id__": 12 @@ -856,6 +1024,9 @@ "starNode": { "__id__": 22 }, + "levelLabel": { + "__id__": 39 + }, "_id": "" }, { diff --git a/JisolGameCocos/assets/resources/prefab/ui/常用预制体/宠物/icon/选择宠物展示ICON.prefab b/JisolGameCocos/assets/resources/prefab/ui/常用预制体/宠物/icon/选择宠物展示ICON.prefab index 1f344ae6..b50720ba 100644 --- a/JisolGameCocos/assets/resources/prefab/ui/常用预制体/宠物/icon/选择宠物展示ICON.prefab +++ b/JisolGameCocos/assets/resources/prefab/ui/常用预制体/宠物/icon/选择宠物展示ICON.prefab @@ -147,7 +147,7 @@ "_lpos": { "__type__": "cc.Vec3", "x": 0, - "y": 0, + "y": 3.959, "z": 0 }, "_lrot": { diff --git a/JisolGameCocos/assets/resources/prefab/ui/常用预制体/宠物装备/icon/宠物装备ICON.prefab b/JisolGameCocos/assets/resources/prefab/ui/常用预制体/宠物装备/icon/宠物装备ICON.prefab index 4f4c70cb..911fb2e1 100644 --- a/JisolGameCocos/assets/resources/prefab/ui/常用预制体/宠物装备/icon/宠物装备ICON.prefab +++ b/JisolGameCocos/assets/resources/prefab/ui/常用预制体/宠物装备/icon/宠物装备ICON.prefab @@ -26,19 +26,22 @@ }, { "__id__": 14 + }, + { + "__id__": 20 } ], "_active": true, "_components": [ { - "__id__": 20 + "__id__": 28 }, { - "__id__": 22 + "__id__": 30 } ], "_prefab": { - "__id__": 24 + "__id__": 32 }, "_lpos": { "__type__": "cc.Vec3", @@ -477,6 +480,171 @@ "targetOverrides": null, "nestedPrefabInstanceRoots": null }, + { + "__type__": "cc.Node", + "_name": "等级", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": false, + "_components": [ + { + "__id__": 21 + }, + { + "__id__": 23 + }, + { + "__id__": 25 + } + ], + "_prefab": { + "__id__": 27 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -33.647, + "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__": 20 + }, + "_enabled": true, + "__prefab": { + "__id__": 22 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 66.265625, + "height": 54.4 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "4bace/ZDtOorp6ZePB5c2X" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 20 + }, + "_enabled": true, + "__prefab": { + "__id__": 24 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "Lv 100", + "_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": "036Fc0futJwZgdG7Vjmndh" + }, + { + "__type__": "cc.LabelOutline", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 20 + }, + "_enabled": true, + "__prefab": { + "__id__": 26 + }, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_width": 2, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "5369cDfnpIk6gTIIjN8KLs" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "a19X+3KABCAomo1Zpip2UG", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, { "__type__": "cc.UITransform", "_name": "", @@ -487,7 +655,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 21 + "__id__": 29 }, "_contentSize": { "__type__": "cc.Size", @@ -515,7 +683,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 23 + "__id__": 31 }, "sprite": { "__id__": 11 @@ -526,6 +694,9 @@ "notEquip": { "__id__": 14 }, + "levelLabel": { + "__id__": 23 + }, "_id": "" }, { diff --git a/JisolGameCocos/assets/resources/prefab/ui/常用预制体/阵法/阵法节点.prefab b/JisolGameCocos/assets/resources/prefab/ui/常用预制体/阵法/阵法节点.prefab index ebb1c1aa..7ced95f5 100644 --- a/JisolGameCocos/assets/resources/prefab/ui/常用预制体/阵法/阵法节点.prefab +++ b/JisolGameCocos/assets/resources/prefab/ui/常用预制体/阵法/阵法节点.prefab @@ -194,7 +194,7 @@ "_contentSize": { "__type__": "cc.Size", "width": 64.3984375, - "height": 69 + "height": 132 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -235,7 +235,7 @@ "_actualFontSize": 100, "_fontSize": 100, "_fontFamily": "Arial", - "_lineHeight": 50, + "_lineHeight": 100, "_overflow": 0, "_enableWrapText": true, "_font": null, diff --git a/JisolGameCocos/assets/resources/prefab/ui/阵法/阵法选择页面.prefab b/JisolGameCocos/assets/resources/prefab/ui/阵法/阵法选择页面.prefab index 0c975b30..7c8274ce 100644 --- a/JisolGameCocos/assets/resources/prefab/ui/阵法/阵法选择页面.prefab +++ b/JisolGameCocos/assets/resources/prefab/ui/阵法/阵法选择页面.prefab @@ -706,7 +706,7 @@ "__id__": 30 } ], - "_active": true, + "_active": false, "_components": [ { "__id__": 38 diff --git a/JisolGameCocos/assets/script/App.ts b/JisolGameCocos/assets/script/App.ts index 8f9a4044..0d0af841 100644 --- a/JisolGameCocos/assets/script/App.ts +++ b/JisolGameCocos/assets/script/App.ts @@ -30,10 +30,10 @@ import { Component } from "cc"; // let APIPath = `http://localhost:8080` // let WsPath = `ws://localhost:8080/websocket` -let APIPath = `http://192.168.1.23:8080` -let WsPath = `ws://192.168.1.23:8080/websocket` -// let APIPath = `http://192.168.0.119:8080` -// let WsPath = `ws://192.168.0.119:8080/websocket` +// let APIPath = `http://192.168.1.23:8080` +// let WsPath = `ws://192.168.1.23:8080/websocket` +let APIPath = `http://192.168.0.119:8080` +let WsPath = `ws://192.168.0.119:8080/websocket` // let APIPath = `https://api.pet.jisol.cn` // let WsPath = `wss://api.pet.jisol.cn/websocket` diff --git a/JisolGameCocos/assets/script/config/data/schema.ts b/JisolGameCocos/assets/script/config/data/schema.ts index d18844f9..dbce29d1 100644 --- a/JisolGameCocos/assets/script/config/data/schema.ts +++ b/JisolGameCocos/assets/script/config/data/schema.ts @@ -286,6 +286,8 @@ export class TbGResource { this.name = _json_.name if (_json_.tig === undefined) { throw new Error() } this.tig = _json_.tig + if (_json_.args === undefined) { throw new Error() } + this.args = _json_.args } /** @@ -300,6 +302,10 @@ export class TbGResource { * 描述 */ readonly tig: string + /** + * 额外参数 + */ + readonly args: string resolve(tables:Tables) { diff --git a/JisolGameCocos/assets/script/consts/API.ts b/JisolGameCocos/assets/script/consts/API.ts index dfb0dc84..2a1d2ebe 100644 --- a/JisolGameCocos/assets/script/consts/API.ts +++ b/JisolGameCocos/assets/script/consts/API.ts @@ -102,6 +102,7 @@ export interface ModeOnHookRankingOV{ mapId:number; //地图Id } + //宠物装备 export interface PetEquip{ equipId:number; //装备唯一Id @@ -118,13 +119,23 @@ export interface PetEquip{ //宠物锻造台 export interface EquipForgingBench{ - forgingId:number; //锻造台Id - playerId:number; //锻造台所属的玩家Id - forgingExp:number; //锻造等级经验 - forgingQuality:number; //锻造品质等级 - forgingPetId:number; //当前占用宠物Id + forgingId:number; //锻造台Id + playerId:number; //锻造台所属的玩家Id + forgingExp:number; //锻造等级经验 + forgingQuality:number; //锻造品质等级 + forgingPetId:number; //当前占用宠物Id + currentForgingQuality:number; //当前锻造等级经验 + forgingUpTimeExcess: number; //升级剩余时间 + forgingPetLevels:{[key:string]:number} //宠物等级 } +//宠物锻造OV +export interface PetEquipForgingOV{ + info:EquipForgingBench; + equip:PetEquip; +} + + export const API = { /********** debugger *****************/ @@ -158,10 +169,12 @@ export const API = { /********** 宠物装备系统接口 ****************/ PetEquipAll: async () => RData(await app.api.get(`/game/equip/all`),false) as PetEquip[], //获取全部装备 - PetEquipForging: async () => RData(await app.api.get(`/game/equip/forging`),true) as PetEquip, //锻造装备 - PetEquipForgingInfo: async () => RData(await app.api.get(`/game/equip/forging/info`),true) as EquipForgingBench, //锻造台 + PetEquipForging: async () => RData(await app.api.get(`/game/equip/forging`),true) as PetEquipForgingOV, //锻造装备 + PetEquipForgingInfo: async () => RData(await app.api.get(`/game/equip/forging/info`),false) as EquipForgingBench, //锻造台 PetEquipForgingPetId: async (petId:number) => RData(await app.api.post(`/game/equip/forging/petId/${petId}`),true) as EquipForgingBench, //设置锻造宠 PetEquipWear: async (petId:number,equipId:number) => RData(await app.api.post(`/game/equip/wear/${petId}/${equipId}`),true) as PetEquip, //穿戴装备 + PetEquipForgingUp: async () => RData(await app.api.post(`/game/equip/forging/up`),true) as EquipForgingBench, //升级锻造台 + PetEquipUseSpeed: async (resType:number) => RData(await app.api.post(`/game/equip/use/speed/${resType}`),true) as EquipForgingBench, //加速锻造台升级 } diff --git a/JisolGameCocos/assets/script/data/PetEquipData.ts b/JisolGameCocos/assets/script/data/PetEquipData.ts index f6e052e6..9cc860be 100644 --- a/JisolGameCocos/assets/script/data/PetEquipData.ts +++ b/JisolGameCocos/assets/script/data/PetEquipData.ts @@ -1,4 +1,5 @@ -import { app } from "../App"; +import TimeUtil from "../../../extensions/ngame/assets/ngame/util/TimeUtil"; +import { TD, app } from "../App"; import { API, EquipForgingBench, PetEquip } from "../consts/API"; import { GUI } from "../ui/UIConfig"; import BaseData from "./BaseData"; @@ -19,6 +20,14 @@ export default class PetEquipData extends BaseData{ //锻造台 info:EquipForgingBench; + //锻造升级结束时间 + forgingBenchUpEnd:number; + //获取升级剩余时间 + get forgingUpTimeExcess(){ + if(!this.forgingBenchUpEnd) return 0; + return TimeUtil.remainder(this.forgingBenchUpEnd) + } + //锻造台是否有宠物 get isForgingBenchPet(){ return !!PlayerPetData.getIns().petIdQueryPetInfo(this.info.forgingPetId); @@ -26,18 +35,23 @@ export default class PetEquipData extends BaseData{ async onInit() { this.equips = await API.PetEquipAll(); - this.info = await API.PetEquipForgingInfo(); + this.onUpdateInfo(await API.PetEquipForgingInfo()) } //更新锻造数据 onUpdateInfo(info:EquipForgingBench){ + if(!info) return; this.info = info; + this.forgingBenchUpEnd = Date.now() + this.info.forgingUpTimeExcess; + console.log("this.forgingBenchUpEnd",this.forgingBenchUpEnd); app.event.emit(PetEquipDataEnum.UPDATE_FORGING_INFO); } //锻造 async forging(){ - return this.addEquip(await API.PetEquipForging()); + let info = await API.PetEquipForging(); + this.onUpdateInfo(info.info); + return this.addEquip(info.equip); } //添加装备 @@ -79,5 +93,22 @@ export default class PetEquipData extends BaseData{ return this.equips.filter(equip => (equip.equipPetId == petId && equip.equipPosition == position))[0]; } + //升级锻造台 + async upForgingBench(){ + this.onUpdateInfo(await API.PetEquipForgingUp()); + } + + //加速升级锻造台 + async useSpeedUpForgingBench(resType: number){ + this.onUpdateInfo(await API.PetEquipUseSpeed(resType)); + } + + //获取指定宠物等级 + getForgingBenchPetLevel(petId:number = this.info.forgingPetId){ + let exp = this.info.forgingPetLevels[`${petId}`] || 0; + let list = TD.TbGRoleEquipLevel.getDataList().filter(info => info.exp <= exp); + return list[list.length - 1].id; + } + } \ No newline at end of file diff --git a/JisolGameCocos/assets/script/data/ResourceData.ts b/JisolGameCocos/assets/script/data/ResourceData.ts index 7a48a85d..d80c8098 100644 --- a/JisolGameCocos/assets/script/data/ResourceData.ts +++ b/JisolGameCocos/assets/script/data/ResourceData.ts @@ -8,7 +8,9 @@ export enum ResourceEvent{ //资源类型 export enum ResourceType{ - Gold = 90001, //金币 + Gold = 90001, //金币 + ForgedStones = 90002, //锻造石 + SpeedUp = 90003, //加速卷 } //资源刷新类型 diff --git a/JisolGameCocos/assets/script/ui/Consts/Pet/PetIcon.ts b/JisolGameCocos/assets/script/ui/Consts/Pet/PetIcon.ts index 971d017e..1eceeb5e 100644 --- a/JisolGameCocos/assets/script/ui/Consts/Pet/PetIcon.ts +++ b/JisolGameCocos/assets/script/ui/Consts/Pet/PetIcon.ts @@ -6,6 +6,7 @@ import { v3 } from 'cc'; import { PlayerPetOV } from '../../../consts/API'; import { Label } from 'cc'; import { PlayerPetEvent } from '../../../data/PlayerPetData'; +import PetEquipData from '../../../data/PetEquipData'; const { ccclass, property } = _decorator; @ccclass('PetIcon') @@ -17,6 +18,10 @@ export class PetIcon extends Component { @property(Node) starNode:Node; //星星 + @property(Label) + levelLabel:Label; //等级 + + info:PlayerPetOV; onLoad(){ @@ -53,6 +58,9 @@ export class PetIcon extends Component { this.starNode.active = true; this.starNode.getComponentInChildren(Label).string = `${this.info.petStar}`; } + + //设置宠物等级 + this.levelLabel.string = `Lv ${PetEquipData.getIns().getForgingBenchPetLevel(this.info.petId)}` } diff --git a/JisolGameCocos/assets/script/ui/Consts/PetEquip/icon/PetEquipIcon.ts b/JisolGameCocos/assets/script/ui/Consts/PetEquip/icon/PetEquipIcon.ts index 5754b642..362575aa 100644 --- a/JisolGameCocos/assets/script/ui/Consts/PetEquip/icon/PetEquipIcon.ts +++ b/JisolGameCocos/assets/script/ui/Consts/PetEquip/icon/PetEquipIcon.ts @@ -3,6 +3,7 @@ import { PetEquip } from '../../../../consts/API'; import { Sprite } from 'cc'; import TbResource, { IconTypeEnum } from '../../../../tools/TbResource'; import { TD } from '../../../../App'; +import { Label } from 'cc'; const { ccclass, property } = _decorator; @ccclass('PetEquipIcon') @@ -15,6 +16,9 @@ export class PetEquipIcon extends Component { @property(Node) notEquip:Node; + @property(Label) + levelLabel:Label; //等级 + info:PetEquip; onLoad(){ @@ -24,6 +28,7 @@ export class PetEquipIcon extends Component { //刷新页面 onUpdateView(){ + this.levelLabel.node.active = false; this.notEquip.active = true; if(!this.info) return; @@ -32,6 +37,9 @@ export class PetEquipIcon extends Component { let config = TD.TbGRoleEquip.get(this.info.equipCfgId); TbResource.loadSpriteIcon(IconTypeEnum.宠物装备,config.icon,this.sprite,this); TbResource.loadSpriteIcon(IconTypeEnum.品质,config.quality,this.quality,this); + + this.levelLabel.node.active = true; + this.levelLabel.string = `Lv ${this.info.equipLevel}`; } diff --git a/JisolGameCocos/assets/script/ui/Home/ForgingBench/MainForgingBench.ts b/JisolGameCocos/assets/script/ui/Home/ForgingBench/MainForgingBench.ts index 9d956b22..1724e85a 100644 --- a/JisolGameCocos/assets/script/ui/Home/ForgingBench/MainForgingBench.ts +++ b/JisolGameCocos/assets/script/ui/Home/ForgingBench/MainForgingBench.ts @@ -6,12 +6,21 @@ import { API, PlayerPetOV } from '../../../consts/API'; import { PetIconSelectShow } from '../../Consts/Pet/PetIconSelectShow'; import PlayerPetData from '../../../data/PlayerPetData'; import { PetEquipIcon } from '../../Consts/PetEquip/icon/PetEquipIcon'; +import { Label } from 'cc'; +import TimeUtil from '../../../../../extensions/ngame/assets/ngame/util/TimeUtil'; +import { ResourceType } from '../../../data/ResourceData'; +import JComponent from '../../../../../extensions/ngame/assets/ngame/util/components/JComponent'; const { ccclass, property } = _decorator; //锻造台 @ccclass('MainForgingBench') -export class MainForgingBench extends Component { +export class MainForgingBench extends JComponent { + + + //锻造等级显示 + @property(Label) + forgingLevel:Label; //锻造宠 @property(PetIconSelectShow) @@ -37,6 +46,14 @@ export class MainForgingBench extends Component { app.event.off(PetEquipDataEnum.UPDATE_EQUIP,this.onUpdateEquip,this); } + updates(){ + if(PetEquipData.getIns().forgingUpTimeExcess){ + this.forgingLevel.string = `(锻造等级: ${PetEquipData.getIns().info.currentForgingQuality} ) ${TimeUtil.remainderString(PetEquipData.getIns().forgingBenchUpEnd)}`; + }else{ + this.forgingLevel.string = `(锻造等级: ${PetEquipData.getIns().info.currentForgingQuality} )`; + } + } + onUpdateView(){ this.onUpdateForging(); this.onUpdateEquip(); @@ -77,6 +94,14 @@ export class MainForgingBench extends Component { } + //点击升级锻造台 + async onClickUpForgingBench(){ + if(PetEquipData.getIns().forgingUpTimeExcess) + await PetEquipData.getIns().useSpeedUpForgingBench(ResourceType.SpeedUp); + else + await PetEquipData.getIns().upForgingBench(); + } + } diff --git a/JisolGameCocos/assets/script/ui/Home/Sreeps/MainSreepsIcon.ts b/JisolGameCocos/assets/script/ui/Home/Sreeps/MainSreepsIcon.ts index 07236e9a..beff0eee 100644 --- a/JisolGameCocos/assets/script/ui/Home/Sreeps/MainSreepsIcon.ts +++ b/JisolGameCocos/assets/script/ui/Home/Sreeps/MainSreepsIcon.ts @@ -3,23 +3,18 @@ import JNScrollViewItem from '../../../../../extensions/ngame/assets/ngame/util/ import { GOnHookPet } from '../../../../../extensions/ngame/assets/ngame/message/proto'; import { PetIcon } from '../../Consts/Pet/PetIcon'; import { PetIconSelect } from '../../Consts/Pet/PetIconSelect'; +import { TablePetIconSelect } from '../../Consts/Pet/table/TablePetIconSelect'; +import { TD } from '../../../App'; const { ccclass, property } = _decorator; @ccclass('MainSreepsIcon') export class MainSreepsIcon extends JNScrollViewItem { - @property(PetIconSelect) - icon:PetIconSelect; + @property(TablePetIconSelect) + icon:TablePetIconSelect; start(){ - this.icon.set({ - petTbId: this.data.petTbId, - petId: 0, - petPlayerId: 0, - petLevel: 0, - petStar: 0, - petStarExp: 0 - }); + this.icon.set(TD.TbGRole.get(this.data.petTbId)); } } diff --git a/JisolGameCocos/assets/script/ui/PetEquip/PetEquipForgingPopupView.ts b/JisolGameCocos/assets/script/ui/PetEquip/PetEquipForgingPopupView.ts index 159309dd..c755d6af 100644 --- a/JisolGameCocos/assets/script/ui/PetEquip/PetEquipForgingPopupView.ts +++ b/JisolGameCocos/assets/script/ui/PetEquip/PetEquipForgingPopupView.ts @@ -9,6 +9,7 @@ import { TB } from '../../config/data/schema'; import { app, TD } from '../../App'; import { TablePetEquipIcon } from '../Consts/PetEquip/table/TablePetEquipIcon'; import PetEquipData from '../../data/PetEquipData'; +import { PetEquipIcon } from '../Consts/PetEquip/icon/PetEquipIcon'; const { ccclass, property } = _decorator; //弹出锻造装备页面 @@ -16,8 +17,8 @@ const { ccclass, property } = _decorator; export class PetEquipForgingPopupView extends JNLayerBase { //装备展示 - @property(TablePetEquipIcon) - icon:TablePetEquipIcon; + @property(PetEquipIcon) + icon:PetEquipIcon; info:PetEquip; @@ -31,8 +32,7 @@ export class PetEquipForgingPopupView extends JNLayerBase { } onUpdateView(){ - let config = TD.TbGRoleEquip.get(this.info.equipCfgId); - this.icon.set(config); + this.icon.set(this.info); } //点击穿戴装备 diff --git a/JisolGameCocos/extensions/ngame b/JisolGameCocos/extensions/ngame index 8ff29172..3d09378c 160000 --- a/JisolGameCocos/extensions/ngame +++ b/JisolGameCocos/extensions/ngame @@ -1 +1 @@ -Subproject commit 8ff291724bd1cfb730fd326919ebfb44fed48237 +Subproject commit 3d09378c19db0f7c4c45aff7fa7674d9ddee8c3a diff --git a/JisolGameServer/Main/src/main/java/cfg/TB/TbGResource.java b/JisolGameServer/Main/src/main/java/cfg/TB/TbGResource.java index 2679c22f..9ee5cf0f 100644 --- a/JisolGameServer/Main/src/main/java/cfg/TB/TbGResource.java +++ b/JisolGameServer/Main/src/main/java/cfg/TB/TbGResource.java @@ -19,6 +19,7 @@ public final class TbGResource extends AbstractBean { id = _buf.get("id").getAsInt(); name = _buf.get("name").getAsString(); tig = _buf.get("tig").getAsString(); + args = _buf.get("args").getAsString(); } public static TbGResource deserialize(JsonObject _buf) { @@ -37,6 +38,10 @@ public final class TbGResource extends AbstractBean { * 描述 */ public final String tig; + /** + * 额外参数 + */ + public final String args; public static final int __ID__ = 1780642599; @@ -49,6 +54,7 @@ public final class TbGResource extends AbstractBean { + "(format_field_name __code_style field.name):" + id + "," + "(format_field_name __code_style field.name):" + name + "," + "(format_field_name __code_style field.name):" + tig + "," + + "(format_field_name __code_style field.name):" + args + "," + "}"; } } diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/exception/GeneralException.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/exception/GeneralException.java new file mode 100644 index 00000000..fb0f3697 --- /dev/null +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/exception/GeneralException.java @@ -0,0 +1,9 @@ +package cn.jisol.game.controller.exception; + +public class GeneralException extends RuntimeException{ + public GeneralException() { + } + public GeneralException(String message) { + super(message); + } +} diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/exception/HTTPExceptionHandler.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/exception/HTTPExceptionHandler.java index db501c47..873d34b6 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/exception/HTTPExceptionHandler.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/exception/HTTPExceptionHandler.java @@ -32,6 +32,12 @@ public class HTTPExceptionHandler { return NewsContext.onFail("服务器忙碌啦~ 一会再试试."); } + //通用错误 + @ExceptionHandler(value = GeneralException.class) + @ResponseBody + public NewsContext generalHandler(Exception e){ + return NewsContext.onFail(e.getMessage()); + } //全局异常 @ExceptionHandler(value = Exception.class) @ResponseBody diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerEquipController.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerEquipController.java index df9a7dbc..e03227fe 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerEquipController.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerEquipController.java @@ -6,7 +6,6 @@ import cfg.TB.TbGRoleEquipType; import cfg.TbGEntity.TAttributeValue; import cn.hutool.core.util.RandomUtil; import cn.jisol.game.controller.argsresolver.CurrentPlayer; -import cn.jisol.game.controller.exception.ResourceNotException; import cn.jisol.game.data.ResourceId; import cn.jisol.game.data.TD; import cn.jisol.game.entity.data.GAttribute; @@ -16,20 +15,21 @@ import cn.jisol.game.service.PetEquipService; import cn.jisol.game.service.PlayerPetService; import cn.jisol.game.service.ResourceService; import cn.jisol.game.util.GRandomUtil; +import cn.jisol.game.vo.news.NewsResource; +import cn.jisol.game.vo.news.ov.ResourceUpdateOV; import cn.jisol.game.vo.pet.equip.EquipForgingBenchOV; +import cn.jisol.game.vo.pet.equip.PetEquipForgingOV; import cn.jisol.ngame.util.NewsContext; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.retry.RetryException; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.stream.Collectors; /** @@ -55,7 +55,7 @@ public class GPlayerEquipController { @ApiOperation(value = "锻造装备(扣除玩家锻造石 打造一件装备)") @GetMapping("/forging") @Transactional - public NewsContext forging(@CurrentPlayer Player player){ + public NewsContext forging(@CurrentPlayer Player player){ //扣除一个锻造石 resourceService.addResourceValue(player.getPlayerId(), ResourceId.ForgedStones.id, -1L); @@ -63,6 +63,8 @@ public class GPlayerEquipController { //获取锻造台 EquipForgingBenchOV forgingInfo = this.forgingInfo(player).data; + if(Objects.isNull(forgingInfo.getForgingPetId())) return NewsContext.onFail("请设置锻造宠"); + //随机取一个部位 TbGRoleEquipType position = GRandomUtil.randomArray(TD.DATA.getTbGRoleEquipType().getDataList()); @@ -77,7 +79,7 @@ public class GPlayerEquipController { //随机取一个装备 TbGRoleEquip equipInfo = GRandomUtil.randomArray(equips); - //封装 + //封装装备 PetEquip equip = new PetEquip(); equip.setEquipCfgId(equipInfo.id); equip.setEquipPlayerId(player.getPlayerId()); @@ -106,9 +108,13 @@ public class GPlayerEquipController { equip.setEquipHighAttributes(new ArrayList<>()); } - petEquipService.save(equip); + //宠物锻造经验+1 + forgingInfo.addForgingPetLevel(1); - return NewsContext.onSuccess("锻造成功",petEquipService.getById(equip.getEquipId())); + petEquipService.save(equip); + equipForgingBenchService.saveOrUpdate(forgingInfo); + + return NewsContext.onSuccess("锻造成功", PetEquipForgingOV.builder().equip(equip).info(forgingInfo).build()); } @@ -137,7 +143,7 @@ public class GPlayerEquipController { try{ info = EquipForgingBench.builder().playerId(player.getPlayerId()) .forgingQuality(TD.DATA.getTbGRoleEquipQuality().getDataList().get(0).id) - .forgingExp(0).build(); + .build(); equipForgingBenchService.saveOrUpdate(info); }catch (Exception ignored){} assert equipForgingBenchService != null; @@ -204,10 +210,52 @@ public class GPlayerEquipController { //升级锻造台 @ApiImplicitParams({}) - @ApiOperation(value = "锻造台升级") + @ApiOperation(value = "锻造台品质升级") @PostMapping("/forging/up") - public NewsContext wear(@CurrentPlayer Player player){ - return NewsContext.onFail("升级成功"); + public NewsResource wear(@CurrentPlayer Player player){ + EquipForgingBenchOV info = this.forgingInfo(player).data; + + if(info.getForgingUpTimeExcess() > 0) return NewsResource.onFail("正在升级",info); + + //下一个等级 + int nextLevel = info.getForgingQuality() + 1; + TbGRoleEquipQuality currentForgingInfo = TD.DATA.getTbGRoleEquipQuality().get(info.getForgingQuality()); + TbGRoleEquipQuality nextForgingInfo = TD.DATA.getTbGRoleEquipQuality().get(nextLevel); + if(Objects.isNull(nextForgingInfo)) return NewsResource.onFail("已满级"); + + //扣除材料 + ArrayList resources = new ArrayList<>(resourceService.deduct(player,nextForgingInfo.materials)); + + info.setForgingQuality(nextLevel); + //保存升级结束时间 + info.setForgingUpTime((new Date()).getTime() + currentForgingInfo.upTime * 1000L); + + equipForgingBenchService.saveOrUpdate(info); + + return NewsResource.onSuccess("升级成功",info,resources.toArray(new ResourceUpdateOV[0])); + } + + //使用加速卷 + @ApiImplicitParams({}) + @ApiOperation(value = "锻造台加速") + @PostMapping("/use/speed/{resType}") + @Transactional + public NewsResource useSpeed(@CurrentPlayer Player player, @PathVariable Integer resType){ + EquipForgingBenchOV info = this.forgingInfo(player).data; + + if(Objects.isNull(resType)) return NewsResource.onFail("请选择需要使用的加速卷",info); + if(info.getForgingUpTimeExcess() <= 0) return NewsResource.onFail("锻造台已升级成功",info); + + //扣除资源 + ArrayList resources = new ArrayList(){{add(resourceService.deductSpeedUp(player,resType));}}; + + //减少时间 + info.setForgingUpTime(info.getForgingUpTime() - resourceService.timeSpeedUp(resType)); + + if(!equipForgingBenchService.updateById(info)) throw new RetryException("");; + + return NewsResource.onSuccess("使用成功",info,resources.toArray(new ResourceUpdateOV[0])); + } diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerPetController.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerPetController.java index 48dfcd5c..4b94bd12 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerPetController.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerPetController.java @@ -131,8 +131,6 @@ public class GPlayerPetController { @Transactional public NewsResource onUpLevel(@PathVariable Integer petId, @CurrentPlayer Player player){ - //整理刷新数据 - ArrayList resources = new ArrayList<>(); //获取需要升级的宠物 PlayerPet pet = playerPetService.getById(petId); @@ -148,18 +146,8 @@ public class GPlayerPetController { if(pet.getPetStar() * 10 <= pet.getPetLevel()){ return NewsResource.onFail("突破星级 可升级"); } - //扣除玩家材料 - 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)); //刷新资源 - } - } + ArrayList resources = new ArrayList<>(resourceService.deduct(player, resource.materials)); //升级 pet.setPetLevel(pet.getPetLevel() + 1); diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/data/ResourceId.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/data/ResourceId.java index f6a8ee33..a0865fef 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/data/ResourceId.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/data/ResourceId.java @@ -6,6 +6,8 @@ public enum ResourceId { Gold(90001), //锻造石 ForgedStones(90002), + //加速卷 + SpeedUp(90003), ; public int id; diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/entity/table/EquipForgingBench.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/entity/table/EquipForgingBench.java index 5e149b97..312be008 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/entity/table/EquipForgingBench.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/entity/table/EquipForgingBench.java @@ -2,37 +2,65 @@ package cn.jisol.game.entity.table; import cfg.TB.TbGRoleEquipLevel; import cn.jisol.game.data.TD; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; +import cn.jisol.game.entity.data.GAttribute; +import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; -import java.util.Date; -import java.util.List; +import java.util.*; import java.util.stream.Collectors; @SuperBuilder @AllArgsConstructor @NoArgsConstructor @Data -@TableName("`equip_forging_bench`") +@TableName(value = "`equip_forging_bench`",autoResultMap = true) public class EquipForgingBench { @TableId(type = IdType.AUTO) private Integer forgingId; //锻造台Id private Long playerId; //锻造台所属的玩家Id - private Integer forgingExp; //锻造等级经验 private Integer forgingQuality; //锻造品质等级 private Integer forgingPetId; //当前占用宠物Id private Long forgingUpTime; //升级结束时间(服务器) + @Version + private Integer version; + + @TableField(typeHandler = FastjsonTypeHandler.class) + private Map forgingPetLevels; //锻造宠等级信息{宠物Id:宠物经验} + + public Map getForgingPetLevels() { + if(Objects.isNull(forgingPetLevels)) + return this.forgingPetLevels = new HashMap<>(); + return forgingPetLevels; + } + //获取锻造等级 public Integer getForgingLevel() { - List collect = TD.DATA.getTbGRoleEquipLevel().getDataList().stream().filter(info -> info.exp <= this.forgingExp).collect(Collectors.toList()); + List collect = TD.DATA.getTbGRoleEquipLevel().getDataList().stream().filter(info -> info.exp <= this.getForgingPetLevels().getOrDefault(this.getForgingPetId().toString(),0)).collect(Collectors.toList()); return collect.get(collect.size() - 1).id; } + + public Integer getForgingPetId(){ + if(Objects.isNull(this.forgingPetId)) + return 0; + return this.forgingPetId; + } + + //提升指定宠物锻造经验 + public boolean addForgingPetLevel(Integer exp) { + Integer petId = this.forgingPetId; + if (Objects.isNull(petId)) return false; + Integer level = this.getForgingPetLevels().get(petId.toString()); + if(Objects.isNull(level)) level = 0; + level += 1; + this.getForgingPetLevels().put(petId.toString(),level); + return true; + } + } diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/service/ResourceService.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/service/ResourceService.java index 0a377993..2a544294 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/service/ResourceService.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/service/ResourceService.java @@ -1,8 +1,12 @@ package cn.jisol.game.service; +import cn.jisol.game.entity.table.Player; import cn.jisol.game.entity.table.Resource; +import cn.jisol.game.vo.news.ov.ResourceUpdateOV; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.ArrayList; + public interface ResourceService extends IService { //添加某个资源的数量 @@ -12,4 +16,15 @@ public interface ResourceService extends IService { public Resource initResource(Long playerId, int type, Long value); public Resource initResource(Resource resource); + //扣除玩家材料 + public ArrayList deduct(Player player, cfg.TbGEntity.TResource[] materials); + + //扣除通用加速卷 + public ResourceUpdateOV deductSpeedUp(Player player, int type); + + //返回通用加速卷 减少的时间(ms) + public long timeSpeedUp(int type); + + + } diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/service/impl/ResourceServiceImpl.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/service/impl/ResourceServiceImpl.java index 590ebfad..4d13d5a8 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/service/impl/ResourceServiceImpl.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/service/impl/ResourceServiceImpl.java @@ -1,21 +1,26 @@ package cn.jisol.game.service.impl; +import cfg.TbGEntity.TResource; +import cn.jisol.game.controller.exception.GeneralException; import cn.jisol.game.controller.exception.ResourceInitException; import cn.jisol.game.controller.exception.ResourceNotException; +import cn.jisol.game.data.ResourceId; +import cn.jisol.game.data.TD; +import cn.jisol.game.entity.table.Player; import cn.jisol.game.entity.table.Resource; import cn.jisol.game.mapper.ResourceMapper; import cn.jisol.game.service.ResourceService; +import cn.jisol.game.vo.news.NewsResource; +import cn.jisol.game.vo.news.ov.ResourceUpdateOV; import cn.jisol.ngame.util.spring.SpringBeanUtils; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.aop.framework.AopContext; -import org.springframework.retry.RetryException; -import org.springframework.retry.annotation.Retryable; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; +import java.lang.reflect.Array; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Objects; @Service @@ -92,5 +97,37 @@ public class ResourceServiceImpl extends ServiceImpl i return resource; } + @Override + public ArrayList deduct(Player player, TResource[] materials) { + + ArrayList list = new ArrayList<>(); + + for (TResource res : materials) { + Resource data = this.addResourceValue(player.getPlayerId(), res.id, -((long) res.value)); + if (Objects.isNull(data)) { + throw new ResourceNotException("资源不够"); + } else { + //刷新资源 + list.add(ResourceUpdateOV.onUpdate(data)); //刷新资源 + } + } + + return list; + + } + + @Override + public ResourceUpdateOV deductSpeedUp(Player player, int type) { + if(!(Arrays.asList(ResourceId.SpeedUp.id).contains(type))) throw new GeneralException("资源错误"); + //扣除资源 + return ResourceUpdateOV.onUpdate(this.addResourceValue(player.getPlayerId(), type, -1L)); + } + + @Override + public long timeSpeedUp(int type) { + if(!(Arrays.asList(ResourceId.SpeedUp.id).contains(type))) throw new GeneralException("资源错误"); + return Integer.parseInt(TD.DATA.getTbGResource().get(type).args) * 1000L; + } + } diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/vo/pet/equip/EquipForgingBenchOV.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/vo/pet/equip/EquipForgingBenchOV.java index daddb88b..bbf2a5f9 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/vo/pet/equip/EquipForgingBenchOV.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/vo/pet/equip/EquipForgingBenchOV.java @@ -8,8 +8,7 @@ import java.util.Date; public class EquipForgingBenchOV extends EquipForgingBench { //获取当前品质等级 - @Override - public Integer getForgingQuality() { + public Integer getCurrentForgingQuality() { if(this.getForgingUpTimeExcess() > 0){ return super.getForgingQuality() - 1; }else{ diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/vo/pet/equip/PetEquipForgingOV.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/vo/pet/equip/PetEquipForgingOV.java new file mode 100644 index 00000000..b6a33d85 --- /dev/null +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/vo/pet/equip/PetEquipForgingOV.java @@ -0,0 +1,13 @@ +package cn.jisol.game.vo.pet.equip; + +import cn.jisol.game.entity.table.EquipForgingBench; +import cn.jisol.game.entity.table.PetEquip; +import lombok.Builder; +import lombok.Data; + +@Builder +@Data +public class PetEquipForgingOV { + private EquipForgingBench info; + private PetEquip equip; +} diff --git a/JisolGameServer/Main/src/main/resources/json/tbgresource.json b/JisolGameServer/Main/src/main/resources/json/tbgresource.json index fb678f6b..1c53050b 100644 --- a/JisolGameServer/Main/src/main/resources/json/tbgresource.json +++ b/JisolGameServer/Main/src/main/resources/json/tbgresource.json @@ -2,11 +2,19 @@ { "id": 90001, "name": "金币", - "tig": "金币 (目前叫做金币 名称还没有定) 游戏的基础资源 用于升级宠物" + "tig": "金币 (目前叫做金币 名称还没有定) 游戏的基础资源 用于升级宠物", + "args": "" }, { "id": 90002, "name": "锻造石", - "tig": "锻造石 可以锻造装备的石头" + "tig": "锻造石 可以锻造装备的石头", + "args": "" + }, + { + "id": 90003, + "name": "通用加速卷", + "tig": "加速卷 用来加速一切需要时间的东西 减少冷却:60s", + "args": "60" } ] \ No newline at end of file