xhb il y a 2 mois
Parent
commit
21968ec1b5
1 fichiers modifiés avec 14 ajouts et 0 suppressions
  1. 14 0
      incubator-game/src/main/java/com/incubator/game/room/Room.java

+ 14 - 0
incubator-game/src/main/java/com/incubator/game/room/Room.java

@@ -1,14 +1,21 @@
 package com.incubator.game.room;
 
+import cn.hutool.json.JSONException;
 import com.alibaba.fastjson2.JSONObject;
 import com.incubator.common.log4j.Log;
 import com.incubator.core.room.GRoomInterface;
 import com.incubator.game.constant.RedisKeyConstant;
+import com.incubator.game.contest.Contest;
+import com.incubator.game.contest.ContestService;
+import com.incubator.game.data.entity.ZjUserInfolog;
 import com.incubator.game.data.jedis.RedisUtil;
 import com.incubator.game.data.po.RoomPO;
 import com.incubator.game.player.Player;
 import com.incubator.game.util.GDUtils;
+import com.incubator.game.util.SendGameInfoUtil;
 
+import java.math.BigDecimal;
+import java.util.Date;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.Executors;
@@ -112,6 +119,13 @@ public class Room implements GRoomInterface {
     public void destroy() {
         Log.info("Room {} has been destroyed.", this.data.roomId);
         this.isActive = false;
+        try {
+            cn.hutool.json.JSONObject object = new cn.hutool.json.JSONObject();
+            object.put("type","gameOver");
+            SendGameInfoUtil.sendGameInfo(object);
+        } catch (JSONException e) {
+            Log.error("向后台发送结算信息出错...{}", e);
+        }
         this.scheduler.shutdownNow();
         this.scheduler = null;
         // 从缓存移除