@Override public void run() { if (this.main.getShell().isDisposed()) { return; } // タブを更新する CTabItem maintab = this.main.getTabFolder().getItem(0); maintab.setToolTipText( "装備:" + GlobalContext.getItemMap().size() + "/" + GlobalContext.maxSlotitem() + " 艦娘:" + GlobalContext.getShipMap().size() + "/" + GlobalContext.maxChara()); boolean combinedFleetBadlyDamaed = false; if (GlobalContext.isCombined()) { combinedFleetBadlyDamaed = GlobalContext.getDock("1").isBadlyDamaged() || GlobalContext.getDock("2").isBadlyDamaged(); } List<ShipDto> badlyDamaged = new ArrayList<>(); FleetWindow[] fleetWindows = this.main.getFleetWindows(); for (int i = 0; i < fleetWindows.length; i++) { fleetWindows[i].updateFleet(combinedFleetBadlyDamaed, badlyDamaged); } this.postFatal(badlyDamaged); }
private void updateOtherTimer() { Label condTimerLabel = this.main.getCondTimerLabel(); Text condTimerText = this.main.getCondTimerTime(); CondTiming timing = GlobalContext.getCondTiming(); Date nextUpdateTime = timing.getNextUpdateTime(this.now); // 疲労のある艦娘はいる? boolean needTimer = false; for (ShipDto ship : GlobalContext.getShipMap().values()) { if (ship.getCond() < 49) { needTimer = true; break; } } if (needTimer == false) { condTimerLabel.setText(""); condTimerText.setToolTipText(null); condTimerText.setText(""); } else if (nextUpdateTime == null) { condTimerLabel.setText("次の疲労回復まで"); condTimerText.setToolTipText("十分な情報がありません"); condTimerText.setText("???"); } else { int accuracy = (int) timing.getCurrentAccuracy() / 2000; condTimerLabel.setText("次の疲労回復まで(±" + accuracy + "秒)"); long rest = TimeLogic.getRest(this.now, nextUpdateTime); // ツールチップテキストで時刻を表示する condTimerText.setToolTipText(this.format.format(nextUpdateTime)); condTimerText.setText(TimeLogic.toDateRestString(rest, true)); } // 泊地修理タイマー Label akashiTimerLabel = this.main.getAkashiTimerLabel(); Text akashiTimerText = this.main.getAkashiTimerTime(); AkashiTimer akashiTimer = GlobalContext.getAkashiTimer(); if (akashiTimer.getStartTime() == null) { // 不明 akashiTimerText.setText("???"); akashiTimerText.setToolTipText("十分な情報がありません"); akashiTimerText.setBackground(ColorManager.getColor(SWT.COLOR_WHITE)); } else { long elapsed = this.now.getTime() - akashiTimer.getStartTime().getTime(); String time = TimeLogic.toDateRestString(elapsed / 1000, true); akashiTimerText.setText(time); akashiTimerText.setToolTipText(null); akashiTimerText.setBackground(ColorManager.getColor(AppConstants.AKASHI_REPAIR_COLOR)); } }
@Override public void run() { if (this.main.getShell().isDisposed()) { return; } Button shipList = this.main.getShipList(); String setText = "所有艦娘(" + GlobalContext.getShipMap().size() + "/" + GlobalContext.maxChara() + ")"; if (setText.equals(shipList.getText())) { return; } shipList.setText(setText); shipList.getParent().layout(); if (AppConfig.get().isUseTaskbarNotify()) { TaskItem item = SwtUtils.getTaskBarItem(this.main.getShell()); if (item != null) { int max = GlobalContext.maxChara(); int size = GlobalContext.getShipMap().size(); int locked = 0; for (Entry<Integer, ShipDto> entry : GlobalContext.getShipMap().entrySet()) { if (entry.getValue().getLocked()) { locked++; } } int r = Math.round(((float) (size - locked) / (float) (max - locked)) * 100); item.setProgress(r); if (max <= (size + AppConfig.get().getNotifyFully())) { item.setProgressState(SWT.PAUSED); } else { item.setProgressState(SWT.NORMAL); } } } }
/** * 入渠を更新する * * @param now * @param notice * @return */ private void updateNdock() { Map<Integer, ShipDto> shipMap = GlobalContext.getShipMap(); Label[] ndockNameLabels = { this.main.getNdock1name(), this.main.getNdock2name(), this.main.getNdock3name(), this.main.getNdock4name() }; Text[] ndockTimeTexts = { this.main.getNdock1time(), this.main.getNdock2time(), this.main.getNdock3time(), this.main.getNdock4time() }; NdockDto[] ndocks = GlobalContext.getNdocks(); for (int i = 0; i < ndocks.length; i++) { String name = ""; String time = ""; if (ndocks[i].getNdockid() != 0) { ShipDto ship = shipMap.get(ndocks[i].getNdockid()); if (ship != null) { name = ship.getFriendlyName(); long rest = TimeLogic.getRest(this.now, ndocks[i].getNdocktime()); // ツールチップテキストで時刻を表示する ndockTimeTexts[i].setToolTipText(this.format.format(ndocks[i].getNdocktime())); // 20分前、10分前、5分前になったら背景色を変更する ndockTimeTexts[i].setBackground(getBackgroundColor(rest)); // 通知生成 this.updateNdockNotice(name, i, rest); time = TimeLogic.toDateRestString(rest); if (time == null) { time = "まもなくお風呂からあがります"; } } } else { ndockTimeTexts[i].setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE)); ndockTimeTexts[i].setToolTipText(null); } ndockNameLabels[i].setText(name); ndockTimeTexts[i].setText(time); } }