96 lines
2.9 KiB
Java
96 lines
2.9 KiB
Java
|
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 ="AccomplishmentConfig")
|
||
|
public class SAccomplishmentConfig implements BaseConfig {
|
||
|
|
||
|
private int id;
|
||
|
|
||
|
private int mapId;
|
||
|
|
||
|
private int logic;
|
||
|
|
||
|
private int[][] values;
|
||
|
|
||
|
private int score;
|
||
|
|
||
|
private int[] reward;
|
||
|
|
||
|
|
||
|
private int scheduleShow;
|
||
|
|
||
|
|
||
|
|
||
|
private static Map<Integer, List<SAccomplishmentConfig>> sAccomplishmentConfigByMapIdMap;
|
||
|
private static Map<Integer,Map<Integer,List<SAccomplishmentConfig>>> sAccomplishmentConfigByMapIdAndLogicMap;
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public void init() throws Exception {
|
||
|
Map<Integer, SAccomplishmentConfig> config = STableManager.getConfig(SAccomplishmentConfig.class);
|
||
|
Map<Integer, List<SAccomplishmentConfig>> sAccomplishmentConfigByMapIdMapTmp = new HashMap<>();
|
||
|
Map<Integer,Map<Integer,List<SAccomplishmentConfig>>> sAccomplishmentConfigByMapIdAndLogicMapTmp = new HashMap<>();
|
||
|
for(SAccomplishmentConfig sAccomplishmentConfig : config.values()){
|
||
|
int mapId = sAccomplishmentConfig.getMapId();
|
||
|
if(!sAccomplishmentConfigByMapIdMapTmp.containsKey(mapId)){
|
||
|
sAccomplishmentConfigByMapIdMapTmp.put(mapId,new ArrayList<>());
|
||
|
sAccomplishmentConfigByMapIdAndLogicMapTmp.put(mapId,new HashMap<>());
|
||
|
}
|
||
|
int logic = sAccomplishmentConfig.getLogic();
|
||
|
if(!sAccomplishmentConfigByMapIdAndLogicMapTmp.get(mapId).containsKey(logic)){
|
||
|
sAccomplishmentConfigByMapIdAndLogicMapTmp.get(mapId).put(logic,new ArrayList<>());
|
||
|
}
|
||
|
sAccomplishmentConfigByMapIdAndLogicMapTmp.get(mapId).get(logic).add(sAccomplishmentConfig);
|
||
|
sAccomplishmentConfigByMapIdMapTmp.get(mapId).add(sAccomplishmentConfig);
|
||
|
}
|
||
|
sAccomplishmentConfigByMapIdMap = sAccomplishmentConfigByMapIdMapTmp;
|
||
|
sAccomplishmentConfigByMapIdAndLogicMap = sAccomplishmentConfigByMapIdAndLogicMapTmp;
|
||
|
}
|
||
|
|
||
|
public static List<SAccomplishmentConfig> getsAccomplishmentConfigByMapIdAndLogic(int mapId,int logic) {
|
||
|
if(!sAccomplishmentConfigByMapIdAndLogicMap.containsKey(mapId)){
|
||
|
return null;
|
||
|
}
|
||
|
return sAccomplishmentConfigByMapIdAndLogicMap.get(mapId).get(logic);
|
||
|
}
|
||
|
|
||
|
public static List<SAccomplishmentConfig> getsAccomplishmentConfigByMapId(int mapId) {
|
||
|
return sAccomplishmentConfigByMapIdMap.get(mapId);
|
||
|
}
|
||
|
|
||
|
public int getId() {
|
||
|
return id;
|
||
|
}
|
||
|
|
||
|
public int getMapId() {
|
||
|
return mapId;
|
||
|
}
|
||
|
|
||
|
public int getLogic() {
|
||
|
return logic;
|
||
|
}
|
||
|
|
||
|
public int[][] getValues() {
|
||
|
return values;
|
||
|
}
|
||
|
|
||
|
public int getScore() {
|
||
|
return score;
|
||
|
}
|
||
|
|
||
|
public int[] getReward() {
|
||
|
return reward;
|
||
|
}
|
||
|
|
||
|
public int getScheduleShow() {
|
||
|
return scheduleShow;
|
||
|
}
|
||
|
}
|