44 lines
826 B
Java
44 lines
826 B
Java
|
package config;
|
||
|
|
||
|
import manager.STableManager;
|
||
|
import manager.Table;
|
||
|
|
||
|
import java.util.HashMap;
|
||
|
import java.util.Map;
|
||
|
|
||
|
@Table(name ="PlayerRole")
|
||
|
public class SPlayerRole implements BaseConfig {
|
||
|
|
||
|
private int id;
|
||
|
|
||
|
private int role;
|
||
|
|
||
|
private int rolePic;
|
||
|
|
||
|
private static Map<Integer,Integer> roleMap;
|
||
|
|
||
|
@Override
|
||
|
public void init() throws Exception {
|
||
|
roleMap = new HashMap<>();
|
||
|
for (SPlayerRole entry:STableManager.getConfig(SPlayerRole.class).values()) {
|
||
|
roleMap.put(entry.getRole(),entry.getRolePic());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public int getId() {
|
||
|
return id;
|
||
|
}
|
||
|
|
||
|
public int getRole() {
|
||
|
return role;
|
||
|
}
|
||
|
|
||
|
public int getRolePic() {
|
||
|
return rolePic;
|
||
|
}
|
||
|
|
||
|
|
||
|
public static int getRolePic(Integer sex) {
|
||
|
return SPlayerRole.roleMap.getOrDefault(sex,0);
|
||
|
}
|
||
|
}
|