areaID 赋值
parent
61446dfd55
commit
9968986c49
|
|
@ -47,6 +47,7 @@ public class GameApplication {
|
|||
public static ServerProperties serverProperties;
|
||||
private static NettyGameServer nettyServer = null;
|
||||
public static int serverId = 0;
|
||||
public static int areaId = 0;
|
||||
public static boolean start = false;
|
||||
|
||||
public static ServerConfig serverConfig;
|
||||
|
|
@ -61,6 +62,7 @@ public class GameApplication {
|
|||
ServerConfiguration serverConfiguration = configurableApplicationContext.getBean(ServerConfiguration.class);
|
||||
serverProperties = serverConfiguration.getServerProperties();
|
||||
serverId = serverProperties.getId();
|
||||
areaId = serverProperties.getId();
|
||||
LOGGER.info("ServerProperties ->{},coreIp=>{}", serverProperties.toString());
|
||||
//注册消息处理方法
|
||||
ProtocolsManager protocolsManager = ProtocolsManager.getInstance();
|
||||
|
|
|
|||
|
|
@ -97,11 +97,12 @@ public class RedisKey {
|
|||
public static final String LEVE_DIFFICULTY_FIGHT = "LEVE_DIFFICULTY_FIGHT";
|
||||
|
||||
|
||||
public static String getKey(String type, String key, boolean withServerId) {
|
||||
if (withServerId) {
|
||||
return areaId + Delimiter_colon + type + Delimiter_colon + String.valueOf(key);
|
||||
public static String getKey(String type, String key, boolean withoutServerId) {
|
||||
if (withoutServerId) {
|
||||
return GameApplication.areaId + Delimiter_colon + type + Delimiter_colon + String.valueOf(key);
|
||||
} else {
|
||||
return GameApplication.serverId + Delimiter_colon + type + Delimiter_colon + String.valueOf(key);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue