Search in sources :

Example 1 with RobotManager

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);
}
Also used : RobotManager(com.code.server.game.poker.robot.RobotManager) ServerConfig(com.code.server.game.poker.config.ServerConfig) CowRobot(com.code.server.game.poker.cow.CowRobot) DouDiZhuGoldRobot(com.code.server.game.poker.doudizhu.DouDiZhuGoldRobot) TTZRobot(com.code.server.game.poker.tuitongzi.TTZRobot) TimerNode(com.code.server.util.timer.TimerNode)

Aggregations

ServerConfig (com.code.server.game.poker.config.ServerConfig)1 CowRobot (com.code.server.game.poker.cow.CowRobot)1 DouDiZhuGoldRobot (com.code.server.game.poker.doudizhu.DouDiZhuGoldRobot)1 RobotManager (com.code.server.game.poker.robot.RobotManager)1 TTZRobot (com.code.server.game.poker.tuitongzi.TTZRobot)1 TimerNode (com.code.server.util.timer.TimerNode)1