Browse Source

开始游戏

master
6 years ago
parent
commit
22fe6d0ee3
  1. 9
      game/src/main/java/com/ccsens/game/service/ScreenService.java
  2. 4
      game/src/main/resources/application.yml

9
game/src/main/java/com/ccsens/game/service/ScreenService.java

@ -428,19 +428,16 @@ public class ScreenService implements IScreenService{
long endSend = gameRecord.getEndTime() - System.currentTimeMillis();
System.out.println("开始延时:" + startSend + ",结束延时:" + endSend);
System.out.println("发送开始时间" + new Date());
// delayProducer.sendDelayMessage(json.toJSONString(), startSend > 0 ? startSend : 0);
// JSONObject json2 = new JSONObject();
// json2.put("name", "修改游戏结束状态");
// delayProducer2.sendDelayMessage(json2.toJSONString(), endSend > 0 ? endSend : 0);
ScheduledExecutorService executor = Executors.newScheduledThreadPool(10);
//更新开始状态
sendMsg.sendMsg(executor, startSend, () -> {
gameRecord.setGameStatus(GameConstant.GAME_PREPARATION);
System.out.println(GameConstant.GAME_PREPARATION + "start: "+new Date());
gameRecord.setGameStatus(GameConstant.GAME_PROCESSING);
gameRecordDao.updateByPrimaryKeySelective(gameRecord);
});
//更新结束状态
sendMsg.sendMsg(executor, endSend, () -> {
System.out.println(GameConstant.GAME_COMPLETED + "end: "+new Date());
gameRecord.setGameStatus(GameConstant.GAME_COMPLETED);
gameRecordDao.updateByPrimaryKeySelective(gameRecord);
});

4
game/src/main/resources/application.yml

@ -1,4 +1,4 @@
spring:
profiles:
active: test
include: common, util-test
active: dev
include: common, util-dev
Loading…
Cancel
Save