战力排名
parent
176827eec6
commit
f1cbb7b63e
|
|
@ -118,12 +118,7 @@ public class ChampionshipLogic {
|
|||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.CHAMPION_VIEW_FINAL_RESPONSE_VALUE,builder.build(),true);
|
||||
}
|
||||
|
||||
public static String getRoleNameById(int uid,Map<Integer,SArenaRobotConfig> config ) throws Exception {
|
||||
if(config.containsKey(uid)){
|
||||
return config.get(uid).getRobotName();
|
||||
}
|
||||
return UserManager.getUser(uid).getPlayerInfoManager().getNickName();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static class MemberInfo{
|
||||
|
|
@ -625,7 +620,12 @@ public class ChampionshipLogic {
|
|||
//这里将map.entrySet()转换成list
|
||||
List<Map.Entry<Integer,Integer>> list = new ArrayList<Map.Entry<Integer,Integer>>(uidRankMap.entrySet());
|
||||
//然后通过比较器来实现排序
|
||||
Collections.sort(list, (o1,o2)-> o2.getValue().compareTo(o1.getValue()));
|
||||
Collections.sort(list, (o1,o2)-> {
|
||||
if( o2.getValue()==(o1.getValue())){
|
||||
return getMaxForce(o2.getValue()) - getMaxForce(o1.getValue());
|
||||
}
|
||||
return o2.getValue().compareTo(o1.getValue());
|
||||
});
|
||||
|
||||
int rank=1;
|
||||
for(Map.Entry<Integer,Integer> mapping:list){
|
||||
|
|
@ -1149,6 +1149,20 @@ public class ChampionshipLogic {
|
|||
return RedisUtil.getInstence().get(key).toString();
|
||||
}
|
||||
|
||||
|
||||
private static int getMaxForce(int uid) {
|
||||
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(uid);
|
||||
if(sArenaRobotConfig!=null){
|
||||
return sArenaRobotConfig.getTotalForce();
|
||||
}
|
||||
try {
|
||||
return UserManager.getUser(uid).getPlayerInfoManager().getMaxForce();
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("",e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 选出每组前n名参与决赛人,重置他们分数为100分,进行同台竞技
|
||||
*
|
||||
|
|
@ -1164,6 +1178,9 @@ public class ChampionshipLogic {
|
|||
Collections.sort(memberOfOneTeam, new Comparator<Integer>() {
|
||||
@Override
|
||||
public int compare(Integer o1, Integer o2) {
|
||||
if( joinMembers.get(o2).getScore() == joinMembers.get(o1).getScore()){
|
||||
return getMaxForce(o2) - getMaxForce(o1);
|
||||
}
|
||||
return joinMembers.get(o2).getScore() -joinMembers.get(o1).getScore();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue