diff --git a/DataTables/Datas/战斗/模式/无尽模式/OnHook地图.xlsx b/DataTables/Datas/战斗/模式/无尽模式/OnHook地图.xlsx index 87accb1c..06922d40 100644 Binary files a/DataTables/Datas/战斗/模式/无尽模式/OnHook地图.xlsx and b/DataTables/Datas/战斗/模式/无尽模式/OnHook地图.xlsx differ diff --git a/JisolGameCocos/assets/battle/map/MAP4/MAP4_3.png b/JisolGameCocos/assets/battle/map/MAP4/MAP4_3.png index 30645bdf..ee0cf0cd 100644 Binary files a/JisolGameCocos/assets/battle/map/MAP4/MAP4_3.png and b/JisolGameCocos/assets/battle/map/MAP4/MAP4_3.png differ diff --git a/JisolGameCocos/assets/battle/map/MAP4/MAP4_3.png.meta b/JisolGameCocos/assets/battle/map/MAP4/MAP4_3.png.meta index dbbebcbb..a5016ff9 100644 --- a/JisolGameCocos/assets/battle/map/MAP4/MAP4_3.png.meta +++ b/JisolGameCocos/assets/battle/map/MAP4/MAP4_3.png.meta @@ -46,10 +46,10 @@ "offsetY": 0, "trimX": 0, "trimY": 0, - "width": 24, - "height": 24, - "rawWidth": 24, - "rawHeight": 24, + "width": 2, + "height": 2, + "rawWidth": 2, + "rawHeight": 2, "borderTop": 0, "borderBottom": 0, "borderLeft": 0, @@ -61,17 +61,17 @@ "meshType": 0, "vertices": { "rawPosition": [ - -12, - -12, + -1, + -1, 0, - 12, - -12, + 1, + -1, 0, - -12, - 12, + -1, + 1, 0, - 12, - 12, + 1, + 1, 0 ], "indexes": [ @@ -84,12 +84,12 @@ ], "uv": [ 0, - 24, - 24, - 24, + 2, + 2, + 2, 0, 0, - 24, + 2, 0 ], "nuv": [ @@ -103,13 +103,13 @@ 1 ], "minPos": [ - -12, - -12, + -1, + -1, 0 ], "maxPos": [ - 12, - 12, + 1, + 1, 0 ] }, diff --git a/JisolGameCocos/assets/resources/config/json/tbgonhookmaps.json b/JisolGameCocos/assets/resources/config/json/tbgonhookmaps.json index 2b21c7d8..953dd292 100644 --- a/JisolGameCocos/assets/resources/config/json/tbgonhookmaps.json +++ b/JisolGameCocos/assets/resources/config/json/tbgonhookmaps.json @@ -15,7 +15,7 @@ { "id": 120002, "name": "魔法镇", - "mapImage": "ui/map/天空城_图片/spriteFrame", + "mapImage": "ui/map/魔法镇_图片/spriteFrame", "mapId": 60002, "petIds": [ 10003, diff --git a/JisolGameCocos/assets/resources/prefab/ui/地图/地图展示节点.prefab b/JisolGameCocos/assets/resources/prefab/ui/地图/地图展示节点.prefab index cabe3211..c090125d 100644 --- a/JisolGameCocos/assets/resources/prefab/ui/地图/地图展示节点.prefab +++ b/JisolGameCocos/assets/resources/prefab/ui/地图/地图展示节点.prefab @@ -25,23 +25,26 @@ "__id__": 8 }, { - "__id__": 16 - } - ], - "_active": true, - "_components": [ - { - "__id__": 24 + "__id__": 14 }, { - "__id__": 26 + "__id__": 20 }, { "__id__": 28 } ], + "_active": true, + "_components": [ + { + "__id__": 36 + }, + { + "__id__": 38 + } + ], "_prefab": { - "__id__": 30 + "__id__": 40 }, "_lpos": { "__type__": "cc.Vec3", @@ -74,7 +77,7 @@ }, { "__type__": "cc.Node", - "_name": "地图预览图", + "_name": "选中颜色", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -95,7 +98,7 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -170.316, + "x": 0, "y": 0, "z": 0 }, @@ -134,6 +137,278 @@ "__prefab": { "__id__": 4 }, + "_contentSize": { + "__type__": "cc.Size", + "width": 660, + "height": 260 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "1fm/yIo8xG7L/MU3QUJXHv" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 6 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "d1l3mfKhVDJJUPdPg0hi5c" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "d9AGOwwU9KjIFcfeT9rrIy", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "背景颜色", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 9 + }, + { + "__id__": 11 + } + ], + "_prefab": { + "__id__": 13 + }, + "_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__": 8 + }, + "_enabled": true, + "__prefab": { + "__id__": 10 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 650, + "height": 250 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "17QXJmOL1D/ITQjKUtojL0" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 8 + }, + "_enabled": true, + "__prefab": { + "__id__": 12 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 207, + "g": 207, + "b": 207, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "2fhfYPV6ROg5kQ0npjJh+t" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "f9AFb9LfFBdqg7b8FD9OtW", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "地图预览图", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 15 + }, + { + "__id__": 17 + } + ], + "_prefab": { + "__id__": 19 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": -170.316, + "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__": 14 + }, + "_enabled": true, + "__prefab": { + "__id__": 16 + }, "_contentSize": { "__type__": "cc.Size", "width": 250, @@ -156,11 +431,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 2 + "__id__": 14 }, "_enabled": true, "__prefab": { - "__id__": 6 + "__id__": 18 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -220,17 +495,17 @@ "_active": true, "_components": [ { - "__id__": 9 + "__id__": 21 }, { - "__id__": 11 + "__id__": 23 }, { - "__id__": 13 + "__id__": 25 } ], "_prefab": { - "__id__": 15 + "__id__": 27 }, "_lpos": { "__type__": "cc.Vec3", @@ -267,11 +542,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 8 + "__id__": 20 }, "_enabled": true, "__prefab": { - "__id__": 10 + "__id__": 22 }, "_contentSize": { "__type__": "cc.Size", @@ -295,11 +570,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 8 + "__id__": 20 }, "_enabled": true, "__prefab": { - "__id__": 12 + "__id__": 24 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -340,11 +615,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 8 + "__id__": 20 }, "_enabled": true, "__prefab": { - "__id__": 14 + "__id__": 26 }, "_color": { "__type__": "cc.Color", @@ -385,17 +660,17 @@ "_active": true, "_components": [ { - "__id__": 17 + "__id__": 29 }, { - "__id__": 19 + "__id__": 31 }, { - "__id__": 21 + "__id__": 33 } ], "_prefab": { - "__id__": 23 + "__id__": 35 }, "_lpos": { "__type__": "cc.Vec3", @@ -432,11 +707,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 16 + "__id__": 28 }, "_enabled": true, "__prefab": { - "__id__": 18 + "__id__": 30 }, "_contentSize": { "__type__": "cc.Size", @@ -460,11 +735,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 16 + "__id__": 28 }, "_enabled": true, "__prefab": { - "__id__": 20 + "__id__": 32 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -505,11 +780,11 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 16 + "__id__": 28 }, "_enabled": true, "__prefab": { - "__id__": 22 + "__id__": 34 }, "_color": { "__type__": "cc.Color", @@ -548,7 +823,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 25 + "__id__": 37 }, "_contentSize": { "__type__": "cc.Size", @@ -566,51 +841,6 @@ "__type__": "cc.CompPrefabInfo", "fileId": "064LPbZPtBe5V4pSkcOeNl" }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 1 - }, - "_enabled": true, - "__prefab": { - "__id__": 27 - }, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 207, - "g": 207, - "b": 207, - "a": 255 - }, - "_spriteFrame": { - "__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941", - "__expectedType__": "cc.SpriteFrame" - }, - "_type": 0, - "_fillType": 0, - "_sizeMode": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_useGrayscale": false, - "_atlas": null, - "_id": "" - }, - { - "__type__": "cc.CompPrefabInfo", - "fileId": "4bN0ccDGROXZrqVJGdxUvp" - }, { "__type__": "e3050H//lFNtp/Jqvffj2ug", "_name": "", @@ -621,22 +851,25 @@ }, "_enabled": true, "__prefab": { - "__id__": 29 + "__id__": 39 }, "mapImage": { - "__id__": 5 + "__id__": 17 }, "mapName": { - "__id__": 11 + "__id__": 23 }, "mapText": { - "__id__": 19 + "__id__": 31 + }, + "selectNode": { + "__id__": 2 }, "_id": "" }, { "__type__": "cc.CompPrefabInfo", - "fileId": "b75RhaWlJOVbpbqITFkrle" + "fileId": "b6OKLKSjhEfoG7fZWOnH03" }, { "__type__": "cc.PrefabInfo", diff --git a/JisolGameCocos/assets/resources/prefab/ui/地图/地图选择页面.prefab b/JisolGameCocos/assets/resources/prefab/ui/地图/地图选择页面.prefab index 57a8f1d8..da4805e3 100644 --- a/JisolGameCocos/assets/resources/prefab/ui/地图/地图选择页面.prefab +++ b/JisolGameCocos/assets/resources/prefab/ui/地图/地图选择页面.prefab @@ -25,17 +25,17 @@ "_active": true, "_components": [ { - "__id__": 97 + "__id__": 98 }, { - "__id__": 99 + "__id__": 100 }, { - "__id__": 101 + "__id__": 102 } ], "_prefab": { - "__id__": 103 + "__id__": 104 }, "_lpos": { "__type__": "cc.Vec3", @@ -85,20 +85,20 @@ "_active": true, "_components": [ { - "__id__": 88 + "__id__": 89 }, { - "__id__": 90 + "__id__": 91 }, { - "__id__": 92 + "__id__": 93 }, { - "__id__": 94 + "__id__": 95 } ], "_prefab": { - "__id__": 96 + "__id__": 97 }, "_lpos": { "__type__": "cc.Vec3", @@ -1088,17 +1088,17 @@ "_active": true, "_components": [ { - "__id__": 81 + "__id__": 82 }, { - "__id__": 83 + "__id__": 84 }, { - "__id__": 85 + "__id__": 86 } ], "_prefab": { - "__id__": 87 + "__id__": 88 }, "_lpos": { "__type__": "cc.Vec3", @@ -1547,7 +1547,7 @@ } ], "_prefab": { - "__id__": 80 + "__id__": 81 }, "_lpos": { "__type__": "cc.Vec3", @@ -1828,7 +1828,11 @@ "__prefab": { "__id__": 79 }, - "clickEvents": [], + "clickEvents": [ + { + "__id__": 80 + } + ], "_interactable": true, "_transition": 2, "_normalColor": { @@ -1886,6 +1890,16 @@ "__type__": "cc.CompPrefabInfo", "fileId": "16iwUIB3FHjagBzGAl31Zl" }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 1 + }, + "component": "", + "_componentId": "dcbf1yBOUdKrpoRvRR2R1Cg", + "handler": "onClickConfirm", + "customEventData": "" + }, { "__type__": "cc.PrefabInfo", "root": { @@ -1909,7 +1923,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 82 + "__id__": 83 }, "_contentSize": { "__type__": "cc.Size", @@ -1937,7 +1951,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 84 + "__id__": 85 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -1982,7 +1996,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 86 + "__id__": 87 }, "_alignFlags": 44, "_target": null, @@ -2031,7 +2045,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 89 + "__id__": 90 }, "_contentSize": { "__type__": "cc.Size", @@ -2059,7 +2073,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 91 + "__id__": 92 }, "_customMaterial": null, "_srcBlendFactor": 2, @@ -2104,7 +2118,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 93 + "__id__": 94 }, "_id": "" }, @@ -2122,7 +2136,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 95 + "__id__": 96 }, "_alignFlags": 45, "_target": null, @@ -2171,7 +2185,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 98 + "__id__": 99 }, "_contentSize": { "__type__": "cc.Size", @@ -2199,7 +2213,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 100 + "__id__": 101 }, "_alignFlags": 45, "_target": null, @@ -2235,7 +2249,7 @@ }, "_enabled": true, "__prefab": { - "__id__": 102 + "__id__": 103 }, "mask": false, "maskOpcity": 80, diff --git a/JisolGameCocos/assets/script/App.ts b/JisolGameCocos/assets/script/App.ts index a571f3c1..c93ec116 100644 --- a/JisolGameCocos/assets/script/App.ts +++ b/JisolGameCocos/assets/script/App.ts @@ -26,10 +26,10 @@ import { JAPI, JAPIConfig } from "../../extensions/ngame/assets/ngame/util/JAPI" import { AppData } from "./AppData"; import AppAction from "./AppAction"; -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://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.113:8080` // let WsPath = `ws://192.168.0.113:8080/websocket` // let APIPath = `https://api.pet.jisol.cn` diff --git a/JisolGameCocos/assets/script/battle/base/common/map/GMapLoop.ts b/JisolGameCocos/assets/script/battle/base/common/map/GMapLoop.ts index 9686b665..fd8e3d44 100644 --- a/JisolGameCocos/assets/script/battle/base/common/map/GMapLoop.ts +++ b/JisolGameCocos/assets/script/battle/base/common/map/GMapLoop.ts @@ -38,6 +38,8 @@ export class GMapLoop extends JNGSyncBase<{}> { this.repeat = repeat; this.mapWidth = width || this.map.width; this.mapHeight = height || this.map.height; + this.node.destroyAllChildren(); + this.createMaps = new Map; } //更新地图(世界坐标X) diff --git a/JisolGameCocos/assets/script/battle/modes/GOnHookMode.ts b/JisolGameCocos/assets/script/battle/modes/GOnHookMode.ts index 29bcb84e..43d17a9d 100644 --- a/JisolGameCocos/assets/script/battle/modes/GOnHookMode.ts +++ b/JisolGameCocos/assets/script/battle/modes/GOnHookMode.ts @@ -21,10 +21,12 @@ import GRoleOnHookPlayerExpand from "../base/role/expand/OnHook/GRoleOnHookPlaye import PlayerPetData from "../../data/PlayerPetData"; import { GUI } from "../../ui/UIConfig"; import { GOnHookPet, GOnHookPets } from "../../../../extensions/ngame/assets/ngame/message/proto"; -import GOnHookManager from "../../manager/battle/mode/GOnHookManager"; +import GOnHookManager, { GOnHookManagerEvent } from "../../manager/battle/mode/GOnHookManager"; import GRoleOnHookCreepsExpand from "../base/role/expand/OnHook/GRoleOnHookCreepsExpand"; import { ModeRenderEvent } from "../../ui/Consts/Game/ModeRender"; import GPetAttribute from "../base/values/attribute/role/GPetAttribute"; +import GDefaultMode from "./default/GDefaultMode"; +import GOnHookData from "../../data/GOnHookData"; const { ccclass, property } = _decorator; //挂机模式状态 @@ -50,19 +52,11 @@ export interface GOnHookInfo{ * 挂机模式 无限出现小怪 (不是联机模式 该模式支持使用本地数据 和 API) */ @ccclass('GOnHookMode') -export default class GOnHookMode extends GBaseMode<{},{}>{ +export default class GOnHookMode extends GDefaultMode<{},{}>{ @property(Prefab) rolePrefab: Prefab = null; - //场景地图 - @property(GMapLoop) - map1:GMapLoop; - @property(GMapLoop) - map2:GMapLoop; - @property(GMapLoop) - map3:GMapLoop; - @property(Node) objects: Node = null; @@ -84,9 +78,6 @@ export default class GOnHookMode extends GBaseMode<{},{}>{ playerRoles: GRoleDefault[] = []; //敌方宠物 enemyRoles: GRoleDefault[] = []; - - //地图信息 - mapInfo:TB.TbGMap; //每一波怪的距离 everyX:number = 600; @@ -109,11 +100,13 @@ export default class GOnHookMode extends GBaseMode<{},{}>{ //添加监听事件 addEvent(){ app.event.on(PlayerTacticalEvent.UPDATE_TACTICAL,this.onUpdatePlayerPet,this); + app.event.on(GOnHookManagerEvent.UPDATE_MAP,this.onUpdateWorld,this); } //移除监听事件 onDestroy(){ super.onDestroy(); app.event.off(PlayerTacticalEvent.UPDATE_TACTICAL,this.onUpdatePlayerPet,this); + app.event.off(GOnHookManagerEvent.UPDATE_MAP,this.onUpdateWorld,this); } onSyncInitSuccess():void{ @@ -128,15 +121,8 @@ export default class GOnHookMode extends GBaseMode<{},{}>{ //初始化状态机 this.fsm = new GFSMOnHookMode(this); - //初始化地图 - this.mapInfo = TD.TbGMap.get(60001); - - let scale = this.mapInfo.scale; - - this.map1.init(app.battleRes.maps[60001][0],1,app.battleRes.maps[60001][0].width * scale,app.battleRes.maps[60001][0].height * scale); - this.map2.init(app.battleRes.maps[60001][1],1,app.battleRes.maps[60001][1].width * scale,app.battleRes.maps[60001][1].height * scale); - this.map3.init(app.battleRes.maps[60001][2],1,app.battleRes.maps[60001][1].width * scale,1048 * scale); - this.onUpdateMap(0); + //更新场景 + this.onUpdateWorld(); this.playerInfo = { tactical: GTactical.getTactical().setOffset(this.playerPos) }; this.enemyInfo = { tactical: GTactical.getTactical(true).setOffset(this.enemyPos) }; @@ -161,6 +147,17 @@ export default class GOnHookMode extends GBaseMode<{},{}>{ // this.onResetGenerateEnemy(); } + + //更新地图 + onUpdateWorld(){ + let info = TD.TbGOnHookMaps.get(GOnHookData.getIns().info.onHookMap); + this.setWorldMap(info.mapId) + } + + //更新页面 + onUpdateView(){ + + } //更新玩家宠物 onUpdatePlayerPet(){ @@ -195,14 +192,6 @@ export default class GOnHookMode extends GBaseMode<{},{}>{ this.fsm.onUpdate(dt,frame); } - //更新地图 - onUpdateMap(dt){ - let cameraX = this.camera.node.worldPosition.x; - this.map1.UpdateMap(cameraX,0,this.mapInfo.map1OffsetY); - this.map2.UpdateMap(cameraX,cameraX / 10,this.mapInfo.map2OffsetY); - this.map3.UpdateMap(cameraX,0,this.mapInfo.map3OffsetY); - } - //更新相机逻辑 onUpdateCamera(dt:number){ diff --git a/JisolGameCocos/assets/script/battle/modes/default.meta b/JisolGameCocos/assets/script/battle/modes/default.meta new file mode 100644 index 00000000..1ef4b24a --- /dev/null +++ b/JisolGameCocos/assets/script/battle/modes/default.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "9b681679-8251-4587-86de-226eb77202f3", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/JisolGameCocos/assets/script/battle/modes/default/GDefaultMode.ts b/JisolGameCocos/assets/script/battle/modes/default/GDefaultMode.ts new file mode 100644 index 00000000..6fe1f8d6 --- /dev/null +++ b/JisolGameCocos/assets/script/battle/modes/default/GDefaultMode.ts @@ -0,0 +1,45 @@ +import { _decorator } from "cc"; +import GBaseMode from "../../GBaseMode"; +import { GMapLoop } from "../../base/common/map/GMapLoop"; +import { TD, app } from "../../../App"; +import { TB } from "../../../../resources/config/data/schema"; +const { ccclass, property } = _decorator; + +export default class GDefaultMode extends GBaseMode{ + + //场景地图 + @property(GMapLoop) + map1:GMapLoop; + @property(GMapLoop) + map2:GMapLoop; + @property(GMapLoop) + map3:GMapLoop; + + //地图信息 + mapInfo:TB.TbGMap; + + //设置世界地图 + setWorldMap(mapId:number = 60001){ + + //初始化地图 + this.mapInfo = TD.TbGMap.get(mapId); + + let scale = this.mapInfo.scale; + this.map1.init(app.battleRes.maps[mapId][0],1,app.battleRes.maps[mapId][0].width * scale,app.battleRes.maps[mapId][0].height * scale); + this.map2.init(app.battleRes.maps[mapId][1],1,app.battleRes.maps[mapId][1].width * scale,app.battleRes.maps[mapId][1].height * scale); + this.map3.init(app.battleRes.maps[mapId][2],1,app.battleRes.maps[mapId][1].width * scale,1048 * scale); + + //更新地图 + this.onUpdateMap(0); + + } + + //更新地图 + onUpdateMap(dt){ + let cameraX = this.camera.node.worldPosition.x; + this.map1.UpdateMap(cameraX,0,this.mapInfo.map1OffsetY); + this.map2.UpdateMap(cameraX,cameraX / 10,this.mapInfo.map2OffsetY); + this.map3.UpdateMap(cameraX,0,this.mapInfo.map3OffsetY); + } + +} \ No newline at end of file diff --git a/JisolGameCocos/assets/script/battle/modes/default/GDefaultMode.ts.meta b/JisolGameCocos/assets/script/battle/modes/default/GDefaultMode.ts.meta new file mode 100644 index 00000000..2918b80f --- /dev/null +++ b/JisolGameCocos/assets/script/battle/modes/default/GDefaultMode.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.23", + "importer": "typescript", + "imported": true, + "uuid": "5dd657bf-b55d-410c-a850-36893d6c6369", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/JisolGameCocos/assets/script/consts/GAPI.ts b/JisolGameCocos/assets/script/consts/GAPI.ts index 9ebb690c..d31f4131 100644 --- a/JisolGameCocos/assets/script/consts/GAPI.ts +++ b/JisolGameCocos/assets/script/consts/GAPI.ts @@ -15,6 +15,8 @@ export const GAPI = { /************** 无限模式接口 ********************/ //获取模式信息 GOnHookInfo : async () => RData(await app.api.get(`/game/mode/onHook/info`)) 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'}),GActionType.GOnHookPets) as GOnHookPets, //捕捉野怪 diff --git a/JisolGameCocos/assets/script/data/GOnHookData.ts b/JisolGameCocos/assets/script/data/GOnHookData.ts index 0632c227..a755ddaa 100644 --- a/JisolGameCocos/assets/script/data/GOnHookData.ts +++ b/JisolGameCocos/assets/script/data/GOnHookData.ts @@ -1,4 +1,7 @@ +import { app } from "../App"; +import { API } from "../consts/API"; import { GAPI, ModeOnHookOV } from "../consts/GAPI"; +import { GUI } from "../ui/UIConfig"; import BaseData from "./BaseData"; //无限模式数据类 @@ -11,5 +14,13 @@ export default class GOnHookData extends BaseData{ console.log("GOnHookData Info",this.info); } + //切换地图 + async setMap(mapId:number){ + + this.info = await GAPI.GOnHookSetMap(mapId); + app.layer.Open(GUI.Tips,{text:"切换地图成功"}); + + } + } diff --git a/JisolGameCocos/assets/script/manager/battle/mode/GOnHookManager.ts b/JisolGameCocos/assets/script/manager/battle/mode/GOnHookManager.ts index bbf42f5b..77babbff 100644 --- a/JisolGameCocos/assets/script/manager/battle/mode/GOnHookManager.ts +++ b/JisolGameCocos/assets/script/manager/battle/mode/GOnHookManager.ts @@ -3,6 +3,7 @@ import Singleton from "../../../../../extensions/ngame/assets/ngame/util/Singlet import { app } from "../../../App"; import { PlayerPetOV } from "../../../consts/API"; import { GAPI } from "../../../consts/GAPI"; +import GOnHookData from "../../../data/GOnHookData"; import PlayerPetData from "../../../data/PlayerPetData"; import { GUI } from "../../../ui/UIConfig"; @@ -10,7 +11,9 @@ export enum GOnHookManagerEvent{ //添加死亡野怪 ADD_KILL_SREEP = "GOnHookManagerEvent_ADD_KILL_SREEP", //删除死亡野怪 - DEL_KILL_SREEP = "GOnHookManagerEvent_DEL_KILL_SREEP" + DEL_KILL_SREEP = "GOnHookManagerEvent_DEL_KILL_SREEP", + //删除死亡野怪 + UPDATE_MAP = "GOnHookManagerEvent_UPDATE_MAP" } //游戏模式 OnHook 管理器 @@ -116,6 +119,17 @@ export default class GOnHookManager extends Singleton{ return await GAPI.GOnHookSellCreeps(creeps.key); } + //切换场景 + async setMap(mapId:number){ + + await GOnHookData.getIns().setMap(mapId); + + //通知地图已切换 + app.event.emit(GOnHookManagerEvent.UPDATE_MAP); + + } + + } diff --git a/JisolGameCocos/assets/script/ui/Map/MapSelectShowItem.ts b/JisolGameCocos/assets/script/ui/Map/MapSelectShowItem.ts index eff4e216..24dbc2ec 100644 --- a/JisolGameCocos/assets/script/ui/Map/MapSelectShowItem.ts +++ b/JisolGameCocos/assets/script/ui/Map/MapSelectShowItem.ts @@ -18,6 +18,12 @@ export class MapSelectShowItem extends JNScrollViewItem { @property({type:Label,displayName:"地图介绍"}) mapText:Label; + @property({type:Node,displayName:"选中图片"}) + selectNode:Node; + + //是否选择 + isSelect:boolean = false; + onInit(data: TB.TbGOnHookMaps): void { this.onUpdateView(); @@ -29,10 +35,13 @@ export class MapSelectShowItem extends JNScrollViewItem { this.mapName.string = this.data.name; this.mapText.string = this.data.introduce; + this.selectNode.active = !!this.isSelect; //加载预览图 TbResource.loadSpriteFrame(this.data.mapImage,this.mapImage,this); + + } } diff --git a/JisolGameCocos/assets/script/ui/Map/MapSelectView.ts b/JisolGameCocos/assets/script/ui/Map/MapSelectView.ts index 9d2a653f..8c22e07d 100644 --- a/JisolGameCocos/assets/script/ui/Map/MapSelectView.ts +++ b/JisolGameCocos/assets/script/ui/Map/MapSelectView.ts @@ -1,7 +1,12 @@ import { _decorator, Component, Node } from 'cc'; import JNLayerBase from '../../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase'; import JNScrollView from '../../../../extensions/ngame/assets/ngame/util/components/scrollview/JNScrollView'; -import { TD } from '../../App'; +import { app, TD } from '../../App'; +import GOnHookData from '../../data/GOnHookData'; +import { TbGOnHookMaps } from '../../../resources/config/data/schema'; +import { MapSelectShowItem } from './MapSelectShowItem'; +import { NodeEventType } from 'cc'; +import GOnHookManager from '../../manager/battle/mode/GOnHookManager'; const { ccclass, property } = _decorator; @ccclass('MapSelectView') @@ -11,13 +16,53 @@ export class MapSelectView extends JNLayerBase { @property(JNScrollView) views:JNScrollView; + //当前地图下标 + index:number = -1; + onJNLoad(data?: any): void { super.onJNLoad(data); + TD.TbGOnHookMaps.getDataList().forEach((item,index) => { + if(GOnHookData.getIns().info.onHookMap == item.id){ + this.index = index; + } + }) + this.views.refreshData(TD.TbGOnHookMaps.getDataList()) + + let items = this.views.getItems(); + + //向子节点添加点击事件 + this.views.addItemEvent(NodeEventType.TOUCH_START,this.onClickItem.bind(this)); + + items[this.index].isSelect = true; + items[this.index].onUpdateView(); } + //点击地图 + onClickItem(index:number){ + let items = this.views.getItems(); + + items.forEach(item => { + item.isSelect = false; + }) + this.index = index; + items[this.index].isSelect = true; + this.views.getItems().forEach(item => item.onUpdateView()) + + } + + //点击确认 + async onClickConfirm(){ + + await GOnHookManager.getIns().setMap(this.views.getItems()[this.index].data.id); + + //关闭页面 + app.layer.CloseNode(this.node); + + } + } diff --git a/JisolGameCocos/assets/tbresource/ui/map/魔法镇_图片.png b/JisolGameCocos/assets/tbresource/ui/map/魔法镇_图片.png new file mode 100644 index 00000000..fb3b2552 Binary files /dev/null and b/JisolGameCocos/assets/tbresource/ui/map/魔法镇_图片.png differ diff --git a/JisolGameCocos/assets/tbresource/ui/map/魔法镇_图片.png.meta b/JisolGameCocos/assets/tbresource/ui/map/魔法镇_图片.png.meta new file mode 100644 index 00000000..bcefb141 --- /dev/null +++ b/JisolGameCocos/assets/tbresource/ui/map/魔法镇_图片.png.meta @@ -0,0 +1,134 @@ +{ + "ver": "1.0.26", + "importer": "image", + "imported": true, + "uuid": "46d74c0b-4553-4dd9-8106-98486c13bb56", + "files": [ + ".json", + ".png" + ], + "subMetas": { + "6c48a": { + "importer": "texture", + "uuid": "46d74c0b-4553-4dd9-8106-98486c13bb56@6c48a", + "displayName": "魔法镇_图片", + "id": "6c48a", + "name": "texture", + "userData": { + "wrapModeS": "clamp-to-edge", + "wrapModeT": "clamp-to-edge", + "imageUuidOrDatabaseUri": "46d74c0b-4553-4dd9-8106-98486c13bb56", + "isUuid": true, + "visible": false, + "minfilter": "linear", + "magfilter": "linear", + "mipfilter": "none", + "anisotropy": 0 + }, + "ver": "1.0.22", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + }, + "f9941": { + "importer": "sprite-frame", + "uuid": "46d74c0b-4553-4dd9-8106-98486c13bb56@f9941", + "displayName": "魔法镇_图片", + "id": "f9941", + "name": "spriteFrame", + "userData": { + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 0, + "trimX": 0, + "trimY": 0, + "width": 758, + "height": 519, + "rawWidth": 758, + "rawHeight": 519, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "packable": true, + "pixelsToUnit": 100, + "pivotX": 0.5, + "pivotY": 0.5, + "meshType": 0, + "vertices": { + "rawPosition": [ + -379, + -259.5, + 0, + 379, + -259.5, + 0, + -379, + 259.5, + 0, + 379, + 259.5, + 0 + ], + "indexes": [ + 0, + 1, + 2, + 2, + 1, + 3 + ], + "uv": [ + 0, + 519, + 758, + 519, + 0, + 0, + 758, + 0 + ], + "nuv": [ + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1 + ], + "minPos": [ + -379, + -259.5, + 0 + ], + "maxPos": [ + 379, + 259.5, + 0 + ] + }, + "isUuid": true, + "imageUuidOrDatabaseUri": "46d74c0b-4553-4dd9-8106-98486c13bb56@6c48a", + "atlasUuid": "" + }, + "ver": "1.0.12", + "imported": true, + "files": [ + ".json" + ], + "subMetas": {} + } + }, + "userData": { + "type": "sprite-frame", + "hasAlpha": false, + "fixAlphaTransparencyArtifacts": false, + "redirect": "46d74c0b-4553-4dd9-8106-98486c13bb56@f9941" + } +} diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/mode/GOnHookController.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/mode/GOnHookController.java index b1aa41db..ae262c6d 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/mode/GOnHookController.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/mode/GOnHookController.java @@ -78,6 +78,20 @@ public class GOnHookController { } + //切换地图 + @ApiImplicitParams({}) + @ApiOperation(value = "切换地图") + @PostMapping("/setMapId/{mapId}") + public NewsContext setMapId(@CurrentPlayer Player player,@PathVariable Integer mapId){ + //判断是否有这个地图 + TbGOnHookMaps map = TD.DATA.getTbGOnHookMaps().get(mapId); + if (Objects.isNull(map)) NewsContext.onFail("切换地图失败 没有这个地图哦"); + ModeOnHook data = this.getInfo(player).data; + data.setOnHookMap(mapId); + modeOnHookService.saveOrUpdate(data); + return NewsContext.onSuccess("成功",data); + } + //生成野怪 @ApiImplicitParams({}) @ApiOperation(value = "生成野怪") 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 809393ea..53913166 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 @@ -26,7 +26,6 @@ public class ResourceServiceImpl extends ServiceImpl i * @return */ @Override - @Retryable(RetryException.class) public Resource addResourceValue(Long playerId, int type, Long value) { diff --git a/JisolGameServer/Main/src/main/resources/json/tbgonhookmaps.json b/JisolGameServer/Main/src/main/resources/json/tbgonhookmaps.json index 2b21c7d8..953dd292 100644 --- a/JisolGameServer/Main/src/main/resources/json/tbgonhookmaps.json +++ b/JisolGameServer/Main/src/main/resources/json/tbgonhookmaps.json @@ -15,7 +15,7 @@ { "id": 120002, "name": "魔法镇", - "mapImage": "ui/map/天空城_图片/spriteFrame", + "mapImage": "ui/map/魔法镇_图片/spriteFrame", "mapId": 60002, "petIds": [ 10003,