From 5d28c29f4110fe808469ad488a4ccfbb97481907 Mon Sep 17 00:00:00 2001 From: flykhan Date: Fri, 10 Mar 2023 17:03:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86=E5=9C=B0=E5=9B=BE=E7=9A=84=E5=B0=BA?= =?UTF-8?q?=E5=AF=B8=E5=92=8C=E9=9A=9C=E7=A2=8D=E7=89=A9=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E5=AD=98=E5=85=A5Record=E6=95=B0=E6=8D=AE=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/kob/backend/consumer/WebSocketServer.java | 8 ++++---- .../main/java/com/kob/backend/consumer/utils/Game.java | 4 ++++ .../src/main/java/com/kob/backend/pojo/Record.java | 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) 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")