diff --git a/backendcloud/backend/src/main/java/com/kob/backend/consumer/WebSocketServer.java b/backendcloud/backend/src/main/java/com/kob/backend/consumer/WebSocketServer.java index cfc443e..83a05dd 100644 --- a/backendcloud/backend/src/main/java/com/kob/backend/consumer/WebSocketServer.java +++ b/backendcloud/backend/src/main/java/com/kob/backend/consumer/WebSocketServer.java @@ -3,13 +3,13 @@ package com.kob.backend.consumer; // WebSocket用于前后端通信 import com.alibaba.fastjson2.JSONObject; +import com.kob.backend.config.MapSizeConfig; import com.kob.backend.consumer.utils.Game; import com.kob.backend.consumer.utils.JwtAuthenticationUtil; import com.kob.backend.mapper.BotMapper; import com.kob.backend.mapper.RecordMapper; import com.kob.backend.mapper.UserMapper; import com.kob.backend.pojo.Bot; -import com.kob.backend.pojo.Record; import com.kob.backend.pojo.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -119,9 +119,9 @@ public class WebSocketServer { // 匹配成功时,创建联机地图 Game game = new Game( - 13, - 14, - 20, + MapSizeConfig.rows, + MapSizeConfig.cols, + MapSizeConfig.inner_walls_count, a.getId(), botA, b.getId(), diff --git a/backendcloud/backend/src/main/java/com/kob/backend/consumer/utils/Game.java b/backendcloud/backend/src/main/java/com/kob/backend/consumer/utils/Game.java index f83b960..a3e853d 100644 --- a/backendcloud/backend/src/main/java/com/kob/backend/consumer/utils/Game.java +++ b/backendcloud/backend/src/main/java/com/kob/backend/consumer/utils/Game.java @@ -1,6 +1,7 @@ package com.kob.backend.consumer.utils; import com.alibaba.fastjson2.JSONObject; +import com.kob.backend.config.MapSizeConfig; import com.kob.backend.consumer.WebSocketServer; import com.kob.backend.pojo.Bot; import com.kob.backend.pojo.Record; @@ -392,6 +393,9 @@ public class Game extends Thread { playerA.getStepsString(), playerB.getStepsString(), getGameMapString(), + MapSizeConfig.rows, + MapSizeConfig.cols, + MapSizeConfig.inner_walls_count, loser, new Date() ); diff --git a/backendcloud/backend/src/main/java/com/kob/backend/pojo/Record.java b/backendcloud/backend/src/main/java/com/kob/backend/pojo/Record.java index dd00e62..82bcebc 100644 --- a/backendcloud/backend/src/main/java/com/kob/backend/pojo/Record.java +++ b/backendcloud/backend/src/main/java/com/kob/backend/pojo/Record.java @@ -27,6 +27,9 @@ public class Record { private String aSteps; private String bSteps; private String map; + private Integer mapRows; + private Integer mapCols; + private Integer innerWallsCount; private String loser; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")