From ee97a40004a5a7fa51991bae13790edb86beef65 Mon Sep 17 00:00:00 2001 From: duhui Date: Tue, 28 Dec 2021 14:59:59 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=AE=B6=E5=9B=AD=E5=8A=9F=E8=83=BD1.?= =?UTF-8?q?0.8=E3=80=91=E5=BB=BA=E7=AD=91=E8=A7=A3=E9=94=81=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=8F=AA=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E8=A7=A3=E9=94=81=E7=9A=84=E5=BB=BA=E7=AD=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/home/ArchitectureUnLockHandler.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/home/ArchitectureUnLockHandler.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/home/ArchitectureUnLockHandler.java index 27d4670cd..ab0000c93 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/home/ArchitectureUnLockHandler.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/home/ArchitectureUnLockHandler.java @@ -48,6 +48,7 @@ public class ArchitectureUnLockHandler implements IEventHandler { List collect = STableManager.getConfig(SHomeLand.class).values().stream().sorted(Comparator.comparing(SHomeLand::getSort)).collect(Collectors.toList()); Map levelMap = STableManager.getConfig(SHomeLandLevel.class); int nowInt = TimeUtils.nowInt(); + HashSet 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 infoList = CBean2Proto.getArchitectureInfoList(user); + private void sendArchitectureUnlockIndication(User user, Set set) throws Exception { + if (set.isEmpty()){ + return; + } + Map infoMap = user.getPlayerInfoManager().getArchitectureInfoMap(); + List 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);