【家园功能1.0.8】建筑解锁推送修改,只推送解锁的建筑
parent
304d1da7ef
commit
ee97a40004
|
@ -48,6 +48,7 @@ public class ArchitectureUnLockHandler implements IEventHandler {
|
|||
List<SHomeLand> collect = STableManager.getConfig(SHomeLand.class).values().stream().sorted(Comparator.comparing(SHomeLand::getSort)).collect(Collectors.toList());
|
||||
Map<Integer, SHomeLandLevel> levelMap = STableManager.getConfig(SHomeLandLevel.class);
|
||||
int nowInt = TimeUtils.nowInt();
|
||||
HashSet<Integer> set = new HashSet<>();
|
||||
for (SHomeLand land : collect) {
|
||||
// 不进版本
|
||||
if (land.getIsOpen() != 1) {
|
||||
|
@ -70,6 +71,7 @@ public class ArchitectureUnLockHandler implements IEventHandler {
|
|||
if (user.getPlayerInfoManager().getLevel() >= land.getUnlockLevel()[1]) {
|
||||
ArchitectureInfo architectureInfo = new ArchitectureInfo(id, nowInt, 0);
|
||||
user.getPlayerInfoManager().putArchitectureInfo(land.getId(),architectureInfo);
|
||||
set.add(land.getId());
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
|
@ -86,6 +88,7 @@ public class ArchitectureUnLockHandler implements IEventHandler {
|
|||
}
|
||||
ArchitectureInfo architectureInfo = new ArchitectureInfo(id, nowInt, 0);
|
||||
user.getPlayerInfoManager().putArchitectureInfo(land.getId(),architectureInfo);
|
||||
set.add(land.getId());
|
||||
break;
|
||||
default:
|
||||
// 其他条件暂不处理,有需求再加
|
||||
|
@ -107,7 +110,7 @@ public class ArchitectureUnLockHandler implements IEventHandler {
|
|||
user.getEquipManager().putEquipIntensifyMap(4,levelId);
|
||||
}
|
||||
}
|
||||
sendArchitectureUnlockIndication(user);
|
||||
sendArchitectureUnlockIndication(user,set);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,8 +118,20 @@ public class ArchitectureUnLockHandler implements IEventHandler {
|
|||
* 建筑解锁推送
|
||||
* @param user
|
||||
*/
|
||||
private void sendArchitectureUnlockIndication(User user) throws Exception {
|
||||
List<CommonProto.ArchitectureInfo> infoList = CBean2Proto.getArchitectureInfoList(user);
|
||||
private void sendArchitectureUnlockIndication(User user, Set<Integer> set) throws Exception {
|
||||
if (set.isEmpty()){
|
||||
return;
|
||||
}
|
||||
Map<Integer, ArchitectureInfo> infoMap = user.getPlayerInfoManager().getArchitectureInfoMap();
|
||||
List<CommonProto.ArchitectureInfo> infoList = new ArrayList<>();
|
||||
for (Integer value : set) {
|
||||
ArchitectureInfo info = infoMap.get(value);
|
||||
if (info == null){
|
||||
continue;
|
||||
}
|
||||
CommonProto.ArchitectureInfo.Builder builder = CommonProto.ArchitectureInfo.newBuilder().setId(info.getId()).setProductionStartTime(info.getProductionStartTime()).setUpLvEndTime(info.getUpLvEndTime());
|
||||
infoList.add(builder.build());
|
||||
}
|
||||
PlayerInfoProto.ArchitectureUnlockIndication.Builder builder = PlayerInfoProto.ArchitectureUnlockIndication.newBuilder().addAllInfos(infoList);
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ArchitectureUnlockIndication_VALUE, builder.build(), true);
|
||||
|
|
Loading…
Reference in New Issue