|
@@ -332,18 +332,15 @@ public class Contest {
|
|
* 根据玩家实时人数,动态分配比赛桌子
|
|
* 根据玩家实时人数,动态分配比赛桌子
|
|
*/
|
|
*/
|
|
public synchronized void allocateRooms() {
|
|
public synchronized void allocateRooms() {
|
|
|
|
+ // 房间最大局数 分为预赛和决赛
|
|
|
|
+ if (this.waitingPlayers.size() <= 4) {//决赛
|
|
|
|
+ this.prop.maxRound = this.prop.finalNum;
|
|
|
|
+ } else {
|
|
|
|
+ this.prop.maxRound = this.prop.readyNum;
|
|
|
|
+ }
|
|
while (this.waitingPlayers.size() >= roomCapacity) {
|
|
while (this.waitingPlayers.size() >= roomCapacity) {
|
|
// 玩家匹配,分配房间
|
|
// 玩家匹配,分配房间
|
|
JSONObject jsonData = new JSONObject();
|
|
JSONObject jsonData = new JSONObject();
|
|
-// jsonData.put("playingTypeOne", 2);
|
|
|
|
-// jsonData.put("playingTypeTwo", 1);
|
|
|
|
-// jsonData.put("upgradeType", 1);
|
|
|
|
-// jsonData.put("flippingType", 2);
|
|
|
|
-// jsonData.put("advanceType", 2);
|
|
|
|
-// jsonData.put("timeoutType", 1);
|
|
|
|
-// jsonData.put("voiceType", 2);
|
|
|
|
-// jsonData.put("recordType", 2);
|
|
|
|
-// jsonData.put("watchType", 4);
|
|
|
|
cn.hutool.json.JSONObject rule = this.prop.rule;
|
|
cn.hutool.json.JSONObject rule = this.prop.rule;
|
|
jsonData.put("upgradeType", rule.get("upgradeType"));
|
|
jsonData.put("upgradeType", rule.get("upgradeType"));
|
|
jsonData.put("flippingType", rule.get("flippingType"));
|
|
jsonData.put("flippingType", rule.get("flippingType"));
|
|
@@ -357,7 +354,8 @@ public class Contest {
|
|
Integer doublingType =(Integer) (rule.get("doublingType") == null ? 0 : rule.get("doublingType"));
|
|
Integer doublingType =(Integer) (rule.get("doublingType") == null ? 0 : rule.get("doublingType"));
|
|
doublingType = setDoublingType(doublingType);
|
|
doublingType = setDoublingType(doublingType);
|
|
jsonData.put("dv", doublingType);
|
|
jsonData.put("dv", doublingType);
|
|
- jsonData.put("team", rule.get("teamType")==null?0:rule.get("teamType"));
|
|
|
|
|
|
+// jsonData.put("team", rule.get("teamType")==null?0:rule.get("teamType"));
|
|
|
|
+ jsonData.put("team",0);
|
|
// 房间id
|
|
// 房间id
|
|
jsonData.put("roomId", RoomService.getInstance().randomRoomIdByContest());
|
|
jsonData.put("roomId", RoomService.getInstance().randomRoomIdByContest());
|
|
// 人数模式 2:2人 4:4人
|
|
// 人数模式 2:2人 4:4人
|
|
@@ -368,12 +366,6 @@ public class Contest {
|
|
// 玩法1 1:连续打,2:按局数,3:按时间
|
|
// 玩法1 1:连续打,2:按局数,3:按时间
|
|
jsonData.put("mode", playingTypeOne);
|
|
jsonData.put("mode", playingTypeOne);
|
|
if (playingTypeOne==2){ //按局数
|
|
if (playingTypeOne==2){ //按局数
|
|
- // 房间最大局数 分为预赛和决赛
|
|
|
|
- if (this.waitingPlayers.size() <= 4) {//决赛
|
|
|
|
- this.prop.maxRound = this.prop.finalNum;
|
|
|
|
- } else {
|
|
|
|
- this.prop.maxRound = this.prop.readyNum;
|
|
|
|
- }
|
|
|
|
jsonData.put("modev", this.prop.maxRound);
|
|
jsonData.put("modev", this.prop.maxRound);
|
|
}else {//按时间
|
|
}else {//按时间
|
|
// * 4:4局 6:6局 8:8局 10:10局
|
|
// * 4:4局 6:6局 8:8局 10:10局
|
|
@@ -611,6 +603,8 @@ public class Contest {
|
|
Player tmPlayer = this.actors.getOrDefault(settlementData.playerId, null);
|
|
Player tmPlayer = this.actors.getOrDefault(settlementData.playerId, null);
|
|
if (tmPlayer != null) {
|
|
if (tmPlayer != null) {
|
|
list.add(new Struct.PromotionData(tmPlayer.getId(), tmPlayer.data.avatarUrl,tmPlayer.data.name , settlementData.score,i,this.rooms.size() == 1));
|
|
list.add(new Struct.PromotionData(tmPlayer.getId(), tmPlayer.data.avatarUrl,tmPlayer.data.name , settlementData.score,i,this.rooms.size() == 1));
|
|
|
|
+ tmPlayer.data.matchPoints = settlementData.score;
|
|
|
|
+ tmPlayer.data.accumulatedPoints = 10000;
|
|
objects.add(tmPlayer);
|
|
objects.add(tmPlayer);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -619,7 +613,7 @@ public class Contest {
|
|
roomMap.put(room.data.roomId, list);
|
|
roomMap.put(room.data.roomId, list);
|
|
}
|
|
}
|
|
//排序
|
|
//排序
|
|
- objects.sort((o1, o2) -> Long.compare(o2.data.accumulatedPoints, o1.data.accumulatedPoints));
|
|
|
|
|
|
+ objects.sort((o1, o2) -> Long.compare(o2.data.matchPoints, o1.data.matchPoints));
|
|
//结算
|
|
//结算
|
|
for (int i = 1; i <= objects.size(); i++) {
|
|
for (int i = 1; i <= objects.size(); i++) {
|
|
Player player = objects.get(i - 1);
|
|
Player player = objects.get(i - 1);
|