Merge branch 'dev_dh_cross_rank' into master_test_gn_zbh
commit
b1551e6b75
|
@ -1288,6 +1288,14 @@ public class RedisUtil {
|
||||||
return getKey(type,key,true);
|
return getKey(type,key,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取key
|
||||||
|
* @param type
|
||||||
|
* @param key
|
||||||
|
* @param judge
|
||||||
|
* 本服: true 跨服: false
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public String getKey(String type,String key,boolean judge){
|
public String getKey(String type,String key,boolean judge){
|
||||||
if (!judge){
|
if (!judge){
|
||||||
return type + RedisKey.Delimiter_colon + key;
|
return type + RedisKey.Delimiter_colon + key;
|
||||||
|
|
|
@ -147,14 +147,22 @@ public class CrossServiceLogic {
|
||||||
return arenaOfPlayerManager;
|
return arenaOfPlayerManager;
|
||||||
}
|
}
|
||||||
private ArenaOfHeroManager buildArenaOfHeroManager(User user){
|
private ArenaOfHeroManager buildArenaOfHeroManager(User user){
|
||||||
|
// 编队列表
|
||||||
Map<Integer,List<TeamPosHeroInfo>> teams = new HashMap<>();
|
Map<Integer,List<TeamPosHeroInfo>> teams = new HashMap<>();
|
||||||
List<TeamPosHeroInfo> infos =
|
// 需要存储的英雄列表
|
||||||
user.getTeamPosManager().getTeamPosForHero().getOrDefault(GlobalsDef.WORLD_TEAM_ARENA_DEFENSE,new ArrayList<>());
|
HashSet<TeamPosHeroInfo> set = new HashSet<>();
|
||||||
teams.put(GlobalsDef.WORLD_TEAM_ARENA_DEFENSE,infos);
|
// 跨服世界阵编队
|
||||||
|
List<TeamPosHeroInfo> worldTeam = user.getTeamPosManager().getTeamPosForHero().getOrDefault(GlobalsDef.WORLD_TEAM_ARENA_DEFENSE,new ArrayList<>());
|
||||||
|
teams.put(GlobalsDef.WORLD_TEAM_ARENA_DEFENSE,worldTeam);
|
||||||
|
set.addAll(worldTeam);
|
||||||
|
// 主线阵容编队
|
||||||
|
List<TeamPosHeroInfo> firstTeam = user.getTeamPosManager().getTeamPosForHero().getOrDefault(GlobalsDef.FORMATION_NORMAL,new ArrayList<>());
|
||||||
|
teams.put(GlobalsDef.FORMATION_NORMAL,firstTeam);
|
||||||
|
set.addAll(firstTeam);
|
||||||
// 英雄
|
// 英雄
|
||||||
Map<String,ArenaOfHero> heroes = new HashMap<>();
|
Map<String,ArenaOfHero> heroes = new HashMap<>();
|
||||||
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||||
infos.forEach(v->{
|
set.forEach(v->{
|
||||||
Hero hero = heroMap.get(v.getHeroId());
|
Hero hero = heroMap.get(v.getHeroId());
|
||||||
heroes.put(v.getHeroId(),buildArenaOfHero(user,hero));
|
heroes.put(v.getHeroId(),buildArenaOfHero(user,hero));
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.ljsd.jieling.logic.dao;
|
package com.ljsd.jieling.logic.dao;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class TeamPosHeroInfo implements Comparable<TeamPosHeroInfo> {
|
public class TeamPosHeroInfo implements Comparable<TeamPosHeroInfo> {
|
||||||
private String heroId;
|
private String heroId;
|
||||||
private int position;
|
private int position;
|
||||||
|
@ -30,6 +32,18 @@ public class TeamPosHeroInfo implements Comparable<TeamPosHeroInfo> {
|
||||||
this.position = position;
|
this.position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
TeamPosHeroInfo that = (TeamPosHeroInfo) o;
|
||||||
|
return Objects.equals(heroId, that.heroId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(heroId, position);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(TeamPosHeroInfo o) {
|
public int compareTo(TeamPosHeroInfo o) {
|
||||||
|
|
|
@ -58,7 +58,12 @@ public abstract class AbstractRank implements IRank {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跨服排行数据
|
* 获取跨服排行
|
||||||
|
* @param uid
|
||||||
|
* @param rkey
|
||||||
|
* @param page
|
||||||
|
* @param rankEndLine
|
||||||
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public PlayerInfoProto.RankResponse getCrossRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
public PlayerInfoProto.RankResponse getCrossRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue