|
@@ -3,11 +3,13 @@ package com.incubator.game.listener;
|
|
|
import com.incubator.core.net.ws.*;
|
|
|
import com.incubator.game.GGame;
|
|
|
import com.incubator.common.net.Connection;
|
|
|
-import com.incubator.message.GameRegMsg;
|
|
|
import com.incubator.message.proto.CommonProto;
|
|
|
import com.incubator.core.net.handler.listener.GameClientConnectionListener;
|
|
|
import io.netty.buffer.ByteBuf;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
/**
|
|
|
* 中控服消息
|
|
|
* @author johnc
|
|
@@ -19,17 +21,14 @@ public class CenterClientListener extends GameClientConnectionListener {
|
|
|
public void connectionOpened(Connection conn) {
|
|
|
logger.info("中控服链路打开发送注册,注册码:{}", CommonProto.Cmd.S2S_GAME_REG_VALUE);
|
|
|
try {
|
|
|
- GameRegMsg.GameRegG2C gameRegG2C = new GameRegMsg.GameRegG2C();
|
|
|
- gameRegG2C.setServerId(GGame.SERVER_ID);
|
|
|
- gameRegG2C.setHost(GGame.BIND_HOST);
|
|
|
- gameRegG2C.setPort(GGame.BIND_PORT);
|
|
|
-// Message msg = new Message(ProtoCommon.MsgId.S2S_GAME_REG, gameRegG2C.toJson());
|
|
|
-// conn.writeAndFlush(super.packMessage(msg));
|
|
|
+ Map<String, Object> data = new HashMap<>();
|
|
|
+ data.put("serverId", GGame.SERVER_ID);
|
|
|
+ data.put("host", GGame.BIND_HOST);
|
|
|
+ data.put("port", GGame.BIND_PORT);
|
|
|
+ conn.writeAndFlush(new WSResponse(CommonProto.Cmd.S2S_GAME_REG, data).toBytes());
|
|
|
} catch (Exception e) {
|
|
|
logger.info("游戏服注册出错:{}", e.getMessage());
|
|
|
}
|
|
|
-
|
|
|
-// conn.writeAndFlush(new TextWebSocketFrame(msg.toJson()));
|
|
|
}
|
|
|
|
|
|
@Override
|