package config; import manager.STableManager; import manager.Table; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @Table(name ="ArenaRobotConfig") public class SArenaRobotConfig implements BaseConfig { private int id; private String robotName; private int robotScore; private int robotLevel; private int[] roleId; private List heroList; private int roleLv; private int[] differDemonsId; private int differDemonsLv; private int poolId; private int totalForce; private int breakId; private Map starOfHeroMap; private static Map> sArenaRobotConfigByPoolMap; private static Map sArenaRobotConfigMap; @Override public void init() throws Exception { Map> result = new HashMap<>(); Map config = STableManager.getConfig(SArenaRobotConfig.class); for(SArenaRobotConfig sArenaRobotConfig : config.values()){ int poolId = sArenaRobotConfig.getPoolId(); if(!result.containsKey(poolId)){ result.put(poolId,new ArrayList<>()); } int[] roleId = sArenaRobotConfig.getRoleId(); List heroListTmp = new ArrayList<>(roleId.length); for(int heroId : roleId){ heroListTmp.add(heroId); } sArenaRobotConfig.setHeroList(heroListTmp); result.get(poolId).add(sArenaRobotConfig); } sArenaRobotConfigByPoolMap = result; sArenaRobotConfigMap = config; } public static List getSArenaRobotConfigsByPool( int poolId) { return sArenaRobotConfigByPoolMap.get(poolId); } public static Map getsArenaRobotConfigMap() { return sArenaRobotConfigMap; } public static SArenaRobotConfig getsArenaRobotConfigById(int id) { return sArenaRobotConfigMap.get(id); } public int getId() { return id; } public String getRobotName() { return robotName; } public int getRobotScore() { return robotScore; } private int[] getRoleId() { return roleId; } public int getRoleLv() { return roleLv; } public int[] getDifferDemonsId() { return differDemonsId; } public int getDifferDemonsLv() { return differDemonsLv; } public int getPoolId() { return poolId; } public List getHeroList() { return heroList; } public void setHeroList(List heroList) { this.heroList = heroList; } public int getTotalForce() { return totalForce; } public void setTotalForce(int totalForce) { this.totalForce = totalForce; } public Map getStarOfHeroMap() { return starOfHeroMap; } public int getBreakId() { return breakId; } public void setBreakId(int breakId) { this.breakId = breakId; } public void setStarOfHeroMap(Map starOfHeroMap) { this.starOfHeroMap = starOfHeroMap; } public int getRobotLevel() { return robotLevel; } }