提交挂机

This commit is contained in:
DESKTOP-5RP3AKU\Jisol 2023-12-28 02:56:34 +08:00
parent 4d536f1663
commit 6890d80086
12 changed files with 733 additions and 57 deletions

View File

@ -348,7 +348,8 @@
"fileId": "64PJYFWgBDZrEsaiYwZxmh", "fileId": "64PJYFWgBDZrEsaiYwZxmh",
"instance": { "instance": {
"__id__": 13 "__id__": 13
} },
"targetOverrides": null
}, },
{ {
"__type__": "cc.PrefabInstance", "__type__": "cc.PrefabInstance",
@ -2377,7 +2378,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "Label", "_name": "挂机文本",
"_objFlags": 512, "_objFlags": 512,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": { "_parent": {
@ -4891,6 +4892,9 @@
"playerNameLabel": { "playerNameLabel": {
"__id__": 28 "__id__": 28
}, },
"onHookLabel": {
"__id__": 131
},
"_id": "" "_id": ""
}, },
{ {

View File

@ -25,17 +25,17 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 78 "__id__": 79
}, },
{ {
"__id__": 80 "__id__": 81
}, },
{ {
"__id__": 82 "__id__": 83
} }
], ],
"_prefab": { "_prefab": {
"__id__": 84 "__id__": 85
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -88,17 +88,17 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 71 "__id__": 72
}, },
{ {
"__id__": 73 "__id__": 74
}, },
{ {
"__id__": 75 "__id__": 76
} }
], ],
"_prefab": { "_prefab": {
"__id__": 77 "__id__": 78
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -1260,7 +1260,7 @@
} }
], ],
"_prefab": { "_prefab": {
"__id__": 70 "__id__": 71
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -1358,8 +1358,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 100, "width": 56,
"height": 40 "height": 54.4
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@ -1401,7 +1401,7 @@
"_fontSize": 26, "_fontSize": 26,
"_fontFamily": "Arial", "_fontFamily": "Arial",
"_lineHeight": 40, "_lineHeight": 40,
"_overflow": 1, "_overflow": 0,
"_enableWrapText": false, "_enableWrapText": false,
"_font": null, "_font": null,
"_isSystemFontUsed": true, "_isSystemFontUsed": true,
@ -1541,9 +1541,13 @@
"__prefab": { "__prefab": {
"__id__": 69 "__id__": 69
}, },
"clickEvents": [], "clickEvents": [
{
"__id__": 70
}
],
"_interactable": true, "_interactable": true,
"_transition": 2, "_transition": 3,
"_normalColor": { "_normalColor": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 214, "r": 214,
@ -1599,6 +1603,16 @@
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "48qQZsVYRIALxz7GL1L6nU" "fileId": "48qQZsVYRIALxz7GL1L6nU"
}, },
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "2ff46LuJ6xJF6cskydUIhuT",
"handler": "onClickOnHook",
"customEventData": ""
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
@ -1622,7 +1636,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 72 "__id__": 73
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@ -1650,7 +1664,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 74 "__id__": 75
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@ -1695,7 +1709,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 76 "__id__": 77
}, },
"_id": "" "_id": ""
}, },
@ -1726,7 +1740,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 79 "__id__": 80
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@ -1754,7 +1768,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 81 "__id__": 82
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,
@ -1790,7 +1804,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 83 "__id__": 84
}, },
"mask": true, "mask": true,
"maskOpcity": 80, "maskOpcity": 80,
@ -1798,6 +1812,9 @@
"views": { "views": {
"__id__": 45 "__id__": 45
}, },
"onHookLabel": {
"__id__": 59
},
"_id": "" "_id": ""
}, },
{ {

View File

@ -25,17 +25,17 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 150 "__id__": 173
}, },
{ {
"__id__": 152 "__id__": 175
}, },
{ {
"__id__": 154 "__id__": 177
} }
], ],
"_prefab": { "_prefab": {
"__id__": 156 "__id__": 179
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -86,22 +86,25 @@
}, },
{ {
"__id__": 124 "__id__": 124
},
{
"__id__": 143
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 143 "__id__": 166
}, },
{ {
"__id__": 145 "__id__": 168
}, },
{ {
"__id__": 147 "__id__": 170
} }
], ],
"_prefab": { "_prefab": {
"__id__": 149 "__id__": 172
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
@ -2398,7 +2401,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 95.5,
"y": -309.485, "y": -309.485,
"z": 0 "z": 0
}, },
@ -3191,6 +3194,533 @@
"targetOverrides": null, "targetOverrides": null,
"nestedPrefabInstanceRoots": null "nestedPrefabInstanceRoots": null
}, },
{
"__type__": "cc.Node",
"_name": "主动吞噬宠物",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 144
},
{
"__id__": 150
}
],
"_active": true,
"_components": [
{
"__id__": 158
},
{
"__id__": 160
},
{
"__id__": 162
}
],
"_prefab": {
"__id__": 165
},
"_lpos": {
"__type__": "cc.Vec3",
"x": -228.169,
"y": -310.378,
"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": "Checkmark",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 143
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 145
},
{
"__id__": 147
}
],
"_prefab": {
"__id__": 149
},
"_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__": 144
},
"_enabled": true,
"__prefab": {
"__id__": 146
},
"_contentSize": {
"__type__": "cc.Size",
"width": 26,
"height": 26
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "edutU3mGxB1Kwg+z00tSXd"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 144
},
"_enabled": true,
"__prefab": {
"__id__": 148
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "158e7e52-3220-4cd7-9694-713e0e6e8278@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": "2fIU3cXWxDQYiTDSu+3KyJ"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "cc89pkOEZFWYgpdUlcSPrF",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 143
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 151
},
{
"__id__": 153
},
{
"__id__": 155
}
],
"_prefab": {
"__id__": 157
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 23.875,
"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__": 150
},
"_enabled": true,
"__prefab": {
"__id__": 152
},
"_contentSize": {
"__type__": "cc.Size",
"width": 211.79296875,
"height": 54.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "0cS5AJcMVIVbsJLnEVKKcb"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 150
},
"_enabled": true,
"__prefab": {
"__id__": 154
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "是否主动吞噬 0 星 宠物",
"_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": "58bYyo8BVJl66rlOOQA5Fg"
},
{
"__type__": "cc.LabelOutline",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 150
},
"_enabled": true,
"__prefab": {
"__id__": 156
},
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_width": 2,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "f4IkouWdRAPqxACtqQi5Sm"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "fb76U7zyBMu77r84nqvnfK",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 143
},
"_enabled": true,
"__prefab": {
"__id__": 159
},
"_contentSize": {
"__type__": "cc.Size",
"width": 28,
"height": 28
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "c0gJrrqNRHg4XdhNrMJyNN"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 143
},
"_enabled": true,
"__prefab": {
"__id__": 161
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "11bdc4b0-64a8-4eb7-a2a7-9fb9e233e977@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": "dboDNzKTZDhbFasr2/lowH"
},
{
"__type__": "cc.Toggle",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 143
},
"_enabled": true,
"__prefab": {
"__id__": 163
},
"clickEvents": [],
"_interactable": true,
"_transition": 0,
"_normalColor": {
"__type__": "cc.Color",
"r": 214,
"g": 214,
"b": 214,
"a": 255
},
"_hoverColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_pressedColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_normalSprite": {
"__uuid__": "11bdc4b0-64a8-4eb7-a2a7-9fb9e233e977@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_hoverSprite": null,
"_pressedSprite": null,
"_disabledSprite": null,
"_duration": 0.1,
"_zoomScale": 1.2,
"_target": {
"__id__": 143
},
"checkEvents": [
{
"__id__": 164
}
],
"_isChecked": false,
"_checkMark": {
"__id__": 147
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "08CaQ9IvFL9640k2qkUBoQ"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "f8ba4N+bqdD84IUK5j+GSAq",
"handler": "onClickEngulfToggle",
"customEventData": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "d0DZ2qqchC74h/KCryK3cD",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{ {
"__type__": "cc.UITransform", "__type__": "cc.UITransform",
"_name": "", "_name": "",
@ -3201,7 +3731,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 144 "__id__": 167
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@ -3229,7 +3759,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 146 "__id__": 169
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@ -3274,7 +3804,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 148 "__id__": 171
}, },
"_id": "" "_id": ""
}, },
@ -3305,7 +3835,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 151 "__id__": 174
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
@ -3333,7 +3863,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 153 "__id__": 176
}, },
"_alignFlags": 45, "_alignFlags": 45,
"_target": null, "_target": null,
@ -3369,7 +3899,7 @@
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 155 "__id__": 178
}, },
"mask": true, "mask": true,
"maskOpcity": 80, "maskOpcity": 80,
@ -3392,6 +3922,9 @@
"viewPetExpProgress": { "viewPetExpProgress": {
"__id__": 31 "__id__": 31
}, },
"isEngulfToggle": {
"__id__": 162
},
"_id": "" "_id": ""
}, },
{ {

View File

@ -4,7 +4,7 @@ import ResourceData from "../data/ResourceData";
import { GUI } from "../ui/UIConfig"; import { GUI } from "../ui/UIConfig";
//接受到JSON消息 //接受到JSON消息
export const RData = (data:any,isTips:boolean = true) => { export const RData = (data:any,isTips:boolean = false) => {
if(data.data.state == 200){ if(data.data.state == 200){
//如果有 Resource 字段 表示要刷新资源 //如果有 Resource 字段 表示要刷新资源
if(data.data['resources']){ if(data.data['resources']){
@ -14,6 +14,10 @@ export const RData = (data:any,isTips:boolean = true) => {
PlayerPetData.getIns().onUpdateOV(res.operation,res.pet); //刷新宠物 PlayerPetData.getIns().onUpdateOV(res.operation,res.pet); //刷新宠物
}) })
} }
//弹出提示
if(isTips){
app.layer.Open(GUI.Tips,{text:data.data.msg});
}
return data.data.data; return data.data.data;
}else{ }else{
//弹出提示 //弹出提示
@ -97,7 +101,7 @@ export const API = {
/********** 新手引导接口 *****************/ /********** 新手引导接口 *****************/
SavePlayerInfo : async (playerName:string,novice:boolean = true) => (await app.api.post(`/game/player/info/save`,{playerName,novice})).data as NewsContext, //保存玩家信息 SavePlayerInfo : async (playerName:string,novice:boolean = true) => (await app.api.post(`/game/player/info/save`,{playerName,novice})).data as NewsContext, //保存玩家信息
SelectNovicePet: async (petId:number) => RData(await app.api.post(`/game/novice/select/${petId}`),true), //选择新手引导宠物 SelectNovicePet: async (petId:number) => RData(await app.api.post(`/game/novice/select/${petId}`),false), //选择新手引导宠物
/********** 宠物接口 ******************/ /********** 宠物接口 ******************/

View File

@ -19,11 +19,11 @@ export const GAPI = {
//切换游戏 //切换游戏
GOnHookSetMap : async (mapId) => RData(await app.api.post(`/game/mode/onHook/setMapId/${mapId}`)) as ModeOnHookOV, GOnHookSetMap : async (mapId) => RData(await app.api.post(`/game/mode/onHook/setMapId/${mapId}`)) as ModeOnHookOV,
//生成野怪 //生成野怪
GOnHookSpawnCreeps : async () => RProto(await app.api.get(`/game/mode/onHook/onSpawnCreeps`,{responseType:'arraybuffer'},true),GActionType.GOnHookPets) as GOnHookPets, GOnHookSpawnCreeps : async () => RProto(await app.api.get(`/game/mode/onHook/onSpawnCreeps`,{responseType:'arraybuffer'},false),GActionType.GOnHookPets) as GOnHookPets,
//捕捉野怪 //捕捉野怪
GOnHookCatchCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onCatchCreeps/${creepId}`)) as PlayerPetOV, GOnHookCatchCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onCatchCreeps/${creepId}`),true) as PlayerPetOV,
//出售野怪 //出售野怪
GOnHookSellCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onSellCreeps/${creepId}`)) as boolean, GOnHookSellCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onSellCreeps/${creepId}`),true) as boolean,
//下一关 //下一关
GOnHookNextLevel : async () => RData(await app.api.post(`/game/mode/onHook/nextLevel`)) as boolean, GOnHookNextLevel : async () => RData(await app.api.post(`/game/mode/onHook/nextLevel`)) as boolean,

View File

@ -1,8 +1,11 @@
import { GOnHookPet } from "../../../../../extensions/ngame/assets/ngame/message/proto"; import { GOnHookPet } from "../../../../../extensions/ngame/assets/ngame/message/proto";
import NGameUtil from "../../../../../extensions/ngame/assets/ngame/util/NGameUtil";
import { NSystemEvent } from "../../../../../extensions/ngame/assets/ngame/util/NSystem";
import Singleton from "../../../../../extensions/ngame/assets/ngame/util/Singleton"; import Singleton from "../../../../../extensions/ngame/assets/ngame/util/Singleton";
import { app } from "../../../App"; import { TD, app } from "../../../App";
import GBattleModeManager, { BattleMode } from "../../../battle/GBattleModeManager"; import GBattleModeManager, { BattleMode } from "../../../battle/GBattleModeManager";
import { PlayerPetOV } from "../../../consts/API"; import { TB } from "../../../config/data/schema";
import { API, PlayerPetOV } from "../../../consts/API";
import { GAPI } from "../../../consts/GAPI"; import { GAPI } from "../../../consts/GAPI";
import GOnHookData from "../../../data/GOnHookData"; import GOnHookData from "../../../data/GOnHookData";
import PlayerPetData from "../../../data/PlayerPetData"; import PlayerPetData from "../../../data/PlayerPetData";
@ -16,7 +19,9 @@ export enum GOnHookManagerEvent{
//重置数据 //重置数据
RESET_DATA = "GOnHookManagerEvent_RESET_DATA", RESET_DATA = "GOnHookManagerEvent_RESET_DATA",
//删除死亡野怪 //删除死亡野怪
UPDATE_MAP = "GOnHookManagerEvent_UPDATE_MAP" UPDATE_MAP = "GOnHookManagerEvent_UPDATE_MAP",
//更新挂机状态
UPDATE_ON_HOOK_STATE = "GOnHookManagerEvent_UPDATE_ON_HOOK_STATE"
} }
//游戏模式 OnHook 管理器 //游戏模式 OnHook 管理器
@ -42,6 +47,71 @@ export default class GOnHookManager extends Singleton{
//已经死亡的野怪列表 //已经死亡的野怪列表
killSreeps:GOnHookPet[] = []; killSreeps:GOnHookPet[] = [];
//-------------------------- 挂机 ---------------------------------
//需要捕捉的宠物
onHookCatchPets:TB.TbGRole[] = [];
//需要主动吞噬的宠物 (主动吞噬其他 0星 宠物 升星)
onHookEngulfPets:PlayerPetOV[] = [];
//是否挂机
_isOnHook:boolean = false;
get isOnHook(){return this._isOnHook}
set isOnHook(value:boolean){
this._isOnHook = value;
//通知更新挂机状态
app.event.emit(GOnHookManagerEvent.UPDATE_ON_HOOK_STATE);
}
init(){
app.event.on(NSystemEvent.UPDATE,this.onUpdate,this);
}
destroy(): void {
app.event.off(NSystemEvent.UPDATE,this.onUpdate,this);
}
onUpdate(){
this.onUpdateOnHook();
}
//更新挂机
onUpdateOnHook = NGameUtil.ThrottleASync((async () => {
//如果是挂机 则 出售不需要捕捉的宠物
if(!this.isOnHook) return;
//捕捉 和 出售
let pet = this.killSreeps[0];
if(pet){
if(this.onHookCatchPets.indexOf(TD.TbGRole.get(pet.petTbId)) >= 0){
//捕捉
await this.onCatchCreeps(pet)
}else{
//出售
await this.onSellCreeps(pet)
}
}
//自动吞噬
for (const item of this.onHookEngulfPets) {
//获取可吞噬的宠物
let engulfs = PlayerPetData.getIns().getData()
.filter(value => (value.petStar || 0) == 0 && item.petTbId == value.petTbId && item.petId != value.petId)
.map(value => value.petId);
//吞噬
if(engulfs.length){
await API.PetUpStar(item.petId,engulfs);
}
}
}).bind(this))
//生成野怪 //生成野怪
onSpawnSreeps(){ onSpawnSreeps(){

View File

@ -7,7 +7,7 @@ import { JNGLayerBase } from '../../components/JNComponent';
import { app } from '../../App'; import { app } from '../../App';
import { GAction } from '../../consts/GAction'; import { GAction } from '../../consts/GAction';
import { GAPI } from '../../consts/GAPI'; import { GAPI } from '../../consts/GAPI';
import GOnHookManager from '../../manager/battle/mode/GOnHookManager'; import GOnHookManager, { GOnHookManagerEvent } from '../../manager/battle/mode/GOnHookManager';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('MainView') @ccclass('MainView')
@ -16,8 +16,13 @@ export class MainView extends JNGLayerBase {
@property(Label) @property(Label)
playerNameLabel:Label; //玩家名称 playerNameLabel:Label; //玩家名称
@property(Label)
onHookLabel:Label; //挂机文本
onJNLoad(data?: any): void { onJNLoad(data?: any): void {
super.onJNLoad(data);
//发送消息 //发送消息
ChatData.getIns().onSend({ ChatData.getIns().onSend({
message:`${PlayerData.getIns().data.playerId} 加入游戏` message:`${PlayerData.getIns().data.playerId} 加入游戏`
@ -25,6 +30,20 @@ export class MainView extends JNGLayerBase {
this.onUpdateView(); this.onUpdateView();
//监听
app.event.on(GOnHookManagerEvent.UPDATE_ON_HOOK_STATE,this.onUpdateOnHook,this);
}
onJNClose(): void {
super.onJNClose();
//取消监听
app.event.on(GOnHookManagerEvent.UPDATE_ON_HOOK_STATE,this.onUpdateOnHook,this);
}
onUpdateOnHook(){
this.onHookLabel.string = (GOnHookManager.getIns().isOnHook) ? "挂机中" : "挂机";
} }
//更新UI界面 //更新UI界面

View File

@ -2,9 +2,12 @@ import { _decorator, Component, Node } from 'cc';
import { JNGLayerBase } from '../../../components/JNComponent'; import { JNGLayerBase } from '../../../components/JNComponent';
import JNScrollView from '../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView'; import JNScrollView from '../../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView';
import GOnHookData from '../../../data/GOnHookData'; import GOnHookData from '../../../data/GOnHookData';
import { TD } from '../../../App'; import { app, TD } from '../../../App';
import { NodeEventType } from 'cc'; import { NodeEventType } from 'cc';
import { TablePetIconSelectScroll } from '../../Consts/Pet/table/TablePetIconSelectScroll'; import { TablePetIconSelectScroll } from '../../Consts/Pet/table/TablePetIconSelectScroll';
import { Label } from 'cc';
import GOnHookManager from '../../../manager/battle/mode/GOnHookManager';
import { GUI } from '../../UIConfig';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('MainOnHookView') @ccclass('MainOnHookView')
@ -14,6 +17,10 @@ export class MainOnHookView extends JNGLayerBase {
@property(JNScrollView) @property(JNScrollView)
views:JNScrollView; views:JNScrollView;
//挂机按钮
@property(Label)
onHookLabel:Label;
onJNLoad(){ onJNLoad(){
super.onJNLoad(); super.onJNLoad();
@ -28,11 +35,12 @@ export class MainOnHookView extends JNGLayerBase {
onUpdateView(){ onUpdateView(){
//显示当前地图可出现的所有宠物 //显示当前地图可出现的所有宠物
let mapInfo = TD.TbGOnHookMaps.get(GOnHookData.getIns().info.onHookMap); let mapInfo = TD.TbGOnHookMaps.get(GOnHookData.getIns().info.onHookMap);
let pets = mapInfo.petIds.map(petId => TD.TbGRole.get(petId)); let pets = mapInfo.petIds.map(petId => TD.TbGRole.get(petId));
this.views.refreshData(pets); this.views.refreshData(pets);
this.onHookLabel.string = (!GOnHookManager.getIns().isOnHook) ? "挂机" : "取消挂机"
} }
//点击Item //点击Item
@ -43,6 +51,14 @@ export class MainOnHookView extends JNGLayerBase {
} }
//点击挂机
onClickOnHook(){
GOnHookManager.getIns().onHookCatchPets = this.views.getItems<TablePetIconSelectScroll>().filter(item => item.select.isSelect).map(item => item.data)
GOnHookManager.getIns().isOnHook = !GOnHookManager.getIns().isOnHook;
app.layer.Open(GUI.Tips,{text:`${(GOnHookManager.getIns().isOnHook) ? "挂机" : "取消挂机"} 设置成功`})
this.close();
}
} }

View File

@ -91,8 +91,7 @@ export class MainSreepsList extends Component {
return; return;
} }
if(await GOnHookManager.getIns().onCatchCreeps(item.data)) await GOnHookManager.getIns().onCatchCreeps(item.data)
app.layer.Open(GUI.Tips,{text:"捕捉成功!"});
} }
@ -107,8 +106,7 @@ export class MainSreepsList extends Component {
return; return;
} }
if(await GOnHookManager.getIns().onSellCreeps(item.data)) await GOnHookManager.getIns().onSellCreeps(item.data)
app.layer.Open(GUI.Tips,{text:"出售成功!"});
} }

View File

@ -11,6 +11,8 @@ import { app, TD } from '../../App';
import { GUI } from '../UIConfig'; import { GUI } from '../UIConfig';
import { ProgressBar } from 'cc'; import { ProgressBar } from 'cc';
import JProgressBar from '../../../../extensions/ngame/assets/ngame/util/components/Progress/JProgressBar'; import JProgressBar from '../../../../extensions/ngame/assets/ngame/util/components/Progress/JProgressBar';
import { Toggle } from 'cc';
import GOnHookManager from '../../manager/battle/mode/GOnHookManager';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('PetUpStarView') @ccclass('PetUpStarView')
@ -30,6 +32,9 @@ export class PetUpStarView extends JNLayerBase {
@property(JProgressBar) @property(JProgressBar)
viewPetExpProgress:JProgressBar; //预览宠物经验条 viewPetExpProgress:JProgressBar; //预览宠物经验条
@property(Toggle)
isEngulfToggle:Toggle; //是否主动吞噬 0 星 宠物
data:PlayerPetOV; data:PlayerPetOV;
onJNLoad(data: PlayerPetOV): void { onJNLoad(data: PlayerPetOV): void {
@ -70,6 +75,9 @@ export class PetUpStarView extends JNLayerBase {
this.onUpdateSelect(); this.onUpdateSelect();
//更新吞噬
this.isEngulfToggle.isChecked = GOnHookManager.getIns().onHookEngulfPets.indexOf(this.data) >= 0;
} }
//刷新信息 //刷新信息
@ -149,6 +157,7 @@ export class PetUpStarView extends JNLayerBase {
//点击合成 //点击合成
async onClickUp(){ async onClickUp(){
//获取被合成的Id //获取被合成的Id
let pets = this.views.getData<PlayerPetOVSelect>().filter(pet => pet.isSelect).map(pet => pet.petId); let pets = this.views.getData<PlayerPetOVSelect>().filter(pet => pet.isSelect).map(pet => pet.petId);
@ -158,10 +167,17 @@ export class PetUpStarView extends JNLayerBase {
} }
await API.PetUpStar(this.data.petId,pets); await API.PetUpStar(this.data.petId,pets);
app.layer.Open(GUI.Tips,{text:"合成成功"});
} }
//点击吞噬选择
onClickEngulfToggle(){
GOnHookManager.getIns().onHookEngulfPets.splice(GOnHookManager.getIns().onHookEngulfPets.indexOf(this.data),1);
if(this.isEngulfToggle.isChecked){
GOnHookManager.getIns().onHookEngulfPets.push(this.data);
}
}
} }

View File

@ -132,8 +132,7 @@ export class IntoBattleView extends JNLayerBase {
app.layer.Open(GUI.Tips,{text:"请选择宠物."}) app.layer.Open(GUI.Tips,{text:"请选择宠物."})
return; return;
} }
if(await API.PetUpLevel(this.pets[this.index].petId)) await API.PetUpLevel(this.pets[this.index].petId)
app.layer.Open(GUI.Tips,{text:"升级成功!"})
} }

@ -1 +1 @@
Subproject commit 18024211e522df5b4280c4d74ad88cdb948bd783 Subproject commit 22fe68202ba5e785b2bcc30b8031e049dc326b1d