|
@@ -1,5 +1,6 @@
|
|
|
package com.incubator.game.handler.room;
|
|
|
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.incubator.common.MessageHandler;
|
|
|
import com.incubator.common.net.Connection;
|
|
|
import com.incubator.core.net.ws.NetHandler;
|
|
@@ -33,14 +34,28 @@ public class CreatRoomHandler extends NetHandler {
|
|
|
}
|
|
|
|
|
|
// 判断参数
|
|
|
- int type = request.getDataValue("type", Integer.class, 0);
|
|
|
- if (type <= 0) {
|
|
|
+ int[] type = request.getDataValue("type", int[].class, new int[]{});
|
|
|
+ if (type.length != 11) {
|
|
|
logger.info("参数错误");
|
|
|
response.setCode(CommonProto.Code.PARAMETER_ERR_VALUE);
|
|
|
response.setMessage("参数错误");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ // 解析规则
|
|
|
+ JSONObject jsonData = new JSONObject();
|
|
|
+ jsonData.put("gameType", type[0]);
|
|
|
+ jsonData.put("playingTypeOne", type[1]);
|
|
|
+ jsonData.put("playingTypeTwo", type[2]);
|
|
|
+ jsonData.put("upgradeType", type[3]);
|
|
|
+ jsonData.put("flippingType", type[4]);
|
|
|
+ jsonData.put("advanceType", type[5]);
|
|
|
+ jsonData.put("timeoutType", type[6]);
|
|
|
+ jsonData.put("voiceType", type[7]);
|
|
|
+ jsonData.put("recordType", type[8]);
|
|
|
+ jsonData.put("watchType", type[9]);
|
|
|
+ jsonData.put("PlayerNum", type[10]);
|
|
|
+
|
|
|
// 玩家是否存在房间
|
|
|
Room room = RoomService.getInstance().getRoomByPlayerId(player.getId());
|
|
|
if (room != null) {
|
|
@@ -51,7 +66,7 @@ public class CreatRoomHandler extends NetHandler {
|
|
|
}
|
|
|
|
|
|
// 创建房间
|
|
|
- room = RoomService.getInstance().creatRoom(player, type);
|
|
|
+ room = RoomService.getInstance().creatRoom(player, jsonData.getInteger("gameType"), jsonData);
|
|
|
|
|
|
if (room == null) {
|
|
|
logger.info("系统错误");
|