back_recharge
duhui 2020-12-08 11:06:24 +08:00
parent 92e5c50e24
commit e02da1d687
1 changed files with 36 additions and 0 deletions

View File

@ -11,6 +11,8 @@ import java.util.*;
public class TeamPosManager extends MongoBase {
private Map<Integer, List<TeamPosHeroInfo>> teamPosForHero;
// 编队--树神
private Map<Integer, List<TeamPosHeroInfo>> teamPosForTree;
private Map<Integer,String> teamNames;
@Transient
private int curTeamPosId;
@ -24,6 +26,7 @@ public class TeamPosManager extends MongoBase {
teamNames = new HashMap<>(3);
teamPosForHero = new HashMap<>(3);
teamPosForTree = new HashMap<>(5);
}
public void changeName(int teamId,String teamName) throws Exception {
@ -40,7 +43,23 @@ public class TeamPosManager extends MongoBase {
teamPosForHero.put(teamId,teamPosHeroInfoList);
updateString("teamPosForHero",teamPosForHero);
cacheTeamPro.remove(teamId);
}
/**
*
* @param teamId
* @param heroIds
* @throws Exception
*/
public void changeTreeTeamInfo(int teamId, List<CommonProto.TeamHeroInfo> heroIds) throws Exception {
List<TeamPosHeroInfo> teamPosHeroInfoList = new ArrayList<>(6);
for(CommonProto.TeamHeroInfo teamHeroInfo : heroIds){
TeamPosHeroInfo teamPosHeroInfo = new TeamPosHeroInfo(teamHeroInfo.getHeroId(), teamHeroInfo.getPosition());
teamPosHeroInfoList.add(teamPosHeroInfo);
}
teamPosForTree.put(teamId,teamPosHeroInfoList);
updateString("teamPosForTree",teamPosForTree);
cacheTeamPro.remove(teamId);
}
public void addTeamOfInitPlayer(Collection<Hero> heros) throws Exception {
@ -60,6 +79,23 @@ public class TeamPosManager extends MongoBase {
updateString("teamPosForHero",teamPosForHero);
}
public void addTreeTeamOfInitPlayer(Collection<Hero> heros) throws Exception {
List<TeamPosHeroInfo> teamPosHeroInfoList = new ArrayList<>(6);
int position =1;
for(Hero hero : heros){
if(position>5){
break;
}
TeamPosHeroInfo teamPosHeroInfo = new TeamPosHeroInfo(hero.getId(), position++);
teamPosHeroInfoList.add(teamPosHeroInfo);
}
teamPosForTree.put(0,new ArrayList<>(1));
teamPosForTree.put(1,new ArrayList<>(1));
teamPosForTree.put(2,new ArrayList<>(1));
teamPosForTree.put(3,new ArrayList<>(1));
teamPosForTree.put(4,new ArrayList<>(1));
updateString("teamPosForTree",teamPosForTree);
}
public Map<Integer, String> getTeamNames() {
return teamNames;