This commit is contained in:
PC-20230316NUNE\Administrator 2024-01-10 19:09:14 +08:00
parent 0d745b9715
commit d0d80bb9ad
34 changed files with 764 additions and 146 deletions

View File

@ -2,11 +2,19 @@
{
"id": 90001,
"name": "金币",
"tig": "金币 (目前叫做金币 名称还没有定) 游戏的基础资源 用于升级宠物"
"tig": "金币 (目前叫做金币 名称还没有定) 游戏的基础资源 用于升级宠物",
"args": ""
},
{
"id": 90002,
"name": "锻造石",
"tig": "锻造石 可以锻造装备的石头"
"tig": "锻造石 可以锻造装备的石头",
"args": ""
},
{
"id": 90003,
"name": "通用加速卷",
"tig": "加速卷 用来加速一切需要时间的东西 减少冷却:60s",
"args": "60"
}
]

View File

@ -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"
]
}
]

View File

@ -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
}
},
{

View File

@ -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"
]
}
]

View File

@ -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": ""
},
{

View File

@ -147,7 +147,7 @@
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"y": 3.959,
"z": 0
},
"_lrot": {

View File

@ -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": ""
},
{

View File

@ -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,

View File

@ -706,7 +706,7 @@
"__id__": 30
}
],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 38

View File

@ -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`

View File

@ -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)
{

View File

@ -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, //加速锻造台升级
}

View File

@ -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;
}
}

View File

@ -8,7 +8,9 @@ export enum ResourceEvent{
//资源类型
export enum ResourceType{
Gold = 90001, //金币
Gold = 90001, //金币
ForgedStones = 90002, //锻造石
SpeedUp = 90003, //加速卷
}
//资源刷新类型

View File

@ -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)}`
}

View File

@ -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}`;
}

View File

@ -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();
}
}

View File

@ -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<GOnHookPet> {
@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));
}
}

View File

@ -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);
}
//点击穿戴装备

@ -1 +1 @@
Subproject commit 8ff291724bd1cfb730fd326919ebfb44fed48237
Subproject commit 3d09378c19db0f7c4c45aff7fa7674d9ddee8c3a

View File

@ -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 + ","
+ "}";
}
}

View File

@ -0,0 +1,9 @@
package cn.jisol.game.controller.exception;
public class GeneralException extends RuntimeException{
public GeneralException() {
}
public GeneralException(String message) {
super(message);
}
}

View File

@ -32,6 +32,12 @@ public class HTTPExceptionHandler {
return NewsContext.onFail("服务器忙碌啦~ 一会再试试.");
}
//通用错误
@ExceptionHandler(value = GeneralException.class)
@ResponseBody
public NewsContext<String> generalHandler(Exception e){
return NewsContext.onFail(e.getMessage());
}
//全局异常
@ExceptionHandler(value = Exception.class)
@ResponseBody

View File

@ -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<PetEquip> forging(@CurrentPlayer Player player){
public NewsContext<PetEquipForgingOV> 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<EquipForgingBenchOV> wear(@CurrentPlayer Player player){
return NewsContext.onFail("升级成功");
public NewsResource<EquipForgingBenchOV> 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<ResourceUpdateOV> 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<EquipForgingBenchOV> 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<ResourceUpdateOV> resources = new ArrayList<ResourceUpdateOV>(){{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]));
}

View File

@ -131,8 +131,6 @@ public class GPlayerPetController {
@Transactional
public NewsResource<PlayerPet> onUpLevel(@PathVariable Integer petId, @CurrentPlayer Player player){
//整理刷新数据
ArrayList<ResourceUpdateOV> 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<ResourceUpdateOV> resources = new ArrayList<>(resourceService.deduct(player, resource.materials));
//升级
pet.setPetLevel(pet.getPetLevel() + 1);

View File

@ -6,6 +6,8 @@ public enum ResourceId {
Gold(90001),
//锻造石
ForgedStones(90002),
//加速卷
SpeedUp(90003),
;
public int id;

View File

@ -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<String,Integer> forgingPetLevels; //锻造宠等级信息{宠物Id:宠物经验}
public Map<String, Integer> getForgingPetLevels() {
if(Objects.isNull(forgingPetLevels))
return this.forgingPetLevels = new HashMap<>();
return forgingPetLevels;
}
//获取锻造等级
public Integer getForgingLevel() {
List<TbGRoleEquipLevel> collect = TD.DATA.getTbGRoleEquipLevel().getDataList().stream().filter(info -> info.exp <= this.forgingExp).collect(Collectors.toList());
List<TbGRoleEquipLevel> 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;
}
}

View File

@ -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<Resource> {
//添加某个资源的数量
@ -12,4 +16,15 @@ public interface ResourceService extends IService<Resource> {
public Resource initResource(Long playerId, int type, Long value);
public Resource initResource(Resource resource);
//扣除玩家材料
public ArrayList<ResourceUpdateOV> deduct(Player player, cfg.TbGEntity.TResource[] materials);
//扣除通用加速卷
public ResourceUpdateOV deductSpeedUp(Player player, int type);
//返回通用加速卷 减少的时间(ms)
public long timeSpeedUp(int type);
}

View File

@ -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<ResourceMapper, Resource> i
return resource;
}
@Override
public ArrayList<ResourceUpdateOV> deduct(Player player, TResource[] materials) {
ArrayList<ResourceUpdateOV> 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;
}
}

View File

@ -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{

View File

@ -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;
}

View File

@ -2,11 +2,19 @@
{
"id": 90001,
"name": "金币",
"tig": "金币 (目前叫做金币 名称还没有定) 游戏的基础资源 用于升级宠物"
"tig": "金币 (目前叫做金币 名称还没有定) 游戏的基础资源 用于升级宠物",
"args": ""
},
{
"id": 90002,
"name": "锻造石",
"tig": "锻造石 可以锻造装备的石头"
"tig": "锻造石 可以锻造装备的石头",
"args": ""
},
{
"id": 90003,
"name": "通用加速卷",
"tig": "加速卷 用来加速一切需要时间的东西 减少冷却:60s",
"args": "60"
}
]