use of com.code.server.game.poker.robot.RobotManager in project summer by foxsugar.
the class PokerApplication method main.
public static void main(String[] args) throws RegisterFailedException, IOException {
SpringApplication.run(PokerApplication.class, args);
ServerConfig serverConfig = SpringUtil.getBean(ServerConfig.class);
// 加载数据
DataManager.initData(serverConfig.getDataFile());
// 注册
RedisManager.getGameRedisService().register(serverConfig.getServerType(), serverConfig.getServerId());
// timer
ThreadPool.execute(GameTimer.getInstance()::fire);
// 心跳
GameTimer.addTimerNode(new TimerNode(System.currentTimeMillis(), IConstant.SECOND_5, true, () -> RedisManager.getGameRedisService().heart(serverConfig.getServerId())));
// 机器人线程
RobotManager robotManager = RobotManager.getInstance();
// 添加斗地主的机器人
robotManager.addRobot(new DouDiZhuGoldRobot());
robotManager.addRobot(new CowRobot());
robotManager.addRobot(new TTZRobot());
ThreadPool.getInstance().executor.execute(robotManager);
// MsgConsumer.startAConsumer("gameService", serverConfig.getServerId(), MsgDispatch::dispatch);
// MsgConsumer.startAConsumer("reconnService", serverConfig.getServerId(), MsgDispatch::dispatch);
// MsgConsumer.startAConsumer("pokerRoomService", serverConfig.getServerId(), MsgDispatch::dispatch);
// MsgConsumer.startAConsumer("roomService", serverConfig.getServerId(), RoomMsgDispatch::dispatch);
}
Aggregations