package config; import manager.STableManager; import manager.Table; import java.util.HashMap; import java.util.Map; @Table(name ="PropertyConfig") public class SPropertyConfig implements BaseConfig { private int propertyId; private int style; private float score; private int targetPropertyId; private int ifFormula; private int propertyIdInBattle; private static Map sPropertyConfigByPIDMap; private static Map sPropertyIConfigByInBattleMap; private static Map sPropertyConfigByTargetMap; @Override public void init() throws Exception { Map sPropertyConfigByPIDMapTmp = new HashMap<>(); Map sPropertyIConfigByInBattleMapTmp = new HashMap<>(); Map sPropertyConfigByTargetMapTmp = new HashMap<>(); Map config = STableManager.getConfig(SPropertyConfig.class); for(SPropertyConfig sPropertyConfig : config.values()){ int propertyId = sPropertyConfig.getPropertyId(); sPropertyConfigByPIDMapTmp.put(propertyId,sPropertyConfig); int propertyIdInBattle = sPropertyConfig.getPropertyIdInBattle(); if(propertyIdInBattle!=0){ sPropertyIConfigByInBattleMapTmp.put(propertyIdInBattle,sPropertyConfig); } int targetPropertyId = sPropertyConfig.getTargetPropertyId(); if(targetPropertyId!=0){ sPropertyConfigByTargetMapTmp.put(targetPropertyId,sPropertyConfig); } } sPropertyConfigByPIDMap = sPropertyConfigByPIDMapTmp; sPropertyIConfigByInBattleMap = sPropertyIConfigByInBattleMapTmp; sPropertyConfigByTargetMap = sPropertyConfigByTargetMapTmp; } public static SPropertyConfig getsPropertyConfigByPID(int propertyId) { return sPropertyConfigByPIDMap.get(propertyId); } public static SPropertyConfig getsPropertyConfigByBattlePID(int battlePropertyId) { return sPropertyIConfigByInBattleMap .get(battlePropertyId); } public static SPropertyConfig getsPropertyConfigByTargetPropertyId(int targetPropertyId) { return sPropertyConfigByTargetMap.get(targetPropertyId); } public int getPropertyId() { return propertyId; } public int getStyle() { return style; } public float getScore() { return score; } public int getTargetPropertyId() { return targetPropertyId; } public int getIfFormula() { return ifFormula; } public int getPropertyIdInBattle() { return propertyIdInBattle; } }