/** * 处理采集显示和隐藏 * * @param gameMap * @param npc * @param view * @param hideTime, 隐藏时间 (毫秒) */ public void handleCollect(GameMap gameMap, Npc npc, boolean view, int hideTime) { if (npc == null || gameMap == null) { return; } int x = npc.getBornX(); int y = npc.getBornY(); GameScreen gameScreen = gameMap.getGameScreen(x, y); if (gameScreen == null) { return; } Collection<ISpire> spireCollection = gameScreen.getSpireCollection(ElementType.NPC); ISpire target = null; int npcId = npc.getId(); for (ISpire npcSpire : spireCollection) { if (npcSpire.getId() == npcId) { target = npcSpire; break; } } if (target == null) { return; } Set<ISpire> spires = gameMap.getCanViewsSpireCollection(x, y, ElementType.PLAYER); if (spires != null) { for (ISpire spire : spires) { UserDomain userDomain = (UserDomain) spire; if (view) { npc.view(gameMap); userDomain.putCanViewSpire(target); } else if (hideTime > 0) { npc.hide(gameMap, hideTime); synchronized (handleNpcSet) { handleNpcSet.add(npc); } userDomain.putHideSpire(target); } } worldPusherHelper.putMessage2Queue(spires); } }