系统公告本地化修改

lvxinran 2020-12-06 08:57:25 +08:00
parent e1bae5947d
commit e79d844eec
3 changed files with 37 additions and 14 deletions

View File

@ -196,7 +196,8 @@ public class PlayerLogic {
if (length == -1) {
throw new ErrorCodeException(ErrorCode.NAME_ILLEGAL);
}
if (length > STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxNameLength() || length < 1) {
// STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getMaxNameLength()
if (length > 18 || length < 1) {
throw new ErrorCodeException(ErrorCode.NAME_LENTH);
}
;
@ -230,11 +231,11 @@ public class PlayerLogic {
return -1;// 如果含有敏感词汇 -1
}
// if (temp.matches(chinese)) {
// valueLength += 2;
// } else {
if (temp.matches(chinese)) {
valueLength += 3;
} else {
valueLength += 1;
// }
}
}
return valueLength;
}

View File

@ -1256,7 +1256,7 @@ public class ItemUtil {
heroList.add(CBean2Proto.getHero(hero));
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
if (scHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_lottery_content_parm)) { //策划资质改成星级
String message = SErrorCodeEerverConfig.getI18NMessage("lamp_lottery_content", new Object[]{playerInfoManager.getNickName(), scHero.getStar(), scHero.getReadingName()});
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("lamp_lottery_content", new Object[]{playerInfoManager.getNickName(), scHero.getStar(), scHero.getReadingName()},new int[]{0,0,1});
if (!message.isEmpty()){
ChatLogic.getInstance().sendSysChatMessage(message,Global.LUCKY_LUCK,hero.getTemplateId(),0,0,0,0,0);
}

View File

@ -9,21 +9,23 @@ import java.util.concurrent.ConcurrentHashMap;
@Table(name ="ErrorCodeEerverConfig")
public class SErrorCodeEerverConfig implements BaseConfig {
private static Map<String ,String> errorCodeMap;
private static Map<String ,SErrorCodeEerverConfig> errorCodeMap;
private int id;
private String key;
private String value;
private String englishValue;
@Override
public void init() throws Exception {
Map<Integer, SErrorCodeEerverConfig> config = STableManager.getConfig(SErrorCodeEerverConfig.class);
Map<String ,String> errorCodeEerverConfigMap = new ConcurrentHashMap<>();
Map<String ,SErrorCodeEerverConfig> errorCodeEerverConfigMap = new ConcurrentHashMap<>();
for (Map.Entry<Integer, SErrorCodeEerverConfig> entry :config.entrySet()){
SErrorCodeEerverConfig sErrorCodeEerverConfig = entry.getValue();
errorCodeEerverConfigMap.put(sErrorCodeEerverConfig.getkey(),sErrorCodeEerverConfig.getvalue());
errorCodeEerverConfigMap.put(sErrorCodeEerverConfig.getkey(),sErrorCodeEerverConfig);
}
errorCodeMap = errorCodeEerverConfigMap;
}
@ -41,19 +43,39 @@ public class SErrorCodeEerverConfig implements BaseConfig {
return value;
}
public String getEnglishValue() {
return englishValue;
}
public static String getI18NMessage(String key){
String value = errorCodeMap.get(key);
SErrorCodeEerverConfig value = errorCodeMap.get(key);
if (value == null) {
return "";
}
return value;
return value.getvalue()+"|"+value.getEnglishValue();
}
public static String getI18NMessage(String key,Object[] obj ){
String value = errorCodeMap.get(key);
if (value == null) {
SErrorCodeEerverConfig value = errorCodeMap.get(key);
if(value==null){
return "";
}
return MessageFormat.format(value, obj);
return MessageFormat.format(value.getvalue(), obj) + "|" + MessageFormat.format(value.getEnglishValue(), obj);
}
public static String getI18NMessageNeedConvert(String key,Object[] obj ,int[] convert){
SErrorCodeEerverConfig value = errorCodeMap.get(key);
if(value==null){
return "";
}
if(convert.length!=obj.length){
convert = new int[obj.length];
}
StringBuilder str = new StringBuilder();
for(int i = 0 ; i <obj.length;i++) {
str.append("|").append(convert[i]).append(obj[i].toString());
}
return value.getvalue()+str.toString();
}
}