From ad7ad0cc3ac03d389531124ba06a87b3c8f4189a Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Mon, 7 Nov 2022 18:33:13 -0500 Subject: [PATCH 01/18] RFE 426 overlay for Planetary Conditions --- .../i18n/megamek/client/messages.properties | 4 + .../megamek/client/ui/swing/ClientGUI.java | 1 + .../client/ui/swing/CommonMenuBar.java | 14 +- .../client/ui/swing/GUIPreferences.java | 6 + .../client/ui/swing/boardview/BoardView.java | 13 + .../boardview/PlanetaryConditionsOverlay.java | 278 ++++++++++++++++++ .../client/ui/swing/util/KeyCommandBind.java | 1 + 7 files changed, 316 insertions(+), 1 deletion(-) create mode 100644 megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java diff --git a/megamek/i18n/megamek/client/messages.properties b/megamek/i18n/megamek/client/messages.properties index 7f1efd175da..3153f26eee9 100644 --- a/megamek/i18n/megamek/client/messages.properties +++ b/megamek/i18n/megamek/client/messages.properties @@ -925,6 +925,7 @@ CommonMenuBar.viewAccessibilityWindow=Accessibility Window CommonMenuBar.viewIncGUIScale=Increase GUI Scale CommonMenuBar.viewDecGUIScale=Decrease GUI Scale CommonMenuBar.viewKeyboardShortcuts=Keyboard Shortcuts +CommonMenuBar.viewPlanetaryConditions=Planetary Conditions CommonMenuBar.ViewMenu=View CommonMenuBar.viewMinimap=Minimap CommonMenuBar.viewPlayerList=Player List @@ -1532,6 +1533,8 @@ KeyBinds.cmdNames.toggleDrawLabels=Unit Labels KeyBinds.cmdDesc.toggleDrawLabels=Toggles between displaying and not displaying unit labels KeyBinds.cmdNames.toggleKeybinds=Keybindings Display KeyBinds.cmdDesc.toggleKeybinds=Toggles the map overlay showing various key shortcuts +KeyBinds.cmdNames.togglePlanetaryConditions=Planetary Conditions Display +KeyBinds.cmdDesc.togglePlanetaryConditions=Toggles the map overlay showing Planetary Conditions KeyBinds.cmdNames.toggleHexCoords=Toggle Hex Coords KeyBinds.cmdDesc.toggleHexCoords=Toggles the map showing the coords on each hex KeyBinds.cmdNames.toggleMinimap=Toggle Minimap @@ -1577,6 +1580,7 @@ KeyBindingsDisplay.fixedBinds=Toggle Unit Display and Minimap: Mouse Button 4\nZ KeyBindingsDisplay.fixedBindsBoardEd=Zoom: Mouse Wheel\nLeft-Click: Draw Hex (replace previous terrain)\nShift + Left-Click: Draw Hex (add to previous terrain)\nCtrl + Left-Click: Draw Hex with hex elevation\nAlt + Left-Click: Eyedropper tool\nDrag-Right Mouse Button: Pan Map KeyBindingsDisplay.heading=#FFFFFFKeyboard Shortcuts - press {0} to toggle this overlay +PlanetaryConditions.heading=#FFFFFFPlanetary Conditions - press {0} to toggle this overlay #LOS / Ruler tool LOSDialog.inFirstHex=Unit type in the first hex: diff --git a/megamek/src/megamek/client/ui/swing/ClientGUI.java b/megamek/src/megamek/client/ui/swing/ClientGUI.java index 2dcf7ef0add..fee6a520d58 100644 --- a/megamek/src/megamek/client/ui/swing/ClientGUI.java +++ b/megamek/src/megamek/client/ui/swing/ClientGUI.java @@ -145,6 +145,7 @@ public class ClientGUI extends JPanel implements BoardViewListener, public static final String VIEW_UNIT_DISPLAY = "viewMekDisplay"; public static final String VIEW_ACCESSIBILITY_WINDOW = "viewAccessibilityWindow"; public static final String VIEW_KEYBINDS_OVERLAY = "viewKeyboardShortcuts"; + public static final String VIEW_PLANETARYCONDITIONS_OVERLAY = "viewPlanetaryConditions"; public static final String VIEW_MINI_MAP = "viewMinimap"; public static final String VIEW_UNIT_OVERVIEW = "viewUnitOverview"; public static final String VIEW_ZOOM_IN = "viewZoomIn"; diff --git a/megamek/src/megamek/client/ui/swing/CommonMenuBar.java b/megamek/src/megamek/client/ui/swing/CommonMenuBar.java index b4f96b33785..e0d561878b4 100644 --- a/megamek/src/megamek/client/ui/swing/CommonMenuBar.java +++ b/megamek/src/megamek/client/ui/swing/CommonMenuBar.java @@ -103,6 +103,7 @@ public class CommonMenuBar extends JMenuBar implements ActionListener, IPreferen private JCheckBoxMenuItem viewMekDisplay = new JCheckBoxMenuItem(getString("CommonMenuBar.viewMekDisplay")); private JMenuItem viewAccessibilityWindow = new JMenuItem(getString("CommonMenuBar.viewAccessibilityWindow")); private JCheckBoxMenuItem viewKeybindsOverlay = new JCheckBoxMenuItem(getString("CommonMenuBar.viewKeyboardShortcuts")); + private JCheckBoxMenuItem viewPlanetaryConditionsOverlay = new JCheckBoxMenuItem(getString("CommonMenuBar.viewPlanetaryConditions")); private JMenuItem viewZoomIn = new JMenuItem(getString("CommonMenuBar.viewZoomIn")); private JMenuItem viewZoomOut = new JMenuItem(getString("CommonMenuBar.viewZoomOut")); private JMenuItem viewLabels = new JMenuItem(getString("CommonMenuBar.viewLabels")); @@ -249,6 +250,10 @@ public CommonMenuBar() { initMenuItem(viewKeybindsOverlay, menu, VIEW_KEYBINDS_OVERLAY); viewKeybindsOverlay.setSelected(GUIP.getBoolean(GUIPreferences.SHOW_KEYBINDS_OVERLAY)); + + initMenuItem(viewPlanetaryConditionsOverlay, menu, VIEW_PLANETARYCONDITIONS_OVERLAY); + viewPlanetaryConditionsOverlay.setSelected(GUIP.getBoolean(GUIPreferences.SHOW_PLANETARYCONDITIONS_OVERLAY)); + initMenuItem(viewUnitOverview, menu, VIEW_UNIT_OVERVIEW); viewUnitOverview.setSelected(GUIP.getShowUnitOverview()); initMenuItem(viewZoomIn, menu, VIEW_ZOOM_IN); @@ -310,6 +315,7 @@ private void setKeyBinds() { toggleHexCoords.setAccelerator(KeyCommandBind.keyStroke(KeyCommandBind.HEX_COORDS)); viewMovModEnvelope.setAccelerator(KeyCommandBind.keyStroke(KeyCommandBind.MOD_ENVELOPE)); viewKeybindsOverlay.setAccelerator(KeyCommandBind.keyStroke(KeyCommandBind.KEY_BINDS)); + viewPlanetaryConditionsOverlay.setAccelerator(KeyCommandBind.keyStroke(KeyCommandBind.PLANETARY_CONDITIONS)); viewMekDisplay.setAccelerator(KeyCommandBind.keyStroke(KeyCommandBind.UNIT_DISPLAY)); viewUnitOverview.setAccelerator(KeyCommandBind.keyStroke(KeyCommandBind.UNIT_OVERVIEW)); viewLOSSetting.setAccelerator(KeyCommandBind.keyStroke(KeyCommandBind.LOS_SETTING)); @@ -351,7 +357,10 @@ public void actionPerformed(ActionEvent event) { } else if (event.getActionCommand().equals(ClientGUI.VIEW_KEYBINDS_OVERLAY)) { GUIP.toggleKeybindsOverlay(); - + + } else if (event.getActionCommand().equals(ClientGUI.VIEW_PLANETARYCONDITIONS_OVERLAY)) { + GUIP.togglePlanetaryConditionsOverlay(); + } else if (event.getActionCommand().equals(ClientGUI.VIEW_TOGGLE_HEXCOORDS)) { boolean coordsShown = GUIP.getBoolean(GUIPreferences.SHOW_COORDS); GUIP.setValue(GUIPreferences.SHOW_COORDS, !coordsShown); @@ -445,6 +454,7 @@ private synchronized void updateEnabledStates() { viewZoomOut.setEnabled(isBoardView); toggleIsometric.setEnabled(isBoardView); viewKeybindsOverlay.setEnabled(isBoardView); + viewPlanetaryConditionsOverlay.setEnabled(isBoardView); toggleHexCoords.setEnabled(isBoardView); viewLOSSetting.setEnabled(isInGameBoardView); @@ -487,6 +497,8 @@ public void preferenceChange(PreferenceChangeEvent e) { toggleFieldOfFire.setSelected((Boolean) e.getNewValue()); } else if (e.getName().equals(GUIPreferences.SHOW_KEYBINDS_OVERLAY)) { viewKeybindsOverlay.setSelected((Boolean) e.getNewValue()); + } else if (e.getName().equals(GUIPreferences.SHOW_PLANETARYCONDITIONS_OVERLAY)) { + viewPlanetaryConditionsOverlay.setSelected((Boolean) e.getNewValue()); } else if (e.getName().equals(GUIPreferences.SHOW_UNIT_OVERVIEW)) { viewUnitOverview.setSelected((Boolean) e.getNewValue()); } else if (e.getName().equals(GUIPreferences.GUI_SCALE)) { diff --git a/megamek/src/megamek/client/ui/swing/GUIPreferences.java b/megamek/src/megamek/client/ui/swing/GUIPreferences.java index 7f12221e644..845f3850e3e 100644 --- a/megamek/src/megamek/client/ui/swing/GUIPreferences.java +++ b/megamek/src/megamek/client/ui/swing/GUIPreferences.java @@ -254,6 +254,7 @@ public class GUIPreferences extends PreferenceStoreProxy { public static final String MY_UNIT_COLOR = "MyUnitColor"; public static final String ENEMY_UNIT_COLOR = "EnemyUnitColor"; public static final String SHOW_KEYBINDS_OVERLAY = "ShowKeybindsOverlay"; + public static final String SHOW_PLANETARYCONDITIONS_OVERLAY = "ShowPlanetaryConditionsOverlay"; public static final String UNIT_LABEL_STYLE = "UnitLabelStyle"; public static final String AS_CARD_FONT = "AsCardFont"; public static final String AS_CARD_SIZE = "AsCardSize"; @@ -543,6 +544,7 @@ protected GUIPreferences() { setDefault(TEAM_COLORING, true); setDefault(SHOW_KEYBINDS_OVERLAY, true); + setDefault(SHOW_PLANETARYCONDITIONS_OVERLAY, true); setDefault(AS_CARD_FONT, ""); setDefault(AS_CARD_SIZE, 0.75f); @@ -1745,6 +1747,10 @@ public void toggleKeybindsOverlay() { store.setValue(SHOW_KEYBINDS_OVERLAY, !getBoolean(SHOW_KEYBINDS_OVERLAY)); } + public void togglePlanetaryConditionsOverlay() { + store.setValue(SHOW_PLANETARYCONDITIONS_OVERLAY, !getBoolean(SHOW_PLANETARYCONDITIONS_OVERLAY)); + } + public LabelDisplayStyle getUnitLabelStyle() { try { return LabelDisplayStyle.valueOf(store.getString(UNIT_LABEL_STYLE)); diff --git a/megamek/src/megamek/client/ui/swing/boardview/BoardView.java b/megamek/src/megamek/client/ui/swing/boardview/BoardView.java index 62cc08af5f6..407aded90ec 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/BoardView.java +++ b/megamek/src/megamek/client/ui/swing/boardview/BoardView.java @@ -408,6 +408,8 @@ public class BoardView extends JPanel implements Scrollable, BoardListener, Mous /** A map overlay showing some important keybinds. */ KeyBindingsOverlay keybindOverlay; + + PlanetaryConditionsOverlay planetaryConditionsOverlay; /** The coords where the mouse was last. */ Coords lastCoords; @@ -433,6 +435,13 @@ public BoardView(final Game game, final MegaMekController controller, ClientGUI if (controller != null) { addDisplayable(keybindOverlay); } + + planetaryConditionsOverlay = new PlanetaryConditionsOverlay(game, clientgui); + // Avoid showing the planetary Conditions when they can't be used (in the lobby map preview) + if (controller != null) { + addDisplayable(planetaryConditionsOverlay); + } + ourTask = scheduleRedrawTimer(); // call only once clearSprites(); addMouseListener(this); @@ -887,6 +896,10 @@ public void preferenceChange(PreferenceChangeEvent e) { keybindOverlay.setVisible((boolean) e.getNewValue()); repaint(); break; + case GUIPreferences.SHOW_PLANETARYCONDITIONS_OVERLAY: + planetaryConditionsOverlay.setVisible((boolean) e.getNewValue()); + repaint(); + break; case GUIPreferences.AOHEXSHADOWS: case GUIPreferences.FLOATINGISO: diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java new file mode 100644 index 00000000000..d6d5263acce --- /dev/null +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -0,0 +1,278 @@ +/* +* MegaMek - Copyright (C) 2020 - The MegaMek Team +* +* This program is free software; you can redistribute it and/or modify it under +* the terms of the GNU General Public License as published by the Free Software +* Foundation; either version 2 of the License, or (at your option) any later +* version. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +* details. +*/ +package megamek.client.ui.swing.boardview; + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Composite; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Rectangle; +import java.awt.event.KeyEvent; +import java.util.ArrayList; +import java.util.List; + +import megamek.client.ui.IDisplayable; +import megamek.client.ui.Messages; +import megamek.client.ui.swing.ClientGUI; +import megamek.client.ui.swing.GUIPreferences; +import megamek.client.ui.swing.util.KeyCommandBind; +import megamek.common.Game; +import megamek.common.KeyBindParser; +import megamek.common.enums.GamePhase; +import megamek.common.event.GameListener; +import megamek.common.event.GameListenerAdapter; +import megamek.common.event.GamePhaseChangeEvent; +import megamek.common.event.GameTurnChangeEvent; +import megamek.common.preference.IPreferenceChangeListener; +import megamek.common.preference.PreferenceChangeEvent; +import megamek.common.util.ImageUtil; +import org.apache.logging.log4j.LogManager; + +/** + * An overlay for the Boardview that displays a selection of Planetary Conditions + * for the current game situation + * + * + */ +public class PlanetaryConditionsOverlay implements IDisplayable, IPreferenceChangeListener { + private static final Font FONT = new Font("SansSerif", Font.PLAIN, 13); + private static final int DIST_TOP = 30; + private static final int DIST_SIDE = 500; + private static final int PADDING_X = 10; + private static final int PADDING_Y = 5; + private static final Color TEXT_COLOR = new Color(200, 250, 200); + private static final Color SHADOW_COLOR = Color.DARK_GRAY; + private static final Color BG_COLOR = new Color(80, 80, 80, 200); + private static final float FADE_SPEED = 0.2f; + + + ClientGUI clientGui; + + /** True when the overlay is displayed or fading in. */ + private boolean visible; + /** True indicates the strings should be redrawn. */ + private boolean changed = true; + /** The cached image for this Display. */ + Image displayImage; + /** The current game phase. */ + GamePhase currentPhase; + + Game currentGame; + /** True while fading in this overlay. */ + private boolean fadingIn = false; + /** True while fading out this overlay. */ + private boolean fadingOut = false; + /** The transparency of the overlay. Only used while fading in/out. */ + private float alpha = 1; + + /** + * An overlay for the Boardview that displays a selection of Planetary Conditions + * for the current game situation. + */ + public PlanetaryConditionsOverlay(Game game, ClientGUI cg) { + visible = GUIPreferences.getInstance().getBoolean(GUIPreferences.SHOW_PLANETARYCONDITIONS_OVERLAY); + currentGame = game; + currentPhase = game.getPhase(); + game.addGameListener(gameListener); + clientGui = cg; + KeyBindParser.addPreferenceChangeListener(this); + } + + @Override + public void draw(Graphics graph, Rectangle clipBounds) { + if (!visible && !isSliding()) { + return; + } + + // At startup, phase and turn change and when the Planetary Conditions change, + // the cached image is (re)created + if (changed) { + changed = false; + + // calculate the size from the text lines, font and padding + graph.setFont(FONT); + FontMetrics fm = graph.getFontMetrics(FONT); + List allLines = assembleTextLines(); + Rectangle r = getSize(graph, allLines, fm); + r = new Rectangle(r.width + 2 * PADDING_X, r.height + 2 * PADDING_Y); + + displayImage = ImageUtil.createAcceleratedImage(r.width, r.height); + Graphics intGraph = displayImage.getGraphics(); + GUIPreferences.AntiAliasifSet(intGraph); + + // draw a semi-transparent background rectangle + intGraph.setColor(BG_COLOR); + intGraph.fillRoundRect(0, 0, r.width, r.height, PADDING_X, PADDING_X); + + // The coordinates to write the texts to + int x = PADDING_X; + int y = PADDING_Y + fm.getAscent(); + + // write the strings + for (String line: allLines) { + drawShadowedString(intGraph, line, x, y); + y += fm.getHeight(); + } + } + + // draw the cached image to the boardview + // uses Composite to draw the image with variable transparency + if (alpha < 1) { + // Save the former composite and set an alpha blending composite + Composite saveComp = ((Graphics2D) graph).getComposite(); + int type = AlphaComposite.SRC_OVER; + ((Graphics2D) graph).setComposite(AlphaComposite.getInstance(type, alpha)); + graph.drawImage(displayImage, clipBounds.x + DIST_SIDE, clipBounds.y + DIST_TOP, null); + ((Graphics2D) graph).setComposite(saveComp); + } else { + graph.drawImage(displayImage, clipBounds.x + DIST_SIDE, clipBounds.y + DIST_TOP, null); + } + } + + /** Calculates the pixel size of the display from the necessary text lines. */ + private Rectangle getSize(Graphics graph, List lines, FontMetrics fm) { + int width = 0; + for (String line: lines) { + if (fm.stringWidth(line) > width) { + width = fm.stringWidth(line); + } + } + int height = fm.getHeight() * lines.size(); + return new Rectangle(width, height); + } + + /** Returns an ArrayList of all text lines to be shown. */ + private List assembleTextLines() { + List result = new ArrayList<>(); + + KeyCommandBind kcb = KeyCommandBind.PLANETARY_CONDITIONS; + String mod = KeyEvent.getModifiersExText(kcb.modifiers); + String key = KeyEvent.getKeyText(kcb.key); + String toggleKey = (mod.isEmpty() ? "" : mod + "+") + key; + result.add(Messages.getString("PlanetaryConditions.heading", toggleKey)); + + if (clientGui != null) { + // In a game, not the Board Editor + result.add("Temperature (deg C): " + currentGame.getPlanetaryConditions().getTemperature()); + result.add("Gravity (g): " + currentGame.getPlanetaryConditions().getGravity()); + result.add("Light: " + currentGame.getPlanetaryConditions().getLightDisplayableName()); + result.add("Atmospheric Pressure: " + currentGame.getPlanetaryConditions().getAtmosphereDisplayableName()); + result.add("Weather: " + currentGame.getPlanetaryConditions().getWeatherDisplayableName()); + result.add("Wind: " + currentGame.getPlanetaryConditions().getWindDisplayableName()); + result.add("Wind Direction: " + currentGame.getPlanetaryConditions().getWindDirDisplayableName()); + result.add("Fog: " + currentGame.getPlanetaryConditions().getFogDisplayableName()); + } + + return result; + } + + /** + * Draws the String s to the Graphics graph at position x, y + * with a shadow. If the string starts with #789ABC then 789ABC + * is converted to a color to write the rest of the text, + * otherwise TEXT_COLOR is used. + */ + private void drawShadowedString(Graphics graph, String s, int x, int y) { + Color textColor = TEXT_COLOR; + // Extract a color code from the start of the string + // used to display headlines if it's there + if (s.startsWith("#") && s.length() > 7) { + try { + int red = Integer.parseInt(s.substring(1, 3), 16); + int grn = Integer.parseInt(s.substring(3, 5), 16); + int blu = Integer.parseInt(s.substring(5, 7), 16); + textColor = new Color(red, grn, blu); + } catch (Exception e) { + LogManager.getLogger().error("", e); + } + s = s.substring(7); + } + graph.setColor(SHADOW_COLOR); + graph.drawString(s, x + 1, y + 1); + graph.setColor(textColor); + graph.drawString(s, x, y); + } + + /** + * Activates or deactivates the overlay, fading it in or out. + * Also saves the visibility to the GUIPreferences so + * MegaMek remembers it. + * */ + public void setVisible(boolean vis) { + visible = vis; + GUIPreferences.getInstance().setValue(GUIPreferences.SHOW_PLANETARYCONDITIONS_OVERLAY, vis); + if (vis) { + fadingIn = true; + fadingOut = false; + } else { + fadingIn = false; + fadingOut = true; + } + } + + public boolean isVisible() { + return visible; + } + + @Override + public boolean isSliding() { + return fadingOut || fadingIn; + } + + @Override + public boolean slide() { + if (fadingIn) { + alpha += FADE_SPEED; + if (alpha > 1) { + alpha = 1; + fadingIn = false; + } + return true; + } else if (fadingOut) { + alpha -= FADE_SPEED; + if (alpha < 0) { + alpha = 0; + fadingOut = false; + } + return true; + } + return false; + } + + /** Detects phase and turn changes to display Planetary Conditions. */ + private GameListener gameListener = new GameListenerAdapter() { + @Override + public void gamePhaseChange(GamePhaseChangeEvent e) { + currentPhase = e.getNewPhase(); + changed = true; + } + + @Override + public void gameTurnChange(GameTurnChangeEvent e) { + // The active player has changed + changed = true; + } + }; + + @Override + public void preferenceChange(PreferenceChangeEvent e) { + if (e.getName().equals(KeyBindParser.KEYBINDS_CHANGED)) { + changed = true; + } + } +} diff --git a/megamek/src/megamek/client/ui/swing/util/KeyCommandBind.java b/megamek/src/megamek/client/ui/swing/util/KeyCommandBind.java index 5f24f8abf49..212d3670925 100644 --- a/megamek/src/megamek/client/ui/swing/util/KeyCommandBind.java +++ b/megamek/src/megamek/client/ui/swing/util/KeyCommandBind.java @@ -102,6 +102,7 @@ public enum KeyCommandBind { UNIT_DISPLAY(true, "toggleUnitDisplay", VK_D, CTRL_DOWN_MASK), UNIT_OVERVIEW(true, "toggleUnitOverview", VK_U, CTRL_DOWN_MASK), KEY_BINDS(true, "toggleKeybinds", VK_K, CTRL_DOWN_MASK), + PLANETARY_CONDITIONS(true, "togglePlanetaryConditions", VK_P, CTRL_DOWN_MASK), CLIENT_SETTINGS(true, "clientSettings", VK_C, ALT_DOWN_MASK), INC_GUISCALE(true, "incGuiScale", VK_ADD, CTRL_DOWN_MASK), DEC_GUISCALE(true, "decGuiScale", VK_SUBTRACT, CTRL_DOWN_MASK), From 8db8d9fc092a567d928b66437e2aea8de8fef812 Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Tue, 8 Nov 2022 12:30:45 -0500 Subject: [PATCH 02/18] RFE 426 overlay for Planetary Conditions update --- .../i18n/megamek/client/messages.properties | 7 +- megamek/mmconf/defaultKeyBinds.xml | 7 + .../client/ui/swing/GUIPreferences.java | 56 +++++++ .../boardview/PlanetaryConditionsOverlay.java | 59 +++++--- .../megamek/common/PlanetaryConditions.java | 141 ++++++++++++++++++ 5 files changed, 251 insertions(+), 19 deletions(-) diff --git a/megamek/i18n/megamek/client/messages.properties b/megamek/i18n/megamek/client/messages.properties index 3153f26eee9..52a8a8127bd 100644 --- a/megamek/i18n/megamek/client/messages.properties +++ b/megamek/i18n/megamek/client/messages.properties @@ -173,6 +173,11 @@ AdvancedOptions.MapTextColor.name=Map Text Color AdvancedOptions.WarningColor.name=Warning Color AdvancedOptions.TmmPipMode.name=TMM Pip Mode AdvancedOptions.TmmPipMode.tooltip=Show TMM value on unit: 0=No Pips 1=White Pips 2=Move Colored Pips +AdvancedOptions.PlanetaryConditionsColorTitle.name=Planetary Conditions Color Title +AdvancedOptions.PlanetaryConditionsColorText.name=Planetary Conditions Color Text +AdvancedOptions.PlanetaryConditionsColorCold.name=Planetary Conditions Color Cold +AdvancedOptions.PlanetaryConditionsColorHot.name=Planetary Conditions Color Hot +AdvancedOptions.PlanetaryConditionsColorBackground.name=Planetary Conditions Color Background #Board Editor BoardEditor.BridgeBuildingElevError=Bridge/Building Elevation is an offset from the surface of a hex and hence must be a positive value! @@ -1580,7 +1585,7 @@ KeyBindingsDisplay.fixedBinds=Toggle Unit Display and Minimap: Mouse Button 4\nZ KeyBindingsDisplay.fixedBindsBoardEd=Zoom: Mouse Wheel\nLeft-Click: Draw Hex (replace previous terrain)\nShift + Left-Click: Draw Hex (add to previous terrain)\nCtrl + Left-Click: Draw Hex with hex elevation\nAlt + Left-Click: Eyedropper tool\nDrag-Right Mouse Button: Pan Map KeyBindingsDisplay.heading=#FFFFFFKeyboard Shortcuts - press {0} to toggle this overlay -PlanetaryConditions.heading=#FFFFFFPlanetary Conditions - press {0} to toggle this overlay +PlanetaryConditions.heading=Planetary Conditions - press {0} to toggle this overlay #LOS / Ruler tool LOSDialog.inFirstHex=Unit type in the first hex: diff --git a/megamek/mmconf/defaultKeyBinds.xml b/megamek/mmconf/defaultKeyBinds.xml index 91628d1b021..a2ffc88a854 100644 --- a/megamek/mmconf/defaultKeyBinds.xml +++ b/megamek/mmconf/defaultKeyBinds.xml @@ -357,6 +357,13 @@ false + + togglePlanetaryConditionsOverlay + 80 + 128 + false + + clientSettings 67 diff --git a/megamek/src/megamek/client/ui/swing/GUIPreferences.java b/megamek/src/megamek/client/ui/swing/GUIPreferences.java index 845f3850e3e..51a1b7c8204 100644 --- a/megamek/src/megamek/client/ui/swing/GUIPreferences.java +++ b/megamek/src/megamek/client/ui/swing/GUIPreferences.java @@ -104,6 +104,11 @@ public class GUIPreferences extends PreferenceStoreProxy { public static final String ADVANCED_HEAT_COLOR_OVERHEAT = "AdvancedHeatColorOverheat"; public static final String ADVANCED_REPORT_COLOR_LINK = "AdvancedReportColorLink"; + public static final String ADVANCED_PLANETARY_CONDITIONS_COLOR_TITLE = "AdvancedPlanetaryConditionsColorTitle"; + public static final String ADVANCED_PLANETARY_CONDITIONS_COLOR_TEXT = "AdvancedPlanetaryConditionsColorText"; + public static final String ADVANCED_PLANETARY_CONDITIONS_COLOR_COLD = "AdvancedPlanetaryConditionsColorCold"; + public static final String ADVANCED_PLANETARY_CONDITIONS_COLOR_HOT = "AdvancedPlanetaryConditionsColorHot"; + public static final String ADVANCED_PLANETARY_CONDITIONS_COLOR_BACKGROUND = "AdvancedPlanetaryConditionsColorBackground"; /* --End advanced settings-- */ @@ -300,6 +305,11 @@ public class GUIPreferences extends PreferenceStoreProxy { private static final Color DEFAULT_HEAT_30_COLOR = new Color(248, 64, 64); private static final Color DEFAULT_HEAT_OVERHEAT_COLOR = new Color(248, 12, 12); + private static final Color DEFAULT_PLANETARY_CONDITIONS_TEXT_COLOR = new Color(200, 250, 200); + private static final Color DEFAULT_PLANETARY_CONDITIONS_COLD_COLOR = new Color(173, 216, 230); + private static final Color DEFAULT_PLANETARY_CONDITIONS_HOT_COLOR = new Color(255, 204, 203); + private static final Color DEFAULT_PLANETARY_CONDITIONS_BACKGROUND_COLOR = new Color(80, 80, 80); + // Report Color private static final Color DEFAULT_REPORT_LINK_COLOR = new Color(73, 102, 230); @@ -384,6 +394,12 @@ protected GUIPreferences() { setDefault(ADVANCED_HEAT_COLOR_20, DEFAULT_HEAT_30_COLOR); setDefault(ADVANCED_HEAT_COLOR_OVERHEAT, DEFAULT_HEAT_OVERHEAT_COLOR); + setDefault(ADVANCED_PLANETARY_CONDITIONS_COLOR_TITLE, Color.WHITE); + setDefault(ADVANCED_PLANETARY_CONDITIONS_COLOR_TEXT, DEFAULT_PLANETARY_CONDITIONS_TEXT_COLOR); + setDefault(ADVANCED_PLANETARY_CONDITIONS_COLOR_COLD, DEFAULT_PLANETARY_CONDITIONS_COLD_COLOR); + setDefault(ADVANCED_PLANETARY_CONDITIONS_COLOR_HOT, DEFAULT_PLANETARY_CONDITIONS_HOT_COLOR); + setDefault(ADVANCED_PLANETARY_CONDITIONS_COLOR_BACKGROUND, DEFAULT_PLANETARY_CONDITIONS_BACKGROUND_COLOR); + setDefault(ADVANCED_REPORT_COLOR_LINK, DEFAULT_REPORT_LINK_COLOR); store.setDefault(FOV_HIGHLIGHT_RINGS_RADII, "5 10 15 20 25"); @@ -1719,6 +1735,46 @@ public Color getReportLinkColor() { public void setReportLinkColor(Color color) { store.setValue(ADVANCED_REPORT_COLOR_LINK, getColorString(color)); } + + public Color getPlanetaryConditionsColorTitle() { + return getColor(ADVANCED_PLANETARY_CONDITIONS_COLOR_TITLE); + } + + public Color getPlanetaryConditionsColorText() { + return getColor(ADVANCED_PLANETARY_CONDITIONS_COLOR_TEXT); + } + + public Color getPlanetaryConditionsColorCold() { + return getColor(ADVANCED_PLANETARY_CONDITIONS_COLOR_COLD); + } + + public Color getPlanetaryConditionsColorHot() { + return getColor(ADVANCED_PLANETARY_CONDITIONS_COLOR_HOT); + } + + public Color getPlanetaryConditionsColorBackground() { + return getColor(ADVANCED_PLANETARY_CONDITIONS_COLOR_BACKGROUND); + } + public void setPlanetaryConditionsColorTitle(Color color) { + store.setValue(ADVANCED_PLANETARY_CONDITIONS_COLOR_TITLE, getColorString(color)); + } + + public void setPlanetaryConditionsColorText(Color color) { + store.setValue(ADVANCED_PLANETARY_CONDITIONS_COLOR_TEXT, getColorString(color)); + } + + public void setPlanetaryConditionsColorCold(Color color) { + store.setValue(ADVANCED_PLANETARY_CONDITIONS_COLOR_COLD, getColorString(color)); + } + + public void setPlanetaryConditionsColorHot(Color color) { + store.setValue(ADVANCED_PLANETARY_CONDITIONS_COLOR_HOT, getColorString(color)); + } + + public void setPlanetaryConditionsColorBackground(Color color) { + store.setValue(ADVANCED_PLANETARY_CONDITIONS_COLOR_BACKGROUND, getColorString(color)); + } + /** * Sets the user preference for the Unit Display window to active. */ diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java index d6d5263acce..1ecdee66023 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -33,6 +33,7 @@ import megamek.client.ui.swing.util.KeyCommandBind; import megamek.common.Game; import megamek.common.KeyBindParser; +import megamek.common.PlanetaryConditions; import megamek.common.enums.GamePhase; import megamek.common.event.GameListener; import megamek.common.event.GameListenerAdapter; @@ -55,9 +56,7 @@ public class PlanetaryConditionsOverlay implements IDisplayable, IPreferenceChan private static final int DIST_SIDE = 500; private static final int PADDING_X = 10; private static final int PADDING_Y = 5; - private static final Color TEXT_COLOR = new Color(200, 250, 200); private static final Color SHADOW_COLOR = Color.DARK_GRAY; - private static final Color BG_COLOR = new Color(80, 80, 80, 200); private static final float FADE_SPEED = 0.2f; @@ -98,6 +97,10 @@ public void draw(Graphics graph, Rectangle clipBounds) { if (!visible && !isSliding()) { return; } + + if ((clientGui == null) || (currentGame == null)) { + return; + } // At startup, phase and turn change and when the Planetary Conditions change, // the cached image is (re)created @@ -115,8 +118,9 @@ public void draw(Graphics graph, Rectangle clipBounds) { Graphics intGraph = displayImage.getGraphics(); GUIPreferences.AntiAliasifSet(intGraph); - // draw a semi-transparent background rectangle - intGraph.setColor(BG_COLOR); + // draw a semi-transparent background rectangle + Color colorBG = GUIPreferences.getInstance().getPlanetaryConditionsColorBackground(); + intGraph.setColor(new Color(colorBG.getRed(), colorBG.getGreen(), colorBG.getBlue(), 200)); intGraph.fillRoundRect(0, 0, r.width, r.height, PADDING_X, PADDING_X); // The coordinates to write the texts to @@ -129,7 +133,9 @@ public void draw(Graphics graph, Rectangle clipBounds) { y += fm.getHeight(); } } - + + int DistSide = clientGui.getWidth() - 500; + // draw the cached image to the boardview // uses Composite to draw the image with variable transparency if (alpha < 1) { @@ -137,10 +143,10 @@ public void draw(Graphics graph, Rectangle clipBounds) { Composite saveComp = ((Graphics2D) graph).getComposite(); int type = AlphaComposite.SRC_OVER; ((Graphics2D) graph).setComposite(AlphaComposite.getInstance(type, alpha)); - graph.drawImage(displayImage, clipBounds.x + DIST_SIDE, clipBounds.y + DIST_TOP, null); + graph.drawImage(displayImage, clipBounds.x + DistSide, clipBounds.y + DIST_TOP, null); ((Graphics2D) graph).setComposite(saveComp); } else { - graph.drawImage(displayImage, clipBounds.x + DIST_SIDE, clipBounds.y + DIST_TOP, null); + graph.drawImage(displayImage, clipBounds.x + DistSide, clipBounds.y + DIST_TOP, null); } } @@ -159,23 +165,39 @@ private Rectangle getSize(Graphics graph, List lines, FontMetrics fm) { /** Returns an ArrayList of all text lines to be shown. */ private List assembleTextLines() { List result = new ArrayList<>(); - + + Color colorTitle = GUIPreferences.getInstance().getPlanetaryConditionsColorTitle(); + Color colorHot = GUIPreferences.getInstance().getPlanetaryConditionsColorHot(); + Color colorCold = GUIPreferences.getInstance().getPlanetaryConditionsColorCold(); + KeyCommandBind kcb = KeyCommandBind.PLANETARY_CONDITIONS; String mod = KeyEvent.getModifiersExText(kcb.modifiers); String key = KeyEvent.getKeyText(kcb.key); String toggleKey = (mod.isEmpty() ? "" : mod + "+") + key; - result.add(Messages.getString("PlanetaryConditions.heading", toggleKey)); + result.add(String.format("#%02X%02X%02X", colorTitle.getRed(), colorTitle.getGreen(), colorTitle.getBlue()) + Messages.getString("PlanetaryConditions.heading", toggleKey)); if (clientGui != null) { // In a game, not the Board Editor - result.add("Temperature (deg C): " + currentGame.getPlanetaryConditions().getTemperature()); - result.add("Gravity (g): " + currentGame.getPlanetaryConditions().getGravity()); - result.add("Light: " + currentGame.getPlanetaryConditions().getLightDisplayableName()); - result.add("Atmospheric Pressure: " + currentGame.getPlanetaryConditions().getAtmosphereDisplayableName()); - result.add("Weather: " + currentGame.getPlanetaryConditions().getWeatherDisplayableName()); - result.add("Wind: " + currentGame.getPlanetaryConditions().getWindDisplayableName()); - result.add("Wind Direction: " + currentGame.getPlanetaryConditions().getWindDirDisplayableName()); - result.add("Fog: " + currentGame.getPlanetaryConditions().getFogDisplayableName()); + + String tempColor = ""; + int temp = currentGame.getPlanetaryConditions().getTemperature(); + + if (currentGame.getPlanetaryConditions().isExtremeTemperatureHot()) { + tempColor = String.format("#%02X%02X%02X", colorHot.getRed(), colorHot.getGreen(), colorHot.getBlue()); + } else if (currentGame.getPlanetaryConditions().isExtremeTemperatureCold()) { + tempColor = String.format("#%02X%02X%02X", colorCold.getRed(), colorCold.getGreen(), colorCold.getBlue()); + } + + result.add(tempColor + "Temperature (deg C): " + temp); + result.add("Gravity (g): " + currentGame.getPlanetaryConditions().getGravity()); + result.add("Light: " + currentGame.getPlanetaryConditions().getLightDisplayableName() + " " + currentGame.getPlanetaryConditions().getLightIndicator()); + result.add("Atmospheric Pressure: " + currentGame.getPlanetaryConditions().getAtmosphereDisplayableName() + " " + currentGame.getPlanetaryConditions().getAtmosphereIndicator()); + result.add("EMI: " + currentGame.getPlanetaryConditions().getEMIDisplayableValue()); + result.add("Weather: " + currentGame.getPlanetaryConditions().getWeatherDisplayableName() + " " + currentGame.getPlanetaryConditions().getWeatherIndicator()); + result.add("Wind: " + currentGame.getPlanetaryConditions().getWindDisplayableName() + " " + currentGame.getPlanetaryConditions().getWindStrengthIndicator()); + result.add("Wind Direction: " + currentGame.getPlanetaryConditions().getWindDirDisplayableName() + " " + currentGame.getPlanetaryConditions().getWindDirectionIndicator()); + result.add("Fog: " + currentGame.getPlanetaryConditions().getFogDisplayableName() + " " + currentGame.getPlanetaryConditions().getFogIndicator()); + result.add("Blowing Sand: " + currentGame.getPlanetaryConditions().getSandBlowingDisplayableValue()); } return result; @@ -188,7 +210,7 @@ private List assembleTextLines() { * otherwise TEXT_COLOR is used. */ private void drawShadowedString(Graphics graph, String s, int x, int y) { - Color textColor = TEXT_COLOR; + Color textColor = GUIPreferences.getInstance().getPlanetaryConditionsColorText(); // Extract a color code from the start of the string // used to display headlines if it's there if (s.startsWith("#") && s.length() > 7) { @@ -202,6 +224,7 @@ private void drawShadowedString(Graphics graph, String s, int x, int y) { } s = s.substring(7); } + graph.setColor(SHADOW_COLOR); graph.drawString(s, x + 1, y + 1); graph.setColor(textColor); diff --git a/megamek/src/megamek/common/PlanetaryConditions.java b/megamek/src/megamek/common/PlanetaryConditions.java index 4bca4e7510e..215a70c7448 100644 --- a/megamek/src/megamek/common/PlanetaryConditions.java +++ b/megamek/src/megamek/common/PlanetaryConditions.java @@ -1046,4 +1046,145 @@ private void doSandStormCheck() { public void setRunOnce(boolean run) { runOnce = run; } + + public boolean isExtremeTemperatureHot() { + return (isExtremeTemperature() && (temperature > 0)); + } + + public boolean isExtremeTemperatureCold() { + return (isExtremeTemperature() && (temperature < 0)); + } + + public String getLightIndicator() { + switch (lightConditions) { + case PlanetaryConditions.L_DAY: + return "\u2600"; + case PlanetaryConditions.L_DUSK: + return "\u263D \u263C"; + case PlanetaryConditions.L_FULL_MOON: + return "\u26AB"; + case PlanetaryConditions.L_MOONLESS: + return "\u26AA"; + case PlanetaryConditions.L_PITCH_BLACK: + return "\u2588"; + default: + return ""; + } + } + + public String getFogIndicator() { + switch (fog) { + case PlanetaryConditions.FOG_NONE: + return ""; + case PlanetaryConditions.FOG_LIGHT: + return "\u2601"; + case PlanetaryConditions.FOG_HEAVY: + return "\u2601 \u2601"; + default: + return ""; + } + } + + public String getWindStrengthIndicator() { + switch (windStrength) { + case PlanetaryConditions.WI_LIGHT_GALE: + return "\u21F6"; + case PlanetaryConditions.WI_MOD_GALE: + return "\u21F6\u21F6"; + case PlanetaryConditions.WI_STRONG_GALE: + return "\u21F6\u21F6\u21F6"; + case PlanetaryConditions.WI_STORM: + return "\u21F6\u21F6\u21F6\u21F6"; + case PlanetaryConditions.WI_TORNADO_F13: + return "\u21F6\u21F6\u21F6\u21F6\u21F6"; + case PlanetaryConditions.WI_TORNADO_F4: + return "\u21F6\u21F6\u21F6\u21F6\u21F6\u21F6"; + default: + return ""; + } + } + + public String getWindDirectionIndicator() { + switch (getWindDirDisplayableName()) { + case "North": + return "\u2193"; + case "Northeast": + return "\u2B0B"; + case "Southeast": + return "\u2B09"; + case "East": + return "\u2190"; + case "South": + return "\u2191"; + case "Southwest": + return "\u2B08"; + case "Northwest": + return "\u2B0A"; + case "West": + return "\u279D"; + case "RandomWindDirection": + return "\u267A"; + default: + return ""; + } + } + + public String getWeatherIndicator() { + switch (weatherConditions) { + case PlanetaryConditions.WE_NONE: + return ""; + case PlanetaryConditions.WE_LIGHT_RAIN: + return "\u26C8"; + case PlanetaryConditions.WE_MOD_RAIN: + return "\u26C8 \u26C8"; + case PlanetaryConditions.WE_HEAVY_RAIN: + return "\u26C8 \u26C8 \u26C8"; + case PlanetaryConditions.WE_GUSTING_RAIN: + return "\u26C8 \u26C8 \u26C8 \u26C8"; + case PlanetaryConditions.WE_DOWNPOUR: + return "\u26C8 \u26C8 \u26C8 \u26C8 \u26C8"; + case PlanetaryConditions.WE_LIGHT_SNOW: + return"\u2744"; + case PlanetaryConditions.WE_MOD_SNOW: + return"\u2744 \u2744"; + case PlanetaryConditions.WE_SNOW_FLURRIES: + return "\u2744 \u2744 \u2744"; + case PlanetaryConditions.WE_HEAVY_SNOW: + return "\u2744 \u2744 \u2744 \u2744"; + case PlanetaryConditions.WE_SLEET: + return "\u2745"; + case PlanetaryConditions.WE_ICE_STORM: + return "\u2745 \u26C8"; + default: + return ""; + } + } + + public String getAtmosphereIndicator() { + switch (atmosphere) { + case PlanetaryConditions.ATMO_VACUUM: + return "\u22C4"; + case PlanetaryConditions.ATMO_TRACE: + return "\u22C4 \u22C4"; + case PlanetaryConditions.ATMO_THIN: + return "\u22C4 \u22C4 \u22C4"; + case PlanetaryConditions.ATMO_STANDARD: + return "\u22C4 \u22C4 \u22C4 \u22C4"; + case PlanetaryConditions.ATMO_HIGH: + return "\u22C4 \u22C4 \u22C4 \u22C4 \u22C4"; + case PlanetaryConditions.ATMO_VHIGH: + return "\u22C4 \u22C4 \u22C4 \u22C4 \u22C4 \u22C4"; + default: + return ""; + } + } + + public String getEMIDisplayableValue() { + return hasEMI() ? "Yes" : "No"; + } + + public String getSandBlowingDisplayableValue() { + return isSandBlowing() ? "Yes" : "No"; + } + } From dce52a682f1f6802bdb07cb6d42fbc708b3a1b48 Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Tue, 8 Nov 2022 15:34:38 -0500 Subject: [PATCH 03/18] RFE 426 overlay for Planetary Conditions update 2 --- .../i18n/megamek/client/messages.properties | 1 + .../client/ui/swing/GUIPreferences.java | 10 ++++ .../boardview/PlanetaryConditionsOverlay.java | 48 +++++++++++++++---- .../megamek/common/PlanetaryConditions.java | 14 +++--- 4 files changed, 56 insertions(+), 17 deletions(-) diff --git a/megamek/i18n/megamek/client/messages.properties b/megamek/i18n/megamek/client/messages.properties index 52a8a8127bd..ac73c7ff531 100644 --- a/megamek/i18n/megamek/client/messages.properties +++ b/megamek/i18n/megamek/client/messages.properties @@ -178,6 +178,7 @@ AdvancedOptions.PlanetaryConditionsColorText.name=Planetary Conditions Color Tex AdvancedOptions.PlanetaryConditionsColorCold.name=Planetary Conditions Color Cold AdvancedOptions.PlanetaryConditionsColorHot.name=Planetary Conditions Color Hot AdvancedOptions.PlanetaryConditionsColorBackground.name=Planetary Conditions Color Background +AdvancedOptions.PlanetaryConditionsShowDefaults.name=Planetary Conditions Hide Default Conditons #Board Editor BoardEditor.BridgeBuildingElevError=Bridge/Building Elevation is an offset from the surface of a hex and hence must be a positive value! diff --git a/megamek/src/megamek/client/ui/swing/GUIPreferences.java b/megamek/src/megamek/client/ui/swing/GUIPreferences.java index 51a1b7c8204..73602896fdc 100644 --- a/megamek/src/megamek/client/ui/swing/GUIPreferences.java +++ b/megamek/src/megamek/client/ui/swing/GUIPreferences.java @@ -109,6 +109,7 @@ public class GUIPreferences extends PreferenceStoreProxy { public static final String ADVANCED_PLANETARY_CONDITIONS_COLOR_COLD = "AdvancedPlanetaryConditionsColorCold"; public static final String ADVANCED_PLANETARY_CONDITIONS_COLOR_HOT = "AdvancedPlanetaryConditionsColorHot"; public static final String ADVANCED_PLANETARY_CONDITIONS_COLOR_BACKGROUND = "AdvancedPlanetaryConditionsColorBackground"; + public static final String ADVANCED_PLANETARY_CONDITIONS_HIDE_DEFAULTS = "AdvancedPlanetaryConditionsShowDefaults"; /* --End advanced settings-- */ @@ -399,6 +400,7 @@ protected GUIPreferences() { setDefault(ADVANCED_PLANETARY_CONDITIONS_COLOR_COLD, DEFAULT_PLANETARY_CONDITIONS_COLD_COLOR); setDefault(ADVANCED_PLANETARY_CONDITIONS_COLOR_HOT, DEFAULT_PLANETARY_CONDITIONS_HOT_COLOR); setDefault(ADVANCED_PLANETARY_CONDITIONS_COLOR_BACKGROUND, DEFAULT_PLANETARY_CONDITIONS_BACKGROUND_COLOR); + setDefault(ADVANCED_PLANETARY_CONDITIONS_HIDE_DEFAULTS, false); setDefault(ADVANCED_REPORT_COLOR_LINK, DEFAULT_REPORT_LINK_COLOR); @@ -1755,6 +1757,10 @@ public Color getPlanetaryConditionsColorHot() { public Color getPlanetaryConditionsColorBackground() { return getColor(ADVANCED_PLANETARY_CONDITIONS_COLOR_BACKGROUND); } + + public Boolean getAdvancedPlanetaryConditionsHideDefaults() { + return getBoolean(ADVANCED_PLANETARY_CONDITIONS_HIDE_DEFAULTS); + } public void setPlanetaryConditionsColorTitle(Color color) { store.setValue(ADVANCED_PLANETARY_CONDITIONS_COLOR_TITLE, getColorString(color)); } @@ -1775,6 +1781,10 @@ public void setPlanetaryConditionsColorBackground(Color color) { store.setValue(ADVANCED_PLANETARY_CONDITIONS_COLOR_BACKGROUND, getColorString(color)); } + public void setAdvancedPlanetaryConditionsHideDefaults(Boolean state) { + store.setValue(ADVANCED_PLANETARY_CONDITIONS_HIDE_DEFAULTS, state); + } + /** * Sets the user preference for the Unit Display window to active. */ diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java index 1ecdee66023..152216c9d35 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -188,16 +188,44 @@ private List assembleTextLines() { tempColor = String.format("#%02X%02X%02X", colorCold.getRed(), colorCold.getGreen(), colorCold.getBlue()); } - result.add(tempColor + "Temperature (deg C): " + temp); - result.add("Gravity (g): " + currentGame.getPlanetaryConditions().getGravity()); - result.add("Light: " + currentGame.getPlanetaryConditions().getLightDisplayableName() + " " + currentGame.getPlanetaryConditions().getLightIndicator()); - result.add("Atmospheric Pressure: " + currentGame.getPlanetaryConditions().getAtmosphereDisplayableName() + " " + currentGame.getPlanetaryConditions().getAtmosphereIndicator()); - result.add("EMI: " + currentGame.getPlanetaryConditions().getEMIDisplayableValue()); - result.add("Weather: " + currentGame.getPlanetaryConditions().getWeatherDisplayableName() + " " + currentGame.getPlanetaryConditions().getWeatherIndicator()); - result.add("Wind: " + currentGame.getPlanetaryConditions().getWindDisplayableName() + " " + currentGame.getPlanetaryConditions().getWindStrengthIndicator()); - result.add("Wind Direction: " + currentGame.getPlanetaryConditions().getWindDirDisplayableName() + " " + currentGame.getPlanetaryConditions().getWindDirectionIndicator()); - result.add("Fog: " + currentGame.getPlanetaryConditions().getFogDisplayableName() + " " + currentGame.getPlanetaryConditions().getFogIndicator()); - result.add("Blowing Sand: " + currentGame.getPlanetaryConditions().getSandBlowingDisplayableValue()); + boolean hideDefaultConditions = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsHideDefaults(); + + if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().isExtremeTemperature())))) { + result.add(tempColor + "Temperature (deg C): " + temp); + } + + if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getGravity() != 1.0)))) { + result.add("Gravity (g): " + currentGame.getPlanetaryConditions().getGravity()); + } + + if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getLight() != PlanetaryConditions.L_DAY)))) { + result.add("Light: " + currentGame.getPlanetaryConditions().getLightDisplayableName() + " " + currentGame.getPlanetaryConditions().getLightIndicator()); + } + + if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getAtmosphere() != PlanetaryConditions.ATMO_STANDARD)))) { + result.add("Atmospheric Pressure: " + currentGame.getPlanetaryConditions().getAtmosphereDisplayableName() + " " + currentGame.getPlanetaryConditions().getAtmosphereIndicator()); + } + + if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().hasEMI())))) { + result.add("EMI: " + currentGame.getPlanetaryConditions().getEMIDisplayableValue()); + } + + if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getWeather() != PlanetaryConditions.WE_NONE)))) { + result.add("Weather: " + currentGame.getPlanetaryConditions().getWeatherDisplayableName() + " " + currentGame.getPlanetaryConditions().getWeatherIndicator()); + } + + if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getWindStrength() != PlanetaryConditions.WI_NONE)))) { + result.add("Wind: " + currentGame.getPlanetaryConditions().getWindDisplayableName() + " " + currentGame.getPlanetaryConditions().getWindStrengthIndicator()); + result.add("Wind Direction: " + currentGame.getPlanetaryConditions().getWindDirDisplayableName() + " " + currentGame.getPlanetaryConditions().getWindDirectionIndicator()); + } + + if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getFog() != PlanetaryConditions.FOG_NONE)))) { + result.add("Fog: " + currentGame.getPlanetaryConditions().getFogDisplayableName() + " " + currentGame.getPlanetaryConditions().getFogIndicator()); + } + + if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().isSandBlowing())))) { + result.add("Blowing Sand: " + currentGame.getPlanetaryConditions().getSandBlowingDisplayableValue()); + } } return result; diff --git a/megamek/src/megamek/common/PlanetaryConditions.java b/megamek/src/megamek/common/PlanetaryConditions.java index 215a70c7448..5edbffa9f70 100644 --- a/megamek/src/megamek/common/PlanetaryConditions.java +++ b/megamek/src/megamek/common/PlanetaryConditions.java @@ -1077,9 +1077,9 @@ public String getFogIndicator() { case PlanetaryConditions.FOG_NONE: return ""; case PlanetaryConditions.FOG_LIGHT: - return "\u2601"; + return "\u2588"; case PlanetaryConditions.FOG_HEAVY: - return "\u2601 \u2601"; + return "\u2588 \u2588"; default: return ""; } @@ -1134,15 +1134,15 @@ public String getWeatherIndicator() { case PlanetaryConditions.WE_NONE: return ""; case PlanetaryConditions.WE_LIGHT_RAIN: - return "\u26C8"; + return "\u2601"; case PlanetaryConditions.WE_MOD_RAIN: - return "\u26C8 \u26C8"; + return "\u2601 \u2601"; case PlanetaryConditions.WE_HEAVY_RAIN: - return "\u26C8 \u26C8 \u26C8"; + return "\u2601 \u2601 \u2601"; case PlanetaryConditions.WE_GUSTING_RAIN: - return "\u26C8 \u26C8 \u26C8 \u26C8"; + return "\u2601 \u2601 \u2601 \u2601"; case PlanetaryConditions.WE_DOWNPOUR: - return "\u26C8 \u26C8 \u26C8 \u26C8 \u26C8"; + return "\u2601 \u2601 \u2601 \u2601 \u2601"; case PlanetaryConditions.WE_LIGHT_SNOW: return"\u2744"; case PlanetaryConditions.WE_MOD_SNOW: From d80eb95e571e8ac4015349ef9b7c86a1690dd99a Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Tue, 8 Nov 2022 18:50:07 -0500 Subject: [PATCH 04/18] RFE 426 overlay for Planetary Conditions update 3 --- megamek/mmconf/defaultKeyBinds.xml | 4 ++-- megamek/src/megamek/common/PlanetaryConditions.java | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/megamek/mmconf/defaultKeyBinds.xml b/megamek/mmconf/defaultKeyBinds.xml index a2ffc88a854..c4fe389f7e5 100644 --- a/megamek/mmconf/defaultKeyBinds.xml +++ b/megamek/mmconf/defaultKeyBinds.xml @@ -162,7 +162,7 @@ - viewActingUnit + viewActingUnit 86 0 false @@ -358,7 +358,7 @@ - togglePlanetaryConditionsOverlay + togglePlanetaryConditions 80 128 false diff --git a/megamek/src/megamek/common/PlanetaryConditions.java b/megamek/src/megamek/common/PlanetaryConditions.java index 5edbffa9f70..89d1a12e72a 100644 --- a/megamek/src/megamek/common/PlanetaryConditions.java +++ b/megamek/src/megamek/common/PlanetaryConditions.java @@ -1163,17 +1163,17 @@ public String getWeatherIndicator() { public String getAtmosphereIndicator() { switch (atmosphere) { case PlanetaryConditions.ATMO_VACUUM: - return "\u22C4"; + return "\u2727"; case PlanetaryConditions.ATMO_TRACE: - return "\u22C4 \u22C4"; + return "\u2727 \u2727"; case PlanetaryConditions.ATMO_THIN: - return "\u22C4 \u22C4 \u22C4"; + return "\u2727 \u2727 \u2727"; case PlanetaryConditions.ATMO_STANDARD: - return "\u22C4 \u22C4 \u22C4 \u22C4"; + return "\u2727 \u2727 \u2727 \u25AE"; case PlanetaryConditions.ATMO_HIGH: - return "\u22C4 \u22C4 \u22C4 \u22C4 \u22C4"; + return "\u2727 \u2727 \u2727 \u25AE \u2726"; case PlanetaryConditions.ATMO_VHIGH: - return "\u22C4 \u22C4 \u22C4 \u22C4 \u22C4 \u22C4"; + return "\u2727 \u2727 \u2727 \u25AE \u2726 \u2726"; default: return ""; } From 32e89f94b3ac29a1237b4c4283bba566e7cd2500 Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Tue, 8 Nov 2022 19:32:00 -0500 Subject: [PATCH 05/18] RFE 426 overlay for Planetary Conditions update 4 --- megamek/src/megamek/common/PlanetaryConditions.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/megamek/src/megamek/common/PlanetaryConditions.java b/megamek/src/megamek/common/PlanetaryConditions.java index 89d1a12e72a..6b2fd5a9872 100644 --- a/megamek/src/megamek/common/PlanetaryConditions.java +++ b/megamek/src/megamek/common/PlanetaryConditions.java @@ -1152,9 +1152,9 @@ public String getWeatherIndicator() { case PlanetaryConditions.WE_HEAVY_SNOW: return "\u2744 \u2744 \u2744 \u2744"; case PlanetaryConditions.WE_SLEET: - return "\u2745"; + return "\u26C6"; case PlanetaryConditions.WE_ICE_STORM: - return "\u2745 \u26C8"; + return "\u26C6 \u26C6"; default: return ""; } From 486dd08da87b60f5c6f39830c02402a1ba3a20bd Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Tue, 8 Nov 2022 22:59:46 -0500 Subject: [PATCH 06/18] RFE 426 overlay for Planetary Conditions update 5 --- megamek/src/megamek/common/PlanetaryConditions.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/megamek/src/megamek/common/PlanetaryConditions.java b/megamek/src/megamek/common/PlanetaryConditions.java index 6b2fd5a9872..cb700f18d62 100644 --- a/megamek/src/megamek/common/PlanetaryConditions.java +++ b/megamek/src/megamek/common/PlanetaryConditions.java @@ -1096,9 +1096,9 @@ public String getWindStrengthIndicator() { case PlanetaryConditions.WI_STORM: return "\u21F6\u21F6\u21F6\u21F6"; case PlanetaryConditions.WI_TORNADO_F13: - return "\u21F6\u21F6\u21F6\u21F6\u21F6"; + return "\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A"; case PlanetaryConditions.WI_TORNADO_F4: - return "\u21F6\u21F6\u21F6\u21F6\u21F6\u21F6"; + return "\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A"; default: return ""; } From 1474a8d4764637d88805bdf6bf9cee8a2c395558 Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Wed, 9 Nov 2022 05:51:22 -0500 Subject: [PATCH 07/18] RFE 426 overlay for Planetary Conditions update 6 --- .../boardview/PlanetaryConditionsOverlay.java | 8 +-- .../megamek/common/PlanetaryConditions.java | 52 ++++++++++++++++--- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java index 152216c9d35..37514b08d02 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -191,11 +191,11 @@ private List assembleTextLines() { boolean hideDefaultConditions = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsHideDefaults(); if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().isExtremeTemperature())))) { - result.add(tempColor + "Temperature (deg C): " + temp); + result.add(tempColor + "Temperature (deg C): " + temp + " " + currentGame.getPlanetaryConditions().getTemperatureIndicator()); } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getGravity() != 1.0)))) { - result.add("Gravity (g): " + currentGame.getPlanetaryConditions().getGravity()); + result.add("Gravity (g): " + currentGame.getPlanetaryConditions().getGravity() + " " + currentGame.getPlanetaryConditions().getGravityIndicator()); } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getLight() != PlanetaryConditions.L_DAY)))) { @@ -207,7 +207,7 @@ private List assembleTextLines() { } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().hasEMI())))) { - result.add("EMI: " + currentGame.getPlanetaryConditions().getEMIDisplayableValue()); + result.add("EMI: " + currentGame.getPlanetaryConditions().getEMIDisplayableValue() + " " + currentGame.getPlanetaryConditions().getEMIIndicator()); } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getWeather() != PlanetaryConditions.WE_NONE)))) { @@ -224,7 +224,7 @@ private List assembleTextLines() { } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().isSandBlowing())))) { - result.add("Blowing Sand: " + currentGame.getPlanetaryConditions().getSandBlowingDisplayableValue()); + result.add("Blowing Sand: " + currentGame.getPlanetaryConditions().getSandBlowingDisplayableValue() + " " + currentGame.getPlanetaryConditions().getSandBlowingIndicator()); } } diff --git a/megamek/src/megamek/common/PlanetaryConditions.java b/megamek/src/megamek/common/PlanetaryConditions.java index cb700f18d62..3130890bbd7 100644 --- a/megamek/src/megamek/common/PlanetaryConditions.java +++ b/megamek/src/megamek/common/PlanetaryConditions.java @@ -1163,22 +1163,62 @@ public String getWeatherIndicator() { public String getAtmosphereIndicator() { switch (atmosphere) { case PlanetaryConditions.ATMO_VACUUM: - return "\u2727"; + return "\u2726 \u2727 \u2727 \u25AF \u2727 \u2727"; case PlanetaryConditions.ATMO_TRACE: - return "\u2727 \u2727"; + return "\u2726 \u2726 \u2727 \u25AF \u2727 \u2727"; case PlanetaryConditions.ATMO_THIN: - return "\u2727 \u2727 \u2727"; + return "\u2726 \u2726 \u2726 \u25AF \u2727 \u2727"; case PlanetaryConditions.ATMO_STANDARD: - return "\u2727 \u2727 \u2727 \u25AE"; + return "\u2726 \u2726 \u2726 \u25AE \u2727 \u2727"; case PlanetaryConditions.ATMO_HIGH: - return "\u2727 \u2727 \u2727 \u25AE \u2726"; + return "\u2726 \u2726 \u2726 \u25AE \u2726 \u2727"; case PlanetaryConditions.ATMO_VHIGH: - return "\u2727 \u2727 \u2727 \u25AE \u2726 \u2726"; + return "\u2726 \u2726 \u2726 \u25AE \u2726 \u2726"; default: return ""; } } + public String getGravityIndicator() { + if (gravity > 1.0) { + return "\u2B73"; + } + else if ((gravity < 1.0)) { + return "\u2B71"; + } + + return ""; + } + + public String getTemperatureIndicator() { + if (isExtremeTemperatureHot()) { + return "\uD83D\uDD25"; + } + else if (isExtremeTemperatureCold()) { + return "\u2744"; + } + + return ""; + } + + public String getEMIIndicator() { + if (hasEMI()) { + return "\u2713"; + } + else { + return "\u274C"; + } + } + + public String getSandBlowingIndicator() { + if (hasEMI()) { + return "\u2713"; + } + else { + return "\u274C"; + } + } + public String getEMIDisplayableValue() { return hasEMI() ? "Yes" : "No"; } From 2889a263602ade3c1555c8fecab87d477f55579f Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Wed, 9 Nov 2022 06:18:57 -0500 Subject: [PATCH 08/18] RFE 426 overlay for Planetary Conditions update 6 --- .../megamek/common/PlanetaryConditions.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/megamek/src/megamek/common/PlanetaryConditions.java b/megamek/src/megamek/common/PlanetaryConditions.java index 3130890bbd7..83afc7750b2 100644 --- a/megamek/src/megamek/common/PlanetaryConditions.java +++ b/megamek/src/megamek/common/PlanetaryConditions.java @@ -1077,7 +1077,7 @@ public String getFogIndicator() { case PlanetaryConditions.FOG_NONE: return ""; case PlanetaryConditions.FOG_LIGHT: - return "\u2588"; + return "\u2588 \u2022"; case PlanetaryConditions.FOG_HEAVY: return "\u2588 \u2588"; default: @@ -1088,15 +1088,15 @@ public String getFogIndicator() { public String getWindStrengthIndicator() { switch (windStrength) { case PlanetaryConditions.WI_LIGHT_GALE: - return "\u21F6"; + return "\u21F6 \u2022 \u2022 \u2022"; case PlanetaryConditions.WI_MOD_GALE: - return "\u21F6\u21F6"; + return "\u21F6 \u21F6 \u2022 \u2022"; case PlanetaryConditions.WI_STRONG_GALE: - return "\u21F6\u21F6\u21F6"; + return "\u21F6 \u21F6 \u21F6 \u2022"; case PlanetaryConditions.WI_STORM: - return "\u21F6\u21F6\u21F6\u21F6"; + return "\u21F6 \u21F6 \u21F6 \u21F6"; case PlanetaryConditions.WI_TORNADO_F13: - return "\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A"; + return "\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A \u2022"; case PlanetaryConditions.WI_TORNADO_F4: return "\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A"; default: @@ -1134,25 +1134,25 @@ public String getWeatherIndicator() { case PlanetaryConditions.WE_NONE: return ""; case PlanetaryConditions.WE_LIGHT_RAIN: - return "\u2601"; + return "\u2601 \u2022 \u2022 \u2022 \u2022"; case PlanetaryConditions.WE_MOD_RAIN: - return "\u2601 \u2601"; + return "\u2601 \u2601 \u2022 \u2022 \u2022"; case PlanetaryConditions.WE_HEAVY_RAIN: - return "\u2601 \u2601 \u2601"; + return "\u2601 \u2601 \u2601 \u2022 \u2022"; case PlanetaryConditions.WE_GUSTING_RAIN: - return "\u2601 \u2601 \u2601 \u2601"; + return "\u2601 \u2601 \u2601 \u2601 \u2022"; case PlanetaryConditions.WE_DOWNPOUR: return "\u2601 \u2601 \u2601 \u2601 \u2601"; case PlanetaryConditions.WE_LIGHT_SNOW: - return"\u2744"; + return"\u2744 \u2022 \u2022 \u2022"; case PlanetaryConditions.WE_MOD_SNOW: - return"\u2744 \u2744"; + return"\u2744 \u2744 \u2022 \u2022"; case PlanetaryConditions.WE_SNOW_FLURRIES: - return "\u2744 \u2744 \u2744"; + return "\u2744 \u2744 \u2744 \u2022"; case PlanetaryConditions.WE_HEAVY_SNOW: return "\u2744 \u2744 \u2744 \u2744"; case PlanetaryConditions.WE_SLEET: - return "\u26C6"; + return "\u26C6 \u2022"; case PlanetaryConditions.WE_ICE_STORM: return "\u26C6 \u26C6"; default: From 574bfa9b877646548fd76c16ee9f58a38732295d Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Wed, 9 Nov 2022 13:27:17 -0500 Subject: [PATCH 09/18] RFE 426 overlay for Planetary Conditions update 8 --- .../i18n/megamek/client/messages.properties | 14 +- .../i18n/megamek/common/messages.properties | 60 +++- .../boardview/PlanetaryConditionsOverlay.java | 37 +- .../megamek/common/PlanetaryConditions.java | 336 ++++++++++-------- 4 files changed, 289 insertions(+), 158 deletions(-) diff --git a/megamek/i18n/megamek/client/messages.properties b/megamek/i18n/megamek/client/messages.properties index ac73c7ff531..7cf36d47068 100644 --- a/megamek/i18n/megamek/client/messages.properties +++ b/megamek/i18n/megamek/client/messages.properties @@ -1586,8 +1586,6 @@ KeyBindingsDisplay.fixedBinds=Toggle Unit Display and Minimap: Mouse Button 4\nZ KeyBindingsDisplay.fixedBindsBoardEd=Zoom: Mouse Wheel\nLeft-Click: Draw Hex (replace previous terrain)\nShift + Left-Click: Draw Hex (add to previous terrain)\nCtrl + Left-Click: Draw Hex with hex elevation\nAlt + Left-Click: Eyedropper tool\nDrag-Right Mouse Button: Pan Map KeyBindingsDisplay.heading=#FFFFFFKeyboard Shortcuts - press {0} to toggle this overlay -PlanetaryConditions.heading=Planetary Conditions - press {0} to toggle this overlay - #LOS / Ruler tool LOSDialog.inFirstHex=Unit type in the first hex: LOSDialog.InSecondHex=Unit type in the second hex: @@ -2350,6 +2348,18 @@ PlanetaryConditionsDialog.header.general=General Settings PlanetaryConditionsDialog.header.weather=Weather PlanetaryConditionsDialog.header.dynamic=Dynamic Wind Settings +PlanetaryConditionsOverlay.heading=Planetary Conditions - press {0} to toggle this overlay +PlanetaryConditionsOverlay.Temperature=Temperature (deg C): +PlanetaryConditionsOverlay.Gravity=Gravity (g): +PlanetaryConditionsOverlay.Light=Light: +PlanetaryConditionsOverlay.AtmosphericPressure=Atmospheric Pressure: +PlanetaryConditionsOverlay.EMI=EMI: +PlanetaryConditionsOverlay.Weather=Weather: +PlanetaryConditionsOverlay.Wind=Wind: +PlanetaryConditionsOverlay.WindDirection=Wind Direction: +PlanetaryConditionsOverlay.Fog=Fog: +PlanetaryConditionsOverlay.BlowingSand=Blowing Sand: + #Lobby Player List Information PlayerListDialog.player_done=\ (Done) PlayerListDialog.player_ghost=\ [Ghost] diff --git a/megamek/i18n/megamek/common/messages.properties b/megamek/i18n/megamek/common/messages.properties index 76689d4629d..f5188356876 100644 --- a/megamek/i18n/megamek/common/messages.properties +++ b/megamek/i18n/megamek/common/messages.properties @@ -240,12 +240,70 @@ PlanetaryConditions.Heavy\ Fog=Heavy Fog PlanetaryConditions.RandomWindDirection=Random PlanetaryConditions.North=North PlanetaryConditions.Northeast=Northeast +PlanetaryConditions.East=East PlanetaryConditions.Southeast=Southeast PlanetaryConditions.South=South PlanetaryConditions.Southwest=Southwest -PlanetaryConditions.Northwest=Northwest +PlanetaryConditions.West=West +PlanetaryConditions.Northwest=NorthWest PlanetaryConditions.ExtremeHeat=Extreme Heat PlanetaryConditions.ExtremeCold=Extreme Cold +PlanetaryConditions.Name.SandBlowing.true=Yes +PlanetaryConditions.Name.SandBlowing.false=No +PlanetaryConditions.Name.EMI.true=Yes +PlanetaryConditions.Name.EMI.false=No +PlanetaryConditions.Indicator.Light.Day=\u2600 +PlanetaryConditions.Indicator.Light.Dusk=\u263D \u263C +PlanetaryConditions.Indicator.Light.FullMoon=\u26AB +PlanetaryConditions.Indicator.Light.Moonless=\u26AA +PlanetaryConditions.Indicator.Light.PitchBlack=\u2588 +PlanetaryConditions.Indicator.Fog.None= +PlanetaryConditions.Indicator.Fog.Light=\u2588 \u2022 +PlanetaryConditions.Indicator.Fog.Heavy=\u2588 \u2588 +PlanetaryConditions.Indicator.WindStrength.Calm= +PlanetaryConditions.Indicator.WindStrength.LightGale=\u21F6 \u2022 \u2022 \u2022 +PlanetaryConditions.Indicator.WindStrength.ModGale=\u21F6 \u21F6 \u2022 \u2022 +PlanetaryConditions.Indicator.WindStrength.StrongGale=\u21F6 \u21F6 \u21F6 \u2022 +PlanetaryConditions.Indicator.WindStrength.Storm=\u21F6 \u21F6 \u21F6 \u21F6 +PlanetaryConditions.Indicator.WindStrength.TornadoF13=\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A \u2022 +PlanetaryConditions.Indicator.WindStrength.TornadoF4=\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A +PlanetaryConditions.Indicator.WindDirection.North=\u2193 +PlanetaryConditions.Indicator.WindDirection.Northeast=\u2B0B +PlanetaryConditions.Indicator.WindDirection.East=\u2190 +PlanetaryConditions.Indicator.WindDirection.Southeast=\u2B09 +PlanetaryConditions.Indicator.WindDirection.South=\u2191 +PlanetaryConditions.Indicator.WindDirection.Southwest=\u2B08 +PlanetaryConditions.Indicator.WindDirection.West=\u279D +PlanetaryConditions.Indicator.WindDirection.Northwest=\u2B0A +PlanetaryConditions.Indicator.WindDirection.RandomWindDirection= +PlanetaryConditions.Indicator.Weather.None= +PlanetaryConditions.Indicator.Weather.LightRain=\u2601 \u2022 \u2022 \u2022 \u2022 +PlanetaryConditions.Indicator.Weather.ModRain=\u2601 \u2601 \u2022 \u2022 \u2022 +PlanetaryConditions.Indicator.Weather.HeavyRain=\u2601 \u2601 \u2601 \u2022 \u2022 +PlanetaryConditions.Indicator.Weather.GustingRain=\u2601 \u2601 \u2601 \u2601 \u2022 +PlanetaryConditions.Indicator.Weather.Downpour=\u2601 \u2601 \u2601 \u2601 \u2601 +PlanetaryConditions.Indicator.Weather.LightSnow=\u2744 \u2022 \u2022 \u2022 +PlanetaryConditions.Indicator.Weather.ModSnow=\u2744 \u2744 \u2022 \u2022 +PlanetaryConditions.Indicator.Weather.SnowFlurries=\u2744 \u2744 \u2744 \u2022 +PlanetaryConditions.Indicator.Weather.HeavySnow=\u2744 \u2744 \u2744 \u2744 +PlanetaryConditions.Indicator.Weather.Sleet=\u26C6 \u2022 +PlanetaryConditions.Indicator.Weather.IceStorm=\u26C6 \u26C6 +PlanetaryConditions.Indicator.Atmosphere.Vacuum=\u2726 \u2727 \u2727 \u25AF \u2727 \u2727 +PlanetaryConditions.Indicator.Atmosphere.Trace=\u2726 \u2726 \u2727 \u25AF \u2727 \u2727 +PlanetaryConditions.Indicator.Atmosphere.Thin=\u2726 \u2726 \u2726 \u25AF \u2727 \u2727 +PlanetaryConditions.Indicator.Atmosphere.Standard=\u2726 \u2726 \u2726 \u25AE \u2727 \u2727 +PlanetaryConditions.Indicator.Atmosphere.High=\u2726 \u2726 \u2726 \u25AE \u2726 \u2727 +PlanetaryConditions.Indicator.Atmosphere.VHigh=\u2726 \u2726 \u2726 \u25AE \u2726 \u2726 +PlanetaryConditions.Indicator.Gravity.High=\u2B73 +PlanetaryConditions.Indicator.Gravity.Low=\u2B71 +PlanetaryConditions.Indicator.Gravity.Normal= +PlanetaryConditions.Indicator.Temperature.ExtremeHeat=\uD83D\uDD25 +PlanetaryConditions.Indicator.Temperature.ExtremeCold=\u2744 +PlanetaryConditions.Indicator.Temperature.Normal= +PlanetaryConditions.Indicator.EMI.true=\u2713 +PlanetaryConditions.Indicator.EMI.false=\u274C +PlanetaryConditions.Indicator.SandBlowing.true=\u2713 +PlanetaryConditions.Indicator.SandBlowing.false=\u274C UnitType.Aero=Aerospace Fighter UnitType.BattleArmor=Battle Armor UnitType.Conventional\ Fighter=Conventional Fighter diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java index 37514b08d02..48036bcf344 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -23,6 +23,7 @@ import java.awt.Image; import java.awt.Rectangle; import java.awt.event.KeyEvent; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; @@ -79,6 +80,18 @@ public class PlanetaryConditionsOverlay implements IDisplayable, IPreferenceChan /** The transparency of the overlay. Only used while fading in/out. */ private float alpha = 1; + private static final String PC_OVERLAY_HEADING = Messages.getString("PlanetaryConditionsOverlay.heading"); + private static final String PC_OVERLAY_TEMPERATURE = Messages.getString("PlanetaryConditionsOverlay.Temperature"); + private static final String PC_OVERLAY_GRAVITY = Messages.getString("PlanetaryConditionsOverlay.Gravity"); + private static final String PC_OVERLAY_LIGHT = Messages.getString("PlanetaryConditionsOverlay.Light"); + private static final String PC_OVERLAY_ATMOSPHERICPREASSURE = Messages.getString("PlanetaryConditionsOverlay.AtmosphericPressure"); + private static final String PC_OVERLAY_EMI = Messages.getString("PlanetaryConditionsOverlay.EMI"); + private static final String PC_OVERLAY_WEATHER = Messages.getString("PlanetaryConditionsOverlay.Weather"); + private static final String PC_OVERLAY_WIND = Messages.getString("PlanetaryConditionsOverlay.Wind"); + private static final String PC_OVERLAY_DIRECTION = Messages.getString("PlanetaryConditionsOverlay.WindDirection"); + private static final String PC_OVERLAY_FOG = Messages.getString("PlanetaryConditionsOverlay.Fog"); + private static final String PC_OVERLAY_BLOWINGSAND = Messages.getString("PlanetaryConditionsOverlay.BlowingSand"); + /** * An overlay for the Boardview that displays a selection of Planetary Conditions * for the current game situation. @@ -174,7 +187,7 @@ private List assembleTextLines() { String mod = KeyEvent.getModifiersExText(kcb.modifiers); String key = KeyEvent.getKeyText(kcb.key); String toggleKey = (mod.isEmpty() ? "" : mod + "+") + key; - result.add(String.format("#%02X%02X%02X", colorTitle.getRed(), colorTitle.getGreen(), colorTitle.getBlue()) + Messages.getString("PlanetaryConditions.heading", toggleKey)); + result.add(String.format("#%02X%02X%02X", colorTitle.getRed(), colorTitle.getGreen(), colorTitle.getBlue()) + MessageFormat.format(PC_OVERLAY_HEADING, toggleKey)); if (clientGui != null) { // In a game, not the Board Editor @@ -182,7 +195,7 @@ private List assembleTextLines() { String tempColor = ""; int temp = currentGame.getPlanetaryConditions().getTemperature(); - if (currentGame.getPlanetaryConditions().isExtremeTemperatureHot()) { + if (currentGame.getPlanetaryConditions().isExtremeTemperatureHeat()) { tempColor = String.format("#%02X%02X%02X", colorHot.getRed(), colorHot.getGreen(), colorHot.getBlue()); } else if (currentGame.getPlanetaryConditions().isExtremeTemperatureCold()) { tempColor = String.format("#%02X%02X%02X", colorCold.getRed(), colorCold.getGreen(), colorCold.getBlue()); @@ -191,40 +204,40 @@ private List assembleTextLines() { boolean hideDefaultConditions = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsHideDefaults(); if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().isExtremeTemperature())))) { - result.add(tempColor + "Temperature (deg C): " + temp + " " + currentGame.getPlanetaryConditions().getTemperatureIndicator()); + result.add(tempColor + PC_OVERLAY_TEMPERATURE + " " + temp + " " + currentGame.getPlanetaryConditions().getTemperatureIndicator()); } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getGravity() != 1.0)))) { - result.add("Gravity (g): " + currentGame.getPlanetaryConditions().getGravity() + " " + currentGame.getPlanetaryConditions().getGravityIndicator()); + result.add(PC_OVERLAY_GRAVITY + " " + currentGame.getPlanetaryConditions().getGravity() + " " + currentGame.getPlanetaryConditions().getGravityIndicator()); } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getLight() != PlanetaryConditions.L_DAY)))) { - result.add("Light: " + currentGame.getPlanetaryConditions().getLightDisplayableName() + " " + currentGame.getPlanetaryConditions().getLightIndicator()); + result.add(PC_OVERLAY_LIGHT + " " + currentGame.getPlanetaryConditions().getLightDisplayableName() + " " + currentGame.getPlanetaryConditions().getLightIndicator()); } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getAtmosphere() != PlanetaryConditions.ATMO_STANDARD)))) { - result.add("Atmospheric Pressure: " + currentGame.getPlanetaryConditions().getAtmosphereDisplayableName() + " " + currentGame.getPlanetaryConditions().getAtmosphereIndicator()); + result.add(PC_OVERLAY_ATMOSPHERICPREASSURE + " " + currentGame.getPlanetaryConditions().getAtmosphereDisplayableName() + " " + currentGame.getPlanetaryConditions().getAtmosphereIndicator()); } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().hasEMI())))) { - result.add("EMI: " + currentGame.getPlanetaryConditions().getEMIDisplayableValue() + " " + currentGame.getPlanetaryConditions().getEMIIndicator()); + result.add(PC_OVERLAY_EMI + " " + currentGame.getPlanetaryConditions().getEMIDisplayableValue() + " " + currentGame.getPlanetaryConditions().getEMIIndicator()); } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getWeather() != PlanetaryConditions.WE_NONE)))) { - result.add("Weather: " + currentGame.getPlanetaryConditions().getWeatherDisplayableName() + " " + currentGame.getPlanetaryConditions().getWeatherIndicator()); + result.add(PC_OVERLAY_WEATHER + " " + currentGame.getPlanetaryConditions().getWeatherDisplayableName() + " " + currentGame.getPlanetaryConditions().getWeatherIndicator()); } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getWindStrength() != PlanetaryConditions.WI_NONE)))) { - result.add("Wind: " + currentGame.getPlanetaryConditions().getWindDisplayableName() + " " + currentGame.getPlanetaryConditions().getWindStrengthIndicator()); - result.add("Wind Direction: " + currentGame.getPlanetaryConditions().getWindDirDisplayableName() + " " + currentGame.getPlanetaryConditions().getWindDirectionIndicator()); + result.add(PC_OVERLAY_WIND + " " + currentGame.getPlanetaryConditions().getWindDisplayableName() + " " + currentGame.getPlanetaryConditions().getWindStrengthIndicator()); + result.add(PC_OVERLAY_DIRECTION + " " + currentGame.getPlanetaryConditions().getWindDirDisplayableName() + " " + currentGame.getPlanetaryConditions().getWindDirectionIndicator()); } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getFog() != PlanetaryConditions.FOG_NONE)))) { - result.add("Fog: " + currentGame.getPlanetaryConditions().getFogDisplayableName() + " " + currentGame.getPlanetaryConditions().getFogIndicator()); + result.add(PC_OVERLAY_FOG + " " + currentGame.getPlanetaryConditions().getFogDisplayableName() + " " + currentGame.getPlanetaryConditions().getFogIndicator()); } if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().isSandBlowing())))) { - result.add("Blowing Sand: " + currentGame.getPlanetaryConditions().getSandBlowingDisplayableValue() + " " + currentGame.getPlanetaryConditions().getSandBlowingIndicator()); + result.add(PC_OVERLAY_BLOWINGSAND + " " + currentGame.getPlanetaryConditions().getSandBlowingDisplayableValue() + " " + currentGame.getPlanetaryConditions().getSandBlowingIndicator()); } } diff --git a/megamek/src/megamek/common/PlanetaryConditions.java b/megamek/src/megamek/common/PlanetaryConditions.java index 83afc7750b2..449f00625c5 100644 --- a/megamek/src/megamek/common/PlanetaryConditions.java +++ b/megamek/src/megamek/common/PlanetaryConditions.java @@ -34,9 +34,21 @@ public class PlanetaryConditions implements Serializable { public static final int L_FULL_MOON = 2; public static final int L_MOONLESS = 3; public static final int L_PITCH_BLACK = 4; - private static String[] lightNames = { "Daylight", "Dusk", "Full Moon Night", "Moonless Night", - "Pitch Black" }; + private static final String PC_NAME_LIGHT_DAYLIGHT = Messages.getString("PlanetaryConditions.Daylight"); + private static final String PC_NAME_LIGHT_DUSK = Messages.getString("PlanetaryConditions.Dusk"); + private static final String PC_NAME_LIGHT_FULLMOONNIGHT = Messages.getString("PlanetaryConditions.Full Moon Night"); + private static final String PC_NAME_LIGHT_MOONLESSNIGHT = Messages.getString("PlanetaryConditions.Moonless Night"); + private static final String PC_NAME_LIGHT_PITCHBLACK = Messages.getString("PlanetaryConditions.Pitch Black"); + private static String[] lightNames = { PC_NAME_LIGHT_DAYLIGHT, PC_NAME_LIGHT_DUSK, PC_NAME_LIGHT_FULLMOONNIGHT, + PC_NAME_LIGHT_MOONLESSNIGHT, PC_NAME_LIGHT_PITCHBLACK }; public static final int L_SIZE = lightNames.length; + private static final String PC_INDICATOR_LIGHT_DAY = Messages.getString("PlanetaryConditions.Indicator.Light.Day"); + private static final String PC_INDICATOR_LIGHT_DUSK = Messages.getString("PlanetaryConditions.Indicator.Light.Dusk"); + private static final String PC_INDICATOR_LIGHT_FULL_MOON = Messages.getString("PlanetaryConditions.Indicator.Light.FullMoon"); + private static final String PC_INDICATOR_LIGHT_MOONLESS = Messages.getString("PlanetaryConditions.Indicator.Light.Moonless"); + private static final String PC_INDICATOR_LIGHT_PITCH_BLACK = Messages.getString("PlanetaryConditions.Indicator.Light.PitchBlack"); + private static String[] lightIndicators = { PC_INDICATOR_LIGHT_DAY, PC_INDICATOR_LIGHT_DUSK, PC_INDICATOR_LIGHT_FULL_MOON, + PC_INDICATOR_LIGHT_MOONLESS, PC_INDICATOR_LIGHT_PITCH_BLACK }; // Weather public static final int WE_NONE = 0; @@ -55,10 +67,39 @@ public class PlanetaryConditions implements Serializable { public static final int WE_HEAVY_HAIL = 13;// NYI public static final int WE_LIGHTNING_STORM = 14;// NYI // public static final int WE_BLIZZARD = 11; does not exist anymore - private static String[] weatherNames = { "Clear", "Light Rain", "Moderate Rain", "Heavy Rain", "Gusting Rain", "Torrential Downpour", - "Light Snowfall", "Moderate Snowfall", "Snow Flurries", "Heavy Snowfall", "Sleet", - "Ice Storm" };//, "Light Hail", "Heavy Hail", "Lightning Storm" }; + private static final String PC_NAME_WEATHER_CLEAR = Messages.getString("PlanetaryConditions.Clear"); + private static final String PC_NAME_WEATHER_LIGHTRAIN = Messages.getString("PlanetaryConditions.Light Rain"); + private static final String PC_NAME_WEATHER_MODRAIN = Messages.getString("PlanetaryConditions.Moderate Rain"); + private static final String PC_NAME_WEATHER_HEAVYGRAIN = Messages.getString("PlanetaryConditions.Heavy Rain"); + private static final String PC_NAME_WEATHER_GUSTINGRAIN = Messages.getString("PlanetaryConditions.Gusting Rain"); + private static final String PC_NAME_WEATHER_TORRDOWNPOUR = Messages.getString("PlanetaryConditions.Torrential Downpour"); + private static final String PC_NAME_WEATHER_LIGHTSNOWFALL = Messages.getString("PlanetaryConditions.Light Snowfall"); + private static final String PC_NAME_WEATHER_MODSNOWFALL = Messages.getString("PlanetaryConditions.Moderate Snowfall"); + private static final String PC_NAME_WEATHER_SNOWFLUFFIES = Messages.getString("PlanetaryConditions.Snow Flurries"); + private static final String PC_NAME_WEATHER_HEAVYSNOWFALL = Messages.getString("PlanetaryConditions.Heavy Snowfall"); + private static final String PC_NAME_WEATHER_SLEET = Messages.getString("PlanetaryConditions.Sleet"); + private static final String PC_NAME_WEATHER_ICESTORM = Messages.getString("PlanetaryConditions.Ice Storm"); + private static String[] weatherNames = { PC_NAME_WEATHER_CLEAR, PC_NAME_WEATHER_LIGHTRAIN, PC_NAME_WEATHER_MODRAIN, + PC_NAME_WEATHER_HEAVYGRAIN, PC_NAME_WEATHER_GUSTINGRAIN, PC_NAME_WEATHER_TORRDOWNPOUR, + PC_NAME_WEATHER_LIGHTSNOWFALL, PC_NAME_WEATHER_MODSNOWFALL, PC_NAME_WEATHER_SNOWFLUFFIES, + PC_NAME_WEATHER_HEAVYSNOWFALL, PC_NAME_WEATHER_SLEET, PC_NAME_WEATHER_ICESTORM };//, "Light Hail", "Heavy Hail", "Lightning Storm" }; public static final int WE_SIZE = weatherNames.length; + private static final String PC_INDICATOR_WEATHER_NONE = Messages.getString("PlanetaryConditions.Indicator.Weather.None"); + private static final String PC_INDICATOR_WEATHER_LIGHT_RAIN = Messages.getString("PlanetaryConditions.Indicator.Weather.LightRain"); + private static final String PC_INDICATOR_WEATHER_MOD_RAIN = Messages.getString("PlanetaryConditions.Indicator.Weather.ModRain"); + private static final String PC_INDICATOR_WEATHER_HEAVY_RAIN = Messages.getString("PlanetaryConditions.Indicator.Weather.HeavyRain"); + private static final String PC_INDICATOR_WEATHER_GUSTING_RAIN = Messages.getString("PlanetaryConditions.Indicator.Weather.GustingRain"); + private static final String PC_INDICATOR_WEATHER_DOWNPOUR = Messages.getString("PlanetaryConditions.Indicator.Weather.Downpour"); + private static final String PC_INDICATOR_WEATHER_LIGHT_SNOW = Messages.getString("PlanetaryConditions.Indicator.Weather.LightSnow"); + private static final String PC_INDICATOR_WEATHER_MOD_SNOW = Messages.getString("PlanetaryConditions.Indicator.Weather.ModSnow"); + private static final String PC_INDICATOR_WEATHER_SNOW_FLURRIES = Messages.getString("PlanetaryConditions.Indicator.Weather.SnowFlurries"); + private static final String PC_INDICATOR_WEATHER_HEAVY_SNOW = Messages.getString("PlanetaryConditions.Indicator.Weather.HeavySnow"); + private static final String PC_INDICATOR_WEATHER_SLEET = Messages.getString("PlanetaryConditions.Indicator.Weather.Sleet"); + private static final String PC_INDICATOR_WEATHER_ICE_STORM = Messages.getString("PlanetaryConditions.Indicator.Weather.IceStorm"); + private static String[] weatherIndicators = { PC_INDICATOR_WEATHER_NONE, PC_INDICATOR_WEATHER_LIGHT_RAIN, PC_INDICATOR_WEATHER_MOD_RAIN, + PC_INDICATOR_WEATHER_HEAVY_RAIN, PC_INDICATOR_WEATHER_GUSTING_RAIN, PC_INDICATOR_WEATHER_DOWNPOUR, + PC_INDICATOR_WEATHER_LIGHT_SNOW, PC_INDICATOR_WEATHER_MOD_SNOW, PC_INDICATOR_WEATHER_SNOW_FLURRIES, + PC_INDICATOR_WEATHER_HEAVY_SNOW, PC_INDICATOR_WEATHER_SLEET, PC_INDICATOR_WEATHER_ICE_STORM}; // Wind public static final int WI_NONE = 0; @@ -68,15 +109,57 @@ public class PlanetaryConditions implements Serializable { public static final int WI_STORM = 4; public static final int WI_TORNADO_F13 = 5; public static final int WI_TORNADO_F4 = 6; - - private static String[] windNames = { "Calm", "Light Gale", "Moderate Gale", "Strong Gale", "Storm", "Tornado F1-F3", "Tornado F4" }; + private static final String PC_NAME_WINDSTRENGTH_LIGHT_CALM = Messages.getString("PlanetaryConditions.Calm"); + private static final String PC_NAME_WINDSTRENGTH_LIGHT_GALE = Messages.getString("PlanetaryConditions.Light Gale"); + private static final String PC_NAME_WINDSTRENGTH_MOD_GALE = Messages.getString("PlanetaryConditions.Moderate Gale"); + private static final String PC_NAME_WINDSTRENGTH_STRONG_GALE = Messages.getString("PlanetaryConditions.Strong Gale"); + private static final String PC_NAME_WINDSTRENGTH_STORM = Messages.getString("PlanetaryConditions.Storm"); + private static final String PC_NAME_WINDSTRENGTH_TORNADO_F13 = Messages.getString("PlanetaryConditions.Tornado F1-F3"); + private static final String PC_NAME_WINDSTRENGTH_TORNADO_F4 = Messages.getString("PlanetaryConditions.Tornado F4"); + private static String[] windNames = { PC_NAME_WINDSTRENGTH_LIGHT_CALM, PC_NAME_WINDSTRENGTH_LIGHT_GALE, + PC_NAME_WINDSTRENGTH_MOD_GALE, PC_NAME_WINDSTRENGTH_STRONG_GALE, + PC_NAME_WINDSTRENGTH_STORM, PC_NAME_WINDSTRENGTH_TORNADO_F13, + PC_NAME_WINDSTRENGTH_TORNADO_F4 }; public static final int WI_SIZE = windNames.length; + private static final String PC_INDICATOR_WINDSTRENGTH_LIGHT_CALM = Messages.getString("PlanetaryConditions.Indicator.WindStrength.Calm"); + private static final String PC_INDICATOR_WINDSTRENGTH_LIGHT_GALE = Messages.getString("PlanetaryConditions.Indicator.WindStrength.LightGale"); + private static final String PC_INDICATOR_WINDSTRENGTH_MOD_GALE = Messages.getString("PlanetaryConditions.Indicator.WindStrength.ModGale"); + private static final String PC_INDICATOR_WINDSTRENGTH_STRONG_GALE = Messages.getString("PlanetaryConditions.Indicator.WindStrength.StrongGale"); + private static final String PC_INDICATOR_WINDSTRENGTH_STORM = Messages.getString("PlanetaryConditions.Indicator.WindStrength.Storm"); + private static final String PC_INDICATOR_WINDSTRENGTH_TORNADO_F13 = Messages.getString("PlanetaryConditions.Indicator.WindStrength.TornadoF13"); + private static final String PC_INDICATOR_WINDSTRENGTH_TORNADO_F4 = Messages.getString("PlanetaryConditions.Indicator.WindStrength.TornadoF4"); + private static String[] windStrengthIndicators = { PC_INDICATOR_WINDSTRENGTH_LIGHT_CALM, PC_INDICATOR_WINDSTRENGTH_LIGHT_GALE, + PC_INDICATOR_WINDSTRENGTH_MOD_GALE, PC_INDICATOR_WINDSTRENGTH_STRONG_GALE, + PC_INDICATOR_WINDSTRENGTH_STORM, PC_INDICATOR_WINDSTRENGTH_TORNADO_F13, + PC_INDICATOR_WINDSTRENGTH_TORNADO_F4 }; // wind direction - private static String[] dirNames = { "North", "Northeast", "Southeast", "South", "Southwest", "Northwest", "RandomWindDirection" }; + private static final String PC_NAME_WINDDIRECTION_NORTH = Messages.getString("PlanetaryConditions.North"); + private static final String PC_NAME_WINDDIRECTION_NORTHEAST = Messages.getString("PlanetaryConditions.Northeast"); + private static final String PC_NAME_WINDDIRECTION_EAST = Messages.getString("PlanetaryConditions.East"); + private static final String PC_NAME_WINDDIRECTION_SOUTHEAST = Messages.getString("PlanetaryConditions.Southeast"); + private static final String PC_NAME_WINDDIRECTION_SOUTH = Messages.getString("PlanetaryConditions.South"); + private static final String PC_NAME_WINDDIRECTION_SOUTHWEST = Messages.getString("PlanetaryConditions.Southwest"); + private static final String PC_NAME_WINDDIRECTION_WEST = Messages.getString("PlanetaryConditions.West"); + private static final String PC_NAME_WINDDIRECTION_NORTHWEST = Messages.getString("PlanetaryConditions.Northwest"); + private static final String PC_NAME_WINDDIRECTION_RANDOM = Messages.getString("PlanetaryConditions.RandomWindDirection"); + private static String[] dirNames = { PC_NAME_WINDDIRECTION_NORTH, PC_NAME_WINDDIRECTION_NORTHEAST, PC_NAME_WINDDIRECTION_EAST, + PC_NAME_WINDDIRECTION_SOUTHEAST, PC_NAME_WINDDIRECTION_SOUTH, PC_NAME_WINDDIRECTION_SOUTHWEST, + PC_NAME_WINDDIRECTION_WEST, PC_NAME_WINDDIRECTION_NORTHWEST, PC_NAME_WINDDIRECTION_RANDOM }; public static final int DIR_SIZE = dirNames.length; - public static final int DIR_RANDOM = 6; - + public static final int DIR_RANDOM = 8; + private static final String PC_INDICATOR_WINDDIRECTION_NORTH = Messages.getString("PlanetaryConditions.Indicator.WindDirection.North"); + private static final String PC_INDICATOR_WINDDIRECTION_NORTHEAST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Northeast"); + private static final String PC_INDICATOR_WINDDIRECTION_EAST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.East"); + private static final String PC_INDICATOR_WINDDIRECTION_SOUTHEAST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Southeast"); + private static final String PC_INDICATOR_WINDDIRECTION_SOUTH = Messages.getString("PlanetaryConditions.Indicator.WindDirection.South"); + private static final String PC_INDICATOR_WINDDIRECTION_SOUTHWEST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Southwest"); + private static final String PC_INDICATOR_WINDDIRECTION_WEST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.West"); + private static final String PC_INDICATOR_WINDDIRECTION_NORTHWEST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Northwest"); + private static final String PC_INDICATOR_WINDDIRECTION_RANDOM = Messages.getString("PlanetaryConditions.Indicator.WindDirection.RandomWindDirection"); + private static String[] windDirectionIndicators = { PC_INDICATOR_WINDDIRECTION_NORTH, PC_INDICATOR_WINDDIRECTION_NORTHEAST, PC_INDICATOR_WINDDIRECTION_EAST, + PC_INDICATOR_WINDDIRECTION_SOUTHEAST, PC_INDICATOR_WINDDIRECTION_SOUTH, PC_INDICATOR_WINDDIRECTION_SOUTHWEST, + PC_INDICATOR_WINDDIRECTION_WEST, PC_INDICATOR_WINDDIRECTION_NORTHWEST, PC_INDICATOR_WINDDIRECTION_RANDOM }; // atmospheric pressure public static final int ATMO_VACUUM = 0; @@ -85,9 +168,23 @@ public class PlanetaryConditions implements Serializable { public static final int ATMO_STANDARD = 3; public static final int ATMO_HIGH = 4; public static final int ATMO_VHIGH = 5; - - public static String[] atmoNames = { "Vacuum", "Trace", "Thin", "Standard", "High", "Very High" }; + private static final String PC_NAME_ATMOSPHERE_VACUUM = Messages.getString("PlanetaryConditions.Vacuum"); + private static final String PC_NAME_ATMOSPHERE_TRACE = Messages.getString("PlanetaryConditions.Trace"); + private static final String PC_NAME_ATMOSPHERE_THIN = Messages.getString("PlanetaryConditions.Thin"); + private static final String PC_NAME_ATMOSPHERE_STANDARD = Messages.getString("PlanetaryConditions.Standard"); + private static final String PC_NAME_ATMOSPHERE_HIGH = Messages.getString("PlanetaryConditions.High"); + private static final String PC_NAME_ATMOSPHERE_VHIGH = Messages.getString("PlanetaryConditions.Very High"); + public static String[] atmoNames = { PC_NAME_ATMOSPHERE_VACUUM, PC_NAME_ATMOSPHERE_TRACE, PC_NAME_ATMOSPHERE_THIN, + PC_NAME_ATMOSPHERE_STANDARD, PC_NAME_ATMOSPHERE_HIGH, PC_NAME_ATMOSPHERE_VHIGH }; public static final int ATMO_SIZE = atmoNames.length; + private static final String PC_INDICATOR_ATMOSPHERE_VACUUM = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.Vacuum"); + private static final String PC_INDICATOR_ATMOSPHERE_TRACE = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.Trace"); + private static final String PC_INDICATOR_ATMOSPHERE_THIN = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.Thin"); + private static final String PC_INDICATOR_ATMOSPHERE_STANDARD = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.Standard"); + private static final String PC_INDICATOR_ATMOSPHERE_HIGH = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.High"); + private static final String PC_INDICATOR_ATMOSPHERE_VHIGH = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.VHigh"); + private static String[] atmosphereIndicators = { PC_INDICATOR_ATMOSPHERE_VACUUM, PC_INDICATOR_ATMOSPHERE_TRACE, PC_INDICATOR_ATMOSPHERE_THIN, + PC_INDICATOR_ATMOSPHERE_STANDARD ,PC_INDICATOR_ATMOSPHERE_HIGH ,PC_INDICATOR_ATMOSPHERE_VHIGH }; // fog public static final int FOG_NONE = 0; @@ -96,9 +193,18 @@ public class PlanetaryConditions implements Serializable { private static String[] fogNames = { "None", "Light Fog", "Heavy Fog" }; public static final int FOG_SIZE = fogNames.length; + private static final String PC_INDICATOR_FOG_NONE = Messages.getString("PlanetaryConditions.Indicator.Fog.None"); + private static final String PC_INDICATOR_FOG_LIGHT = Messages.getString("PlanetaryConditions.Indicator.Fog.Light"); + private static final String PC_INDICATOR_FOG_HEAVY = Messages.getString("PlanetaryConditions.Indicator.Fog.Heavy"); + private static String[] fogIndicators = { PC_INDICATOR_FOG_NONE, PC_INDICATOR_FOG_LIGHT, PC_INDICATOR_FOG_HEAVY }; // misc private boolean blowingSand = false; + private static final String PC_INDICATOR_BLOWINGSAND_TRUE = Messages.getString("PlanetaryConditions.Indicator.SandBlowing.true"); + private static final String PC_INDICATOR_BLOWINGSAND_FALSE = Messages.getString("PlanetaryConditions.Indicator.SandBlowing.false"); + private static final String PC_NAME_BLOWINGSAND_TRUE = Messages.getString("PlanetaryConditions.Name.SandBlowing.true"); + private static final String PC_NAME_BLOWINGSAND_FALSE = Messages.getString("PlanetaryConditions.Name.SandBlowing.false"); + private boolean sandStorm = false; private boolean runOnce = false; @@ -115,8 +221,20 @@ public class PlanetaryConditions implements Serializable { private int fog = FOG_NONE; private int temperature = 25; private int oldTemperature = 25; + private static final String PC_NAME_TEMPERATURE_HEAT = Messages.getString("PlanetaryConditions.ExtremeHeat"); + private static final String PC_NAME_TEMPERATURE_COLD = Messages.getString("PlanetaryConditions.ExtremeCold"); + private static final String PC_INDICATOR_TEMPERATURE_HEAT= Messages.getString("PlanetaryConditions.Indicator.Temperature.ExtremeHeat"); + private static final String PC_INDICATOR_TEMPERATURE_COLD = Messages.getString("PlanetaryConditions.Indicator.Temperature.ExtremeCold"); + private static final String PC_INDICATOR_TEMPERATURE_NORMAL = Messages.getString("PlanetaryConditions.Indicator.Temperature.Normal"); private float gravity = (float) 1.0; + private static final String PC_INDICATOR_GRAVITY_HIGH = Messages.getString("PlanetaryConditions.Indicator.Gravity.High"); + private static final String PC_INDICATOR_GRAVITY_LOW= Messages.getString("PlanetaryConditions.Indicator.Gravity.Low"); + private static final String PC_INDICATOR_GRAVITY_NORMAL = Messages.getString("PlanetaryConditions.Indicator.Gravity.Normal"); private boolean emi = false; + private static final String PC_INDICATOR_EMI_TRUE = Messages.getString("PlanetaryConditions.Indicator.EMI.true"); + private static final String PC_INDICATOR_EMI_FALSE = Messages.getString("PlanetaryConditions.Indicator.EMI.false"); + private static final String PC_NAME_EMI_TRUE = Messages.getString("PlanetaryConditions.Name.EMI.true"); + private static final String PC_NAME_EMI_FALSE = Messages.getString("PlanetaryConditions.Name.EMI.false"); private boolean terrainAffected = true; private int maxWindStrength = PlanetaryConditions.WI_TORNADO_F4; private int minWindStrength = PlanetaryConditions.WI_NONE; @@ -156,23 +274,23 @@ public Object clone() { public static String getLightDisplayableName(int type) { if ((type >= 0) && (type < L_SIZE)) { - return Messages.getString("PlanetaryConditions." + lightNames[type]); + return lightNames[type]; } throw new IllegalArgumentException("Unknown light condition"); } public static String getWeatherDisplayableName(int type) { if ((type >= 0) && (type < WE_SIZE)) { - return Messages.getString("PlanetaryConditions." + weatherNames[type]); + return weatherNames[type]; } throw new IllegalArgumentException("Unknown weather condition"); } public static String getTemperatureDisplayableName(int temp) { if (isExtremeTemperature(temp) && (temp > 0)) { - return String.format("%d (%s)", temp, Messages.getString("PlanetaryConditions.ExtremeHeat")); + return String.format("%d (%s)", temp, PC_NAME_TEMPERATURE_HEAT); } else if (isExtremeTemperature(temp) && (temp <= 0)) { - return String.format("%d (%s)", temp, Messages.getString("PlanetaryConditions.ExtremeCold")); + return String.format("%d (%s)", temp, PC_NAME_TEMPERATURE_COLD); } else { return String.valueOf(temp); } @@ -180,28 +298,28 @@ public static String getTemperatureDisplayableName(int temp) { public static String getWindDirDisplayableName(int type) { if ((type >= 0) && (type < DIR_SIZE)) { - return Messages.getString("PlanetaryConditions." + dirNames[type]); + return dirNames[type]; } throw new IllegalArgumentException("Unknown wind direction"); } public static String getWindDisplayableName(int type) { if ((type >= 0) && (type < WI_SIZE)) { - return Messages.getString("PlanetaryConditions." + windNames[type]); + return windNames[type]; } throw new IllegalArgumentException("Unknown wind condition"); } public static String getAtmosphereDisplayableName(int type) { if ((type >= 0) && (type < ATMO_SIZE)) { - return Messages.getString("PlanetaryConditions." + atmoNames[type]); + return atmoNames[type]; } throw new IllegalArgumentException("Unknown atmospheric pressure condition"); } public static String getFogDisplayableName(int type) { if ((type >= 0) && (type < FOG_SIZE)) { - return Messages.getString("PlanetaryConditions." + fogNames[type]); + return fogNames[type]; } throw new IllegalArgumentException("Unknown fog condition"); } @@ -1047,7 +1165,7 @@ public void setRunOnce(boolean run) { runOnce = run; } - public boolean isExtremeTemperatureHot() { + public boolean isExtremeTemperatureHeat() { return (isExtremeTemperature() && (temperature > 0)); } @@ -1055,176 +1173,108 @@ public boolean isExtremeTemperatureCold() { return (isExtremeTemperature() && (temperature < 0)); } + public String getLightIndicator(int type) { + if ((type >= 0) && (type < L_SIZE)) { + return lightIndicators[type]; + } + throw new IllegalArgumentException("Unknown light Indicator"); + } + public String getLightIndicator() { - switch (lightConditions) { - case PlanetaryConditions.L_DAY: - return "\u2600"; - case PlanetaryConditions.L_DUSK: - return "\u263D \u263C"; - case PlanetaryConditions.L_FULL_MOON: - return "\u26AB"; - case PlanetaryConditions.L_MOONLESS: - return "\u26AA"; - case PlanetaryConditions.L_PITCH_BLACK: - return "\u2588"; - default: - return ""; + return getLightIndicator(lightConditions); + } + + public String getFogIndicator(int type) { + if ((type >= 0) && (type < FOG_SIZE)) { + return fogIndicators[type]; } + throw new IllegalArgumentException("Unknown Fog Indicator"); } public String getFogIndicator() { - switch (fog) { - case PlanetaryConditions.FOG_NONE: - return ""; - case PlanetaryConditions.FOG_LIGHT: - return "\u2588 \u2022"; - case PlanetaryConditions.FOG_HEAVY: - return "\u2588 \u2588"; - default: - return ""; + return getFogIndicator(fog); + } + + public String getWindStrengthIndicator(int type) { + if ((type >= 0) && (type < WI_SIZE)) { + return windStrengthIndicators[type]; } + throw new IllegalArgumentException("Unknown Wind Strength Indicator"); } public String getWindStrengthIndicator() { - switch (windStrength) { - case PlanetaryConditions.WI_LIGHT_GALE: - return "\u21F6 \u2022 \u2022 \u2022"; - case PlanetaryConditions.WI_MOD_GALE: - return "\u21F6 \u21F6 \u2022 \u2022"; - case PlanetaryConditions.WI_STRONG_GALE: - return "\u21F6 \u21F6 \u21F6 \u2022"; - case PlanetaryConditions.WI_STORM: - return "\u21F6 \u21F6 \u21F6 \u21F6"; - case PlanetaryConditions.WI_TORNADO_F13: - return "\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A \u2022"; - case PlanetaryConditions.WI_TORNADO_F4: - return "\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A"; - default: - return ""; + return getWindStrengthIndicator(windStrength); + } + + public String getWindDirectionIndicator(int type) { + if ((type >= 0) && (type < DIR_SIZE)) { + return windDirectionIndicators[type]; } + throw new IllegalArgumentException("Unknown Wind Direction Indicator"); } public String getWindDirectionIndicator() { - switch (getWindDirDisplayableName()) { - case "North": - return "\u2193"; - case "Northeast": - return "\u2B0B"; - case "Southeast": - return "\u2B09"; - case "East": - return "\u2190"; - case "South": - return "\u2191"; - case "Southwest": - return "\u2B08"; - case "Northwest": - return "\u2B0A"; - case "West": - return "\u279D"; - case "RandomWindDirection": - return "\u267A"; - default: - return ""; + return getWindDirectionIndicator(windDirection); + } + + public String getWeatherIndicator(int type) { + if ((type >= 0) && (type < WE_SIZE)) { + return weatherIndicators[type]; } + throw new IllegalArgumentException("Unknown Weather Indicator"); } public String getWeatherIndicator() { - switch (weatherConditions) { - case PlanetaryConditions.WE_NONE: - return ""; - case PlanetaryConditions.WE_LIGHT_RAIN: - return "\u2601 \u2022 \u2022 \u2022 \u2022"; - case PlanetaryConditions.WE_MOD_RAIN: - return "\u2601 \u2601 \u2022 \u2022 \u2022"; - case PlanetaryConditions.WE_HEAVY_RAIN: - return "\u2601 \u2601 \u2601 \u2022 \u2022"; - case PlanetaryConditions.WE_GUSTING_RAIN: - return "\u2601 \u2601 \u2601 \u2601 \u2022"; - case PlanetaryConditions.WE_DOWNPOUR: - return "\u2601 \u2601 \u2601 \u2601 \u2601"; - case PlanetaryConditions.WE_LIGHT_SNOW: - return"\u2744 \u2022 \u2022 \u2022"; - case PlanetaryConditions.WE_MOD_SNOW: - return"\u2744 \u2744 \u2022 \u2022"; - case PlanetaryConditions.WE_SNOW_FLURRIES: - return "\u2744 \u2744 \u2744 \u2022"; - case PlanetaryConditions.WE_HEAVY_SNOW: - return "\u2744 \u2744 \u2744 \u2744"; - case PlanetaryConditions.WE_SLEET: - return "\u26C6 \u2022"; - case PlanetaryConditions.WE_ICE_STORM: - return "\u26C6 \u26C6"; - default: - return ""; + return getWeatherIndicator(weatherConditions); + } + + public String getAtmosphereIndicator(int type) { + if ((type >= 0) && (type < ATMO_SIZE)) { + return atmosphereIndicators[type]; } + throw new IllegalArgumentException("Unknown Atmosphere Indicator"); } public String getAtmosphereIndicator() { - switch (atmosphere) { - case PlanetaryConditions.ATMO_VACUUM: - return "\u2726 \u2727 \u2727 \u25AF \u2727 \u2727"; - case PlanetaryConditions.ATMO_TRACE: - return "\u2726 \u2726 \u2727 \u25AF \u2727 \u2727"; - case PlanetaryConditions.ATMO_THIN: - return "\u2726 \u2726 \u2726 \u25AF \u2727 \u2727"; - case PlanetaryConditions.ATMO_STANDARD: - return "\u2726 \u2726 \u2726 \u25AE \u2727 \u2727"; - case PlanetaryConditions.ATMO_HIGH: - return "\u2726 \u2726 \u2726 \u25AE \u2726 \u2727"; - case PlanetaryConditions.ATMO_VHIGH: - return "\u2726 \u2726 \u2726 \u25AE \u2726 \u2726"; - default: - return ""; - } + return getAtmosphereIndicator(atmosphere); } public String getGravityIndicator() { if (gravity > 1.0) { - return "\u2B73"; + return PC_INDICATOR_GRAVITY_HIGH; } else if ((gravity < 1.0)) { - return "\u2B71"; + return PC_INDICATOR_GRAVITY_LOW; } - return ""; + return PC_INDICATOR_GRAVITY_NORMAL; } public String getTemperatureIndicator() { - if (isExtremeTemperatureHot()) { - return "\uD83D\uDD25"; + if (isExtremeTemperatureHeat()) { + return PC_INDICATOR_TEMPERATURE_HEAT; } else if (isExtremeTemperatureCold()) { - return "\u2744"; + return PC_INDICATOR_TEMPERATURE_COLD; } - return ""; + return PC_INDICATOR_TEMPERATURE_NORMAL; } public String getEMIIndicator() { - if (hasEMI()) { - return "\u2713"; - } - else { - return "\u274C"; - } + return hasEMI() ? PC_INDICATOR_EMI_TRUE : PC_INDICATOR_EMI_FALSE; } public String getSandBlowingIndicator() { - if (hasEMI()) { - return "\u2713"; - } - else { - return "\u274C"; - } + return hasEMI() ? PC_INDICATOR_BLOWINGSAND_TRUE : PC_INDICATOR_BLOWINGSAND_FALSE; } public String getEMIDisplayableValue() { - return hasEMI() ? "Yes" : "No"; + return hasEMI() ? PC_NAME_EMI_TRUE : PC_NAME_EMI_FALSE; } public String getSandBlowingDisplayableValue() { - return isSandBlowing() ? "Yes" : "No"; + return isSandBlowing() ? PC_NAME_BLOWINGSAND_TRUE : PC_NAME_BLOWINGSAND_FALSE; } } From f22587fc2d2e35985162707374748ec9f744939a Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Wed, 9 Nov 2022 19:44:38 -0500 Subject: [PATCH 10/18] RFE 426 overlay for Planetary Conditions update 9 --- .../i18n/megamek/common/messages.properties | 114 +++++++++--------- .../megamek/common/messages_es.properties | 86 ++++++------- .../megamek/common/messages_ru.properties | 78 ++++++------ .../boardview/PlanetaryConditionsOverlay.java | 1 - .../megamek/common/PlanetaryConditions.java | 100 +++++++-------- 5 files changed, 190 insertions(+), 189 deletions(-) diff --git a/megamek/i18n/megamek/common/messages.properties b/megamek/i18n/megamek/common/messages.properties index f5188356876..edfad426644 100644 --- a/megamek/i18n/megamek/common/messages.properties +++ b/megamek/i18n/megamek/common/messages.properties @@ -201,57 +201,57 @@ HexTarget.Extinguish=\ (Extinguish) HexTarget.Ignite=\ (Ignite) HexTarget.Screen=\ (Screen) HexTarget.Tag=\ (Tag) -PlanetaryConditions.None=None -PlanetaryConditions.Daylight=Daylight -PlanetaryConditions.Dusk=Dusk/Dawn -PlanetaryConditions.Full\ Moon\ Night=Full Moon Night -PlanetaryConditions.Moonless\ Night=Moonless Night -PlanetaryConditions.Pitch\ Black=Pitch Black -PlanetaryConditions.Light\ Rain=Light Rain -PlanetaryConditions.Moderate\ Rain=Moderate Rain -PlanetaryConditions.Heavy\ Rain=Heavy Rain -PlanetaryConditions.Gusting\ Rain=Gusting Rain -PlanetaryConditions.Torrential\ Downpour=Torrential Downpour -PlanetaryConditions.Light\ Snowfall=Light Snowfall -PlanetaryConditions.Moderate\ Snowfall=Moderate Snowfall -PlanetaryConditions.Heavy\ Snowfall=Heavy Snowfall -PlanetaryConditions.Sleet=Sleet -PlanetaryConditions.Snow\ Flurries=Snow Flurries -PlanetaryConditions.Blizzard=Blizzard -PlanetaryConditions.Ice\ Storm=Ice Storm -PlanetaryConditions.Light\ Hail=Light Hail -PlanetaryConditions.Heavy\ Hail=Heavy Hail -PlanetaryConditions.Calm=Calm -PlanetaryConditions.Clear=Clear -PlanetaryConditions.Light\ Gale=Light Gale -PlanetaryConditions.Moderate\ Gale=Moderate Gale -PlanetaryConditions.Strong\ Gale=Strong Gale -PlanetaryConditions.Storm=Storm -PlanetaryConditions.Tornado\ F1-F3=Tornado F1-F3 -PlanetaryConditions.Tornado\ F4=Tornado F4 -PlanetaryConditions.Vacuum=Vacuum -PlanetaryConditions.Trace=Trace -PlanetaryConditions.Thin=Thin -PlanetaryConditions.Standard=Standard -PlanetaryConditions.High=High -PlanetaryConditions.Very\ High=Very High -PlanetaryConditions.Light\ Fog=Light Fog -PlanetaryConditions.Heavy\ Fog=Heavy Fog -PlanetaryConditions.RandomWindDirection=Random -PlanetaryConditions.North=North -PlanetaryConditions.Northeast=Northeast -PlanetaryConditions.East=East -PlanetaryConditions.Southeast=Southeast -PlanetaryConditions.South=South -PlanetaryConditions.Southwest=Southwest -PlanetaryConditions.West=West -PlanetaryConditions.Northwest=NorthWest -PlanetaryConditions.ExtremeHeat=Extreme Heat -PlanetaryConditions.ExtremeCold=Extreme Cold -PlanetaryConditions.Name.SandBlowing.true=Yes -PlanetaryConditions.Name.SandBlowing.false=No -PlanetaryConditions.Name.EMI.true=Yes -PlanetaryConditions.Name.EMI.false=No +PlanetaryConditions.DisplayableName.Light.Daylight=Daylight +PlanetaryConditions.DisplayableName.Light.Dusk=Dusk/Dawn +PlanetaryConditions.DisplayableName.Light.Full\ Moon\ Night=Full Moon Night +PlanetaryConditions.DisplayableName.Light.Moonless\ Night=Moonless Night +PlanetaryConditions.DisplayableName.Light.Pitch\ Black=Pitch Black +PlanetaryConditions.DisplayableName.Weather.Clear=Clear +PlanetaryConditions.DisplayableName.Weather.Light\ Rain=Light Rain +PlanetaryConditions.DisplayableName.Weather.Moderate\ Rain=Moderate Rain +PlanetaryConditions.DisplayableName.Weather.Heavy\ Rain=Heavy Rain +PlanetaryConditions.DisplayableName.Weather.Gusting\ Rain=Gusting Rain +PlanetaryConditions.DisplayableName.Weather.Torrential\ Downpour=Torrential Downpour +PlanetaryConditions.DisplayableName.Weather.Light\ Snowfall=Light Snowfall +PlanetaryConditions.DisplayableName.Weather.Moderate\ Snowfall=Moderate Snowfall +PlanetaryConditions.DisplayableName.Weather.Heavy\ Snowfall=Heavy Snowfall +PlanetaryConditions.DisplayableName.Weather.Sleet=Sleet +PlanetaryConditions.DisplayableName.Weather.Snow\ Flurries=Snow Flurries +PlanetaryConditions.DisplayableName.Weather.Blizzard=Blizzard +PlanetaryConditions.DisplayableName.Weather.Ice\ Storm=Ice Storm +PlanetaryConditions.DisplayableName.Weather.Light\ Hail=Light Hail +PlanetaryConditions.DisplayableName.Weather.Heavy\ Hail=Heavy Hail +PlanetaryConditions.DisplayableName.WindStrength.Calm=Calm +PlanetaryConditions.DisplayableName.WindStrength.Light\ Gale=Light Gale +PlanetaryConditions.DisplayableName.WindStrength.Moderate\ Gale=Moderate Gale +PlanetaryConditions.DisplayableName.WindStrength.Strong\ Gale=Strong Gale +PlanetaryConditions.DisplayableName.WindStrength.Storm=Storm +PlanetaryConditions.DisplayableName.WindStrength.Tornado\ F1-F3=Tornado F1-F3 +PlanetaryConditions.DisplayableName.WindStrength.Tornado\ F4=Tornado F4 +PlanetaryConditions.DisplayableName.WindDirection.RandomWindDirection=Random +PlanetaryConditions.DisplayableName.WindDirection.North=North +PlanetaryConditions.DisplayableName.WindDirection.Northeast=Northeast +PlanetaryConditions.DisplayableName.WindDirection.East=East +PlanetaryConditions.DisplayableName.WindDirection.Southeast=Southeast +PlanetaryConditions.DisplayableName.WindDirection.South=South +PlanetaryConditions.DisplayableName.WindDirection.Southwest=Southwest +PlanetaryConditions.DisplayableName.WindDirection.West=West +PlanetaryConditions.DisplayableName.WindDirection.Northwest=NorthWest +PlanetaryConditions.DisplayableName.Atmosphere.Vacuum=Vacuum +PlanetaryConditions.DisplayableName.Atmosphere.Trace=Trace +PlanetaryConditions.DisplayableName.Atmosphere.Thin=Thin +PlanetaryConditions.DisplayableName.Atmosphere.Standard=Standard +PlanetaryConditions.DisplayableName.Atmosphere.High=High +PlanetaryConditions.DisplayableName.Atmosphere.Very\ High=Very High +PlanetaryConditions.DisplayableName.Fog.None=None +PlanetaryConditions.DisplayableName.Fog.Light\ Fog=Light Fog +PlanetaryConditions.DisplayableName.SandBlowing.true=Yes +PlanetaryConditions.DisplayableName.SandBlowing.false=No +PlanetaryConditions.DisplayableName.Fog.Heavy\ Fog=Heavy Fog +PlanetaryConditions.DisplayableName.Temperature.ExtremeCold=Extreme Cold +PlanetaryConditions.DisplayableName.Temperature.ExtremeHeat=Extreme Heat +PlanetaryConditions.DisplayableName.EMI.true=Yes +PlanetaryConditions.DisplayableName.EMI.false=No PlanetaryConditions.Indicator.Light.Day=\u2600 PlanetaryConditions.Indicator.Light.Dusk=\u263D \u263C PlanetaryConditions.Indicator.Light.FullMoon=\u26AB @@ -294,16 +294,16 @@ PlanetaryConditions.Indicator.Atmosphere.Thin=\u2726 \u2726 \u2726 \u25AF \u2727 PlanetaryConditions.Indicator.Atmosphere.Standard=\u2726 \u2726 \u2726 \u25AE \u2727 \u2727 PlanetaryConditions.Indicator.Atmosphere.High=\u2726 \u2726 \u2726 \u25AE \u2726 \u2727 PlanetaryConditions.Indicator.Atmosphere.VHigh=\u2726 \u2726 \u2726 \u25AE \u2726 \u2726 -PlanetaryConditions.Indicator.Gravity.High=\u2B73 -PlanetaryConditions.Indicator.Gravity.Low=\u2B71 -PlanetaryConditions.Indicator.Gravity.Normal= -PlanetaryConditions.Indicator.Temperature.ExtremeHeat=\uD83D\uDD25 +PlanetaryConditions.Indicator.SandBlowing.true=\u2713 +PlanetaryConditions.Indicator.SandBlowing.false=\u274C PlanetaryConditions.Indicator.Temperature.ExtremeCold=\u2744 PlanetaryConditions.Indicator.Temperature.Normal= +PlanetaryConditions.Indicator.Temperature.ExtremeHeat=\uD83D\uDD25 +PlanetaryConditions.Indicator.Gravity.Low=\u2B71 +PlanetaryConditions.Indicator.Gravity.Normal= +PlanetaryConditions.Indicator.Gravity.High=\u2B73 PlanetaryConditions.Indicator.EMI.true=\u2713 PlanetaryConditions.Indicator.EMI.false=\u274C -PlanetaryConditions.Indicator.SandBlowing.true=\u2713 -PlanetaryConditions.Indicator.SandBlowing.false=\u274C UnitType.Aero=Aerospace Fighter UnitType.BattleArmor=Battle Armor UnitType.Conventional\ Fighter=Conventional Fighter diff --git a/megamek/i18n/megamek/common/messages_es.properties b/megamek/i18n/megamek/common/messages_es.properties index 4d47476293b..de1adb162e9 100644 --- a/megamek/i18n/megamek/common/messages_es.properties +++ b/megamek/i18n/megamek/common/messages_es.properties @@ -74,49 +74,49 @@ HexTarget.Extinguish=\ (Extinguir) HexTarget.Ignite=\ (Incendiar) HexTarget.Screen=\ (Pantalla) HexTarget.Tag=\ (Etiqueta) -PlanetaryConditions.None=Ninguno -PlanetaryConditions.Daylight=Luz Natural -PlanetaryConditions.Dusk=Anochecer/Amanecer -PlanetaryConditions.Full\ Moon\ Night=Noche de Luna Llena -PlanetaryConditions.Moonless\ Night=Noche sin Luna -PlanetaryConditions.Pitch\ Black=Oscuro -PlanetaryConditions.Light\ Rain= Lluvia Ligera -PlanetaryConditions.Moderate\ Rain=Lluvia Moderada -PlanetaryConditions.Heavy\ Rain=Lluvia Intensa -PlanetaryConditions.Gusting\ Rain=Rachas de Lluvia -PlanetaryConditions.Torrential\ Downpour=Aguacero Torrencial -PlanetaryConditions.Light\ Snowfall=Nevada Ligera -PlanetaryConditions.Moderate\ Snowfall=Nevada Moderada -PlanetaryConditions.Heavy\ Snowfall=Nevada Intensa -PlanetaryConditions.Sleet=Aguanieve -PlanetaryConditions.Snow\ Flurries=Rafagas de Nieve -PlanetaryConditions.Blizzard=Ventisca -PlanetaryConditions.Ice\ Storm=Tormenta de Hielo -PlanetaryConditions.Light\ Hail=Granizo Ligero -PlanetaryConditions.Heavy\ Hail=Granizo Intenso -PlanetaryConditions.Calm=Calma -PlanetaryConditions.Clear=Claro -PlanetaryConditions.Light\ Gale=Vendaval Ligero -PlanetaryConditions.Moderate\ Gale=Vendaval Moderado -PlanetaryConditions.Strong\ Gale=Vendaval Fuerte -PlanetaryConditions.Storm=Tormenta -PlanetaryConditions.Tornado\ F1-F3=Tornado F1-F3 -PlanetaryConditions.Tornado\ F4=Tornado F4 -PlanetaryConditions.Vacuum=Vacío -PlanetaryConditions.Trace=Traza -PlanetaryConditions.Thin=Ligera -PlanetaryConditions.Standard=Estándar -PlanetaryConditions.High=Alta -PlanetaryConditions.Very\ High=Muy Alta -PlanetaryConditions.Light\ Fog=Niebla Ligera -PlanetaryConditions.Heavy\ Fog=Niebla Intensa -PlanetaryConditions.RandomWindDirection=Aleatorio -PlanetaryConditions.North=Norte -PlanetaryConditions.Northeast=Noreste -PlanetaryConditions.Southeast=Sureste -PlanetaryConditions.South=Sur -PlanetaryConditions.Southwest=Suroeste -PlanetaryConditions.Northwest=Noroeste +PlanetaryConditions.DisplayableName.Light.Daylight=Luz Natural +PlanetaryConditions.DisplayableName.Light.Dusk=Anochecer/Amanecer +PlanetaryConditions.DisplayableName.Light.Full\ Moon\ Night=Noche de Luna Llena +PlanetaryConditions.DisplayableName.Light.Moonless\ Night=Noche sin Luna +PlanetaryConditions.DisplayableName.Light.Pitch\ Black=Oscuro +PlanetaryConditions.DisplayableName.Weather.Clear=Claro +PlanetaryConditions.DisplayableName.Weather.Light\ Rain= Lluvia Ligera +PlanetaryConditions.DisplayableName.Weather.Moderate\ Rain=Lluvia Moderada +PlanetaryConditions.DisplayableName.Weather.Heavy\ Rain=Lluvia Intensa +PlanetaryConditions.DisplayableName.Weather.Gusting\ Rain=Rachas de Lluvia +PlanetaryConditions.DisplayableName.Weather.Torrential\ Downpour=Aguacero Torrencial +PlanetaryConditions.DisplayableName.Weather.Light\ Snowfall=Nevada Ligera +PlanetaryConditions.DisplayableName.Weather.Moderate\ Snowfall=Nevada Moderada +PlanetaryConditions.DisplayableName.Weather.Heavy\ Snowfall=Nevada Intensa +PlanetaryConditions.DisplayableName.Weather.Sleet=Aguanieve +PlanetaryConditions.DisplayableName.Weather.Snow\ Flurries=Rafagas de Nieve +PlanetaryConditions.DisplayableName.Weather.Blizzard=Ventisca +PlanetaryConditions.DisplayableName.Weather.Ice\ Storm=Tormenta de Hielo +PlanetaryConditions.DisplayableName.Weather.Light\ Hail=Granizo Ligero +PlanetaryConditions.DisplayableName.Weather.Heavy\ Hail=Granizo Intenso +PlanetaryConditions.DisplayableName.WindStrength.Calm=Calma +PlanetaryConditions.DisplayableName.WindStrength.Light\ Gale=Vendaval Ligero +PlanetaryConditions.DisplayableName.WindStrength.Moderate\ Gale=Vendaval Moderado +PlanetaryConditions.DisplayableName.WindStrength.Strong\ Gale=Vendaval Fuerte +PlanetaryConditions.DisplayableName.WindStrength.Storm=Tormenta +PlanetaryConditions.DisplayableName.WindStrength.Tornado\ F1-F3=Tornado F1-F3 +PlanetaryConditions.DisplayableName.WindStrength.Tornado\ F4=Tornado F4 +PlanetaryConditions.DisplayableName.WindDirection.North=Norte +PlanetaryConditions.DisplayableName.WindDirection.Northeast=Noreste +PlanetaryConditions.DisplayableName.WindDirection.Southeast=Sureste +PlanetaryConditions.DisplayableName.WindDirection.South=Sur +PlanetaryConditions.DisplayableName.WindDirection.Southwest=Suroeste +PlanetaryConditions.DisplayableName.WindDirection.Northwest=Noroeste +PlanetaryConditions.DisplayableName.WindDirection.RandomWindDirection=Aleatorio +PlanetaryConditions.DisplayableName.Atmosphere.Vacuum=Vacío +PlanetaryConditions.DisplayableName.Atmosphere.Trace=Traza +PlanetaryConditions.DisplayableName.Atmosphere.Thin=Ligera +PlanetaryConditions.DisplayableName.Atmosphere.Standard=Estándar +PlanetaryConditions.DisplayableName.Atmosphere.High=Alta +PlanetaryConditions.DisplayableName.Atmosphere.Very\ High=Muy Alta +PlanetaryConditions.DisplayableName.Fog.None=Ninguno +PlanetaryConditions.DisplayableName.Fog.Light\ Fog=Niebla Ligera +PlanetaryConditions.DisplayableName.Fog.Heavy\ Fog=Niebla Intensa UnitType.Aero=Caza Aeroespacial UnitType.BattleArmor=Armadura de Combate UnitType.Conventional\ Fighter=Caza Convencional diff --git a/megamek/i18n/megamek/common/messages_ru.properties b/megamek/i18n/megamek/common/messages_ru.properties index 0964a6aa035..8c909ad29f5 100644 --- a/megamek/i18n/megamek/common/messages_ru.properties +++ b/megamek/i18n/megamek/common/messages_ru.properties @@ -43,45 +43,45 @@ HexTarget.Extinguish=\ (Погасить) HexTarget.Ignite=\ (Зажечь) HexTarget.Screen=\ (Завеса) HexTarget.Tag=\ (Пометить) -PlanetaryConditions.None=Никакой -PlanetaryConditions.Daylight=Дневной свет -PlanetaryConditions.Dusk=Закат/Рассвет -PlanetaryConditions.Full\ Moon\ Night=Ночь в полнолуние -PlanetaryConditions.Moonless\ Night=Безлунная ночь -PlanetaryConditions.Pitch\ Black=Полная темнота -PlanetaryConditions.Light\ Rain=Легкий дождь -PlanetaryConditions.Moderate\ Rain=Дождь -PlanetaryConditions.Heavy\ Rain=Сильный дождь -PlanetaryConditions.Torrential\ Downpour=Ливень потоками -PlanetaryConditions.Light\ Snowfall=Легкий снегопад -PlanetaryConditions.Moderate\ Snowfall=Снегопад -PlanetaryConditions.Heavy\ Snowfall=Сильный снегопад -PlanetaryConditions.Sleet=Мокрый снег -PlanetaryConditions.Ice\ Storm=Снежная буря -PlanetaryConditions.Light\ Hail=Легкий град -PlanetaryConditions.Heavy\ Hail=Сильный град -PlanetaryConditions.Calm=Штиль -PlanetaryConditions.Clear=Ясно -PlanetaryConditions.Light\ Gale=Легкий ветер -PlanetaryConditions.Moderate\ Gale=Умеренный ветер -PlanetaryConditions.Strong\ Gale=Сильный ветер -PlanetaryConditions.Storm=Шторм -PlanetaryConditions.Tornado\ F1-F3=Торнадо F1-F3 -PlanetaryConditions.Tornado\ F4=Торнадо F4 -PlanetaryConditions.Vacuum=Вакуум -PlanetaryConditions.Trace=Остаточная -PlanetaryConditions.Thin=Тонкая -PlanetaryConditions.Standard=Стандартная -PlanetaryConditions.High=Высокая -PlanetaryConditions.Very\ High=Очень высокая -PlanetaryConditions.Light\ Fog=Легкий туман -PlanetaryConditions.Heavy\ Fog=Сильный туман -PlanetaryConditions.North=К северу -PlanetaryConditions.Northeast=К северо-востоку -PlanetaryConditions.Southeast=К юго-востоку -PlanetaryConditions.South=К югу -PlanetaryConditions.Southwest=К юго-западу -PlanetaryConditions.Northwest=К северо-западу +PlanetaryConditions.DisplayableName.Light.Daylight=Дневной свет +PlanetaryConditions.DisplayableName.Light.Dusk=Закат/Рассвет +PlanetaryConditions.DisplayableName.Light.Full\ Moon\ Night=Ночь в полнолуние +PlanetaryConditions.DisplayableName.Light.Moonless\ Night=Безлунная ночь +PlanetaryConditions.DisplayableName.Light.Pitch\ Black=Полная темнота +PlanetaryConditions.DisplayableName.Weather.Clear=Ясно +PlanetaryConditions.DisplayableName.Weather.Light\ Rain=Легкий дождь +PlanetaryConditions.DisplayableName.Weather.Moderate\ Rain=Дождь +PlanetaryConditions.DisplayableName.Weather.Heavy\ Rain=Сильный дождь +PlanetaryConditions.DisplayableName.Weather.Torrential\ Downpour=Ливень потоками +PlanetaryConditions.DisplayableName.Weather.Light\ Snowfall=Легкий снегопад +PlanetaryConditions.DisplayableName.Weather.Moderate\ Snowfall=Снегопад +PlanetaryConditions.DisplayableName.Weather.Heavy\ Snowfall=Сильный снегопад +PlanetaryConditions.DisplayableName.Weather.Sleet=Мокрый снег +PlanetaryConditions.DisplayableName.Weather.Ice\ Storm=Снежная буря +PlanetaryConditions.DisplayableName.Weather.Light\ Hail=Легкий град +PlanetaryConditions.DisplayableName.Weather.Heavy\ Hail=Сильный град +PlanetaryConditions.DisplayableName.WindStrength.Calm=Штиль +PlanetaryConditions.DisplayableName.WindStrength.Light\ Gale=Легкий ветер +PlanetaryConditions.DisplayableName.WindStrength.Moderate\ Gale=Умеренный ветер +PlanetaryConditions.DisplayableName.WindStrength.Strong\ Gale=Сильный ветер +PlanetaryConditions.DisplayableName.WindStrength.Storm=Шторм +PlanetaryConditions.DisplayableName.WindStrength.Tornado\ F1-F3=Торнадо F1-F3 +PlanetaryConditions.DisplayableName.WindStrength.Tornado\ F4=Торнадо F4 +PlanetaryConditions.DisplayableName.WindDirection.North=К северу +PlanetaryConditions.DisplayableName.WindDirection.Northeast=К северо-востоку +PlanetaryConditions.DisplayableName.WindDirection.Southeast=К юго-востоку +PlanetaryConditions.DisplayableName.WindDirection.South=К югу +PlanetaryConditions.DisplayableName.WindDirection.Southwest=К юго-западу +PlanetaryConditions.DisplayableName.WindDirection.Northwest=К северо-западу +PlanetaryConditions.DisplayableName.Atmosphere.Vacuum=Вакуум +PlanetaryConditions.DisplayableName.Atmosphere.Trace=Остаточная +PlanetaryConditions.DisplayableName.Atmosphere.Thin=Тонкая +PlanetaryConditions.DisplayableName.Atmosphere.Standard=Стандартная +PlanetaryConditions.DisplayableName.Atmosphere.High=Высокая +PlanetaryConditions.DisplayableName.Atmosphere.Very\ High=Очень высокая +PlanetaryConditions.DisplayableName.Fog.None=Никакой +PlanetaryConditions.DisplayableName.Fog.Light\ Fog=Легкий туман +PlanetaryConditions.DisplayableName.Fog.Heavy\ Fog=Сильный туман UnitType.Aero=Аэрокосмический истребитель UnitType.BattleArmor=Бронепехота UnitType.Conventional\ Fighter=Обычный истребитель diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java index 48036bcf344..6a4465ed2d4 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -60,7 +60,6 @@ public class PlanetaryConditionsOverlay implements IDisplayable, IPreferenceChan private static final Color SHADOW_COLOR = Color.DARK_GRAY; private static final float FADE_SPEED = 0.2f; - ClientGUI clientGui; /** True when the overlay is displayed or fading in. */ diff --git a/megamek/src/megamek/common/PlanetaryConditions.java b/megamek/src/megamek/common/PlanetaryConditions.java index 449f00625c5..81fc1532950 100644 --- a/megamek/src/megamek/common/PlanetaryConditions.java +++ b/megamek/src/megamek/common/PlanetaryConditions.java @@ -34,11 +34,11 @@ public class PlanetaryConditions implements Serializable { public static final int L_FULL_MOON = 2; public static final int L_MOONLESS = 3; public static final int L_PITCH_BLACK = 4; - private static final String PC_NAME_LIGHT_DAYLIGHT = Messages.getString("PlanetaryConditions.Daylight"); - private static final String PC_NAME_LIGHT_DUSK = Messages.getString("PlanetaryConditions.Dusk"); - private static final String PC_NAME_LIGHT_FULLMOONNIGHT = Messages.getString("PlanetaryConditions.Full Moon Night"); - private static final String PC_NAME_LIGHT_MOONLESSNIGHT = Messages.getString("PlanetaryConditions.Moonless Night"); - private static final String PC_NAME_LIGHT_PITCHBLACK = Messages.getString("PlanetaryConditions.Pitch Black"); + private static final String PC_NAME_LIGHT_DAYLIGHT = Messages.getString("PlanetaryConditions.DisplayableName.Light.Daylight"); + private static final String PC_NAME_LIGHT_DUSK = Messages.getString("PlanetaryConditions.DisplayableName.Light.Dusk"); + private static final String PC_NAME_LIGHT_FULLMOONNIGHT = Messages.getString("PlanetaryConditions.DisplayableName.Light.Full Moon Night"); + private static final String PC_NAME_LIGHT_MOONLESSNIGHT = Messages.getString("PlanetaryConditions.DisplayableName.Light.Moonless Night"); + private static final String PC_NAME_LIGHT_PITCHBLACK = Messages.getString("PlanetaryConditions.DisplayableName.Light.Pitch Black"); private static String[] lightNames = { PC_NAME_LIGHT_DAYLIGHT, PC_NAME_LIGHT_DUSK, PC_NAME_LIGHT_FULLMOONNIGHT, PC_NAME_LIGHT_MOONLESSNIGHT, PC_NAME_LIGHT_PITCHBLACK }; public static final int L_SIZE = lightNames.length; @@ -67,18 +67,18 @@ public class PlanetaryConditions implements Serializable { public static final int WE_HEAVY_HAIL = 13;// NYI public static final int WE_LIGHTNING_STORM = 14;// NYI // public static final int WE_BLIZZARD = 11; does not exist anymore - private static final String PC_NAME_WEATHER_CLEAR = Messages.getString("PlanetaryConditions.Clear"); - private static final String PC_NAME_WEATHER_LIGHTRAIN = Messages.getString("PlanetaryConditions.Light Rain"); - private static final String PC_NAME_WEATHER_MODRAIN = Messages.getString("PlanetaryConditions.Moderate Rain"); - private static final String PC_NAME_WEATHER_HEAVYGRAIN = Messages.getString("PlanetaryConditions.Heavy Rain"); - private static final String PC_NAME_WEATHER_GUSTINGRAIN = Messages.getString("PlanetaryConditions.Gusting Rain"); - private static final String PC_NAME_WEATHER_TORRDOWNPOUR = Messages.getString("PlanetaryConditions.Torrential Downpour"); - private static final String PC_NAME_WEATHER_LIGHTSNOWFALL = Messages.getString("PlanetaryConditions.Light Snowfall"); - private static final String PC_NAME_WEATHER_MODSNOWFALL = Messages.getString("PlanetaryConditions.Moderate Snowfall"); - private static final String PC_NAME_WEATHER_SNOWFLUFFIES = Messages.getString("PlanetaryConditions.Snow Flurries"); - private static final String PC_NAME_WEATHER_HEAVYSNOWFALL = Messages.getString("PlanetaryConditions.Heavy Snowfall"); - private static final String PC_NAME_WEATHER_SLEET = Messages.getString("PlanetaryConditions.Sleet"); - private static final String PC_NAME_WEATHER_ICESTORM = Messages.getString("PlanetaryConditions.Ice Storm"); + private static final String PC_NAME_WEATHER_CLEAR = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Clear"); + private static final String PC_NAME_WEATHER_LIGHTRAIN = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Light Rain"); + private static final String PC_NAME_WEATHER_MODRAIN = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Moderate Rain"); + private static final String PC_NAME_WEATHER_HEAVYGRAIN = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Heavy Rain"); + private static final String PC_NAME_WEATHER_GUSTINGRAIN = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Gusting Rain"); + private static final String PC_NAME_WEATHER_TORRDOWNPOUR = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Torrential Downpour"); + private static final String PC_NAME_WEATHER_LIGHTSNOWFALL = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Light Snowfall"); + private static final String PC_NAME_WEATHER_MODSNOWFALL = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Moderate Snowfall"); + private static final String PC_NAME_WEATHER_SNOWFLUFFIES = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Snow Flurries"); + private static final String PC_NAME_WEATHER_HEAVYSNOWFALL = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Heavy Snowfall"); + private static final String PC_NAME_WEATHER_SLEET = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Sleet"); + private static final String PC_NAME_WEATHER_ICESTORM = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Ice Storm"); private static String[] weatherNames = { PC_NAME_WEATHER_CLEAR, PC_NAME_WEATHER_LIGHTRAIN, PC_NAME_WEATHER_MODRAIN, PC_NAME_WEATHER_HEAVYGRAIN, PC_NAME_WEATHER_GUSTINGRAIN, PC_NAME_WEATHER_TORRDOWNPOUR, PC_NAME_WEATHER_LIGHTSNOWFALL, PC_NAME_WEATHER_MODSNOWFALL, PC_NAME_WEATHER_SNOWFLUFFIES, @@ -109,13 +109,13 @@ public class PlanetaryConditions implements Serializable { public static final int WI_STORM = 4; public static final int WI_TORNADO_F13 = 5; public static final int WI_TORNADO_F4 = 6; - private static final String PC_NAME_WINDSTRENGTH_LIGHT_CALM = Messages.getString("PlanetaryConditions.Calm"); - private static final String PC_NAME_WINDSTRENGTH_LIGHT_GALE = Messages.getString("PlanetaryConditions.Light Gale"); - private static final String PC_NAME_WINDSTRENGTH_MOD_GALE = Messages.getString("PlanetaryConditions.Moderate Gale"); - private static final String PC_NAME_WINDSTRENGTH_STRONG_GALE = Messages.getString("PlanetaryConditions.Strong Gale"); - private static final String PC_NAME_WINDSTRENGTH_STORM = Messages.getString("PlanetaryConditions.Storm"); - private static final String PC_NAME_WINDSTRENGTH_TORNADO_F13 = Messages.getString("PlanetaryConditions.Tornado F1-F3"); - private static final String PC_NAME_WINDSTRENGTH_TORNADO_F4 = Messages.getString("PlanetaryConditions.Tornado F4"); + private static final String PC_NAME_WINDSTRENGTH_LIGHT_CALM = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Calm"); + private static final String PC_NAME_WINDSTRENGTH_LIGHT_GALE = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Light Gale"); + private static final String PC_NAME_WINDSTRENGTH_MOD_GALE = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Moderate Gale"); + private static final String PC_NAME_WINDSTRENGTH_STRONG_GALE = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Strong Gale"); + private static final String PC_NAME_WINDSTRENGTH_STORM = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Storm"); + private static final String PC_NAME_WINDSTRENGTH_TORNADO_F13 = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Tornado F1-F3"); + private static final String PC_NAME_WINDSTRENGTH_TORNADO_F4 = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Tornado F4"); private static String[] windNames = { PC_NAME_WINDSTRENGTH_LIGHT_CALM, PC_NAME_WINDSTRENGTH_LIGHT_GALE, PC_NAME_WINDSTRENGTH_MOD_GALE, PC_NAME_WINDSTRENGTH_STRONG_GALE, PC_NAME_WINDSTRENGTH_STORM, PC_NAME_WINDSTRENGTH_TORNADO_F13, @@ -134,15 +134,15 @@ public class PlanetaryConditions implements Serializable { PC_INDICATOR_WINDSTRENGTH_TORNADO_F4 }; // wind direction - private static final String PC_NAME_WINDDIRECTION_NORTH = Messages.getString("PlanetaryConditions.North"); - private static final String PC_NAME_WINDDIRECTION_NORTHEAST = Messages.getString("PlanetaryConditions.Northeast"); - private static final String PC_NAME_WINDDIRECTION_EAST = Messages.getString("PlanetaryConditions.East"); - private static final String PC_NAME_WINDDIRECTION_SOUTHEAST = Messages.getString("PlanetaryConditions.Southeast"); - private static final String PC_NAME_WINDDIRECTION_SOUTH = Messages.getString("PlanetaryConditions.South"); - private static final String PC_NAME_WINDDIRECTION_SOUTHWEST = Messages.getString("PlanetaryConditions.Southwest"); - private static final String PC_NAME_WINDDIRECTION_WEST = Messages.getString("PlanetaryConditions.West"); - private static final String PC_NAME_WINDDIRECTION_NORTHWEST = Messages.getString("PlanetaryConditions.Northwest"); - private static final String PC_NAME_WINDDIRECTION_RANDOM = Messages.getString("PlanetaryConditions.RandomWindDirection"); + private static final String PC_NAME_WINDDIRECTION_NORTH = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.North"); + private static final String PC_NAME_WINDDIRECTION_NORTHEAST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Northeast"); + private static final String PC_NAME_WINDDIRECTION_EAST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.East"); + private static final String PC_NAME_WINDDIRECTION_SOUTHEAST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Southeast"); + private static final String PC_NAME_WINDDIRECTION_SOUTH = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.South"); + private static final String PC_NAME_WINDDIRECTION_SOUTHWEST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Southwest"); + private static final String PC_NAME_WINDDIRECTION_WEST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.West"); + private static final String PC_NAME_WINDDIRECTION_NORTHWEST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Northwest"); + private static final String PC_NAME_WINDDIRECTION_RANDOM = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.RandomWindDirection"); private static String[] dirNames = { PC_NAME_WINDDIRECTION_NORTH, PC_NAME_WINDDIRECTION_NORTHEAST, PC_NAME_WINDDIRECTION_EAST, PC_NAME_WINDDIRECTION_SOUTHEAST, PC_NAME_WINDDIRECTION_SOUTH, PC_NAME_WINDDIRECTION_SOUTHWEST, PC_NAME_WINDDIRECTION_WEST, PC_NAME_WINDDIRECTION_NORTHWEST, PC_NAME_WINDDIRECTION_RANDOM }; @@ -168,12 +168,12 @@ public class PlanetaryConditions implements Serializable { public static final int ATMO_STANDARD = 3; public static final int ATMO_HIGH = 4; public static final int ATMO_VHIGH = 5; - private static final String PC_NAME_ATMOSPHERE_VACUUM = Messages.getString("PlanetaryConditions.Vacuum"); - private static final String PC_NAME_ATMOSPHERE_TRACE = Messages.getString("PlanetaryConditions.Trace"); - private static final String PC_NAME_ATMOSPHERE_THIN = Messages.getString("PlanetaryConditions.Thin"); - private static final String PC_NAME_ATMOSPHERE_STANDARD = Messages.getString("PlanetaryConditions.Standard"); - private static final String PC_NAME_ATMOSPHERE_HIGH = Messages.getString("PlanetaryConditions.High"); - private static final String PC_NAME_ATMOSPHERE_VHIGH = Messages.getString("PlanetaryConditions.Very High"); + private static final String PC_NAME_ATMOSPHERE_VACUUM = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Vacuum"); + private static final String PC_NAME_ATMOSPHERE_TRACE = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Trace"); + private static final String PC_NAME_ATMOSPHERE_THIN = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Thin"); + private static final String PC_NAME_ATMOSPHERE_STANDARD = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Standard"); + private static final String PC_NAME_ATMOSPHERE_HIGH = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.High"); + private static final String PC_NAME_ATMOSPHERE_VHIGH = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Very High"); public static String[] atmoNames = { PC_NAME_ATMOSPHERE_VACUUM, PC_NAME_ATMOSPHERE_TRACE, PC_NAME_ATMOSPHERE_THIN, PC_NAME_ATMOSPHERE_STANDARD, PC_NAME_ATMOSPHERE_HIGH, PC_NAME_ATMOSPHERE_VHIGH }; public static final int ATMO_SIZE = atmoNames.length; @@ -190,8 +190,10 @@ public class PlanetaryConditions implements Serializable { public static final int FOG_NONE = 0; public static final int FOG_LIGHT = 1; public static final int FOG_HEAVY = 2; - - private static String[] fogNames = { "None", "Light Fog", "Heavy Fog" }; + private static final String PC_NAME_FOG_NONE = Messages.getString("PlanetaryConditions.DisplayableName.Fog.None"); + private static final String PC_NAME_FOG_LIGHT = Messages.getString("PlanetaryConditions.DisplayableName.Fog.Light Fog"); + private static final String PC_NAME_FOG_HEAVY = Messages.getString("PlanetaryConditions.DisplayableName.Fog.Heavy Fog"); + private static String[] fogNames = { PC_NAME_FOG_NONE, PC_NAME_FOG_LIGHT, PC_NAME_FOG_HEAVY }; public static final int FOG_SIZE = fogNames.length; private static final String PC_INDICATOR_FOG_NONE = Messages.getString("PlanetaryConditions.Indicator.Fog.None"); private static final String PC_INDICATOR_FOG_LIGHT = Messages.getString("PlanetaryConditions.Indicator.Fog.Light"); @@ -200,10 +202,10 @@ public class PlanetaryConditions implements Serializable { // misc private boolean blowingSand = false; + private static final String PC_NAME_BLOWINGSAND_TRUE = Messages.getString("PlanetaryConditions.DisplayableName.SandBlowing.true"); + private static final String PC_NAME_BLOWINGSAND_FALSE = Messages.getString("PlanetaryConditions.DisplayableName.SandBlowing.false"); private static final String PC_INDICATOR_BLOWINGSAND_TRUE = Messages.getString("PlanetaryConditions.Indicator.SandBlowing.true"); private static final String PC_INDICATOR_BLOWINGSAND_FALSE = Messages.getString("PlanetaryConditions.Indicator.SandBlowing.false"); - private static final String PC_NAME_BLOWINGSAND_TRUE = Messages.getString("PlanetaryConditions.Name.SandBlowing.true"); - private static final String PC_NAME_BLOWINGSAND_FALSE = Messages.getString("PlanetaryConditions.Name.SandBlowing.false"); private boolean sandStorm = false; private boolean runOnce = false; @@ -221,20 +223,20 @@ public class PlanetaryConditions implements Serializable { private int fog = FOG_NONE; private int temperature = 25; private int oldTemperature = 25; - private static final String PC_NAME_TEMPERATURE_HEAT = Messages.getString("PlanetaryConditions.ExtremeHeat"); - private static final String PC_NAME_TEMPERATURE_COLD = Messages.getString("PlanetaryConditions.ExtremeCold"); - private static final String PC_INDICATOR_TEMPERATURE_HEAT= Messages.getString("PlanetaryConditions.Indicator.Temperature.ExtremeHeat"); + private static final String PC_NAME_TEMPERATURE_COLD = Messages.getString("PlanetaryConditions.DisplayableName.Temperature.ExtremeCold"); + private static final String PC_NAME_TEMPERATURE_HEAT = Messages.getString("PlanetaryConditions.DisplayableName.Temperature.ExtremeHeat"); private static final String PC_INDICATOR_TEMPERATURE_COLD = Messages.getString("PlanetaryConditions.Indicator.Temperature.ExtremeCold"); + private static final String PC_INDICATOR_TEMPERATURE_HEAT= Messages.getString("PlanetaryConditions.Indicator.Temperature.ExtremeHeat"); private static final String PC_INDICATOR_TEMPERATURE_NORMAL = Messages.getString("PlanetaryConditions.Indicator.Temperature.Normal"); private float gravity = (float) 1.0; - private static final String PC_INDICATOR_GRAVITY_HIGH = Messages.getString("PlanetaryConditions.Indicator.Gravity.High"); private static final String PC_INDICATOR_GRAVITY_LOW= Messages.getString("PlanetaryConditions.Indicator.Gravity.Low"); private static final String PC_INDICATOR_GRAVITY_NORMAL = Messages.getString("PlanetaryConditions.Indicator.Gravity.Normal"); + private static final String PC_INDICATOR_GRAVITY_HIGH = Messages.getString("PlanetaryConditions.Indicator.Gravity.High"); private boolean emi = false; + private static final String PC_NAME_EMI_TRUE = Messages.getString("PlanetaryConditions.DisplayableName.EMI.true"); + private static final String PC_NAME_EMI_FALSE = Messages.getString("PlanetaryConditions.DisplayableName.EMI.false"); private static final String PC_INDICATOR_EMI_TRUE = Messages.getString("PlanetaryConditions.Indicator.EMI.true"); private static final String PC_INDICATOR_EMI_FALSE = Messages.getString("PlanetaryConditions.Indicator.EMI.false"); - private static final String PC_NAME_EMI_TRUE = Messages.getString("PlanetaryConditions.Name.EMI.true"); - private static final String PC_NAME_EMI_FALSE = Messages.getString("PlanetaryConditions.Name.EMI.false"); private boolean terrainAffected = true; private int maxWindStrength = PlanetaryConditions.WI_TORNADO_F4; private int minWindStrength = PlanetaryConditions.WI_NONE; From 722470dff4399d7d52e86c819e9d9240885c96ac Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Thu, 10 Nov 2022 17:21:23 -0500 Subject: [PATCH 11/18] RFE 426 overlay for Planetary Conditions update 10 --- .../boardview/PlanetaryConditionsOverlay.java | 45 ++++++++++++++----- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java index 6a4465ed2d4..4ec9c6efc61 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -22,7 +22,11 @@ import java.awt.Graphics2D; import java.awt.Image; import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.KeyEvent; +import java.awt.font.TextAttribute; +import java.text.AttributedString; import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; @@ -51,10 +55,12 @@ * * */ -public class PlanetaryConditionsOverlay implements IDisplayable, IPreferenceChangeListener { +public class PlanetaryConditionsOverlay implements ActionListener, IDisplayable, IPreferenceChangeListener { private static final Font FONT = new Font("SansSerif", Font.PLAIN, 13); private static final int DIST_TOP = 30; private static final int DIST_SIDE = 500; + private int distSide = 500; + private int overlayWidth = 500; private static final int PADDING_X = 10; private static final int PADDING_Y = 5; private static final Color SHADOW_COLOR = Color.DARK_GRAY; @@ -102,6 +108,7 @@ public PlanetaryConditionsOverlay(Game game, ClientGUI cg) { game.addGameListener(gameListener); clientGui = cg; KeyBindParser.addPreferenceChangeListener(this); + GUIPreferences.getInstance().addPreferenceChangeListener(this); } @Override @@ -113,19 +120,21 @@ public void draw(Graphics graph, Rectangle clipBounds) { if ((clientGui == null) || (currentGame == null)) { return; } - + // At startup, phase and turn change and when the Planetary Conditions change, // the cached image is (re)created if (changed) { changed = false; // calculate the size from the text lines, font and padding - graph.setFont(FONT); - FontMetrics fm = graph.getFontMetrics(FONT); + Font newFont = FONT.deriveFont(FONT.getSize() * GUIPreferences.getInstance().getGUIScale()); + graph.setFont(newFont); + FontMetrics fm = graph.getFontMetrics(newFont); List allLines = assembleTextLines(); Rectangle r = getSize(graph, allLines, fm); r = new Rectangle(r.width + 2 * PADDING_X, r.height + 2 * PADDING_Y); - + overlayWidth = r.width; + displayImage = ImageUtil.createAcceleratedImage(r.width, r.height); Graphics intGraph = displayImage.getGraphics(); GUIPreferences.AntiAliasifSet(intGraph); @@ -146,7 +155,7 @@ public void draw(Graphics graph, Rectangle clipBounds) { } } - int DistSide = clientGui.getWidth() - 500; + distSide = clientGui.getWidth() - (overlayWidth + 100); // draw the cached image to the boardview // uses Composite to draw the image with variable transparency @@ -155,10 +164,10 @@ public void draw(Graphics graph, Rectangle clipBounds) { Composite saveComp = ((Graphics2D) graph).getComposite(); int type = AlphaComposite.SRC_OVER; ((Graphics2D) graph).setComposite(AlphaComposite.getInstance(type, alpha)); - graph.drawImage(displayImage, clipBounds.x + DistSide, clipBounds.y + DIST_TOP, null); + graph.drawImage(displayImage, clipBounds.x + distSide, clipBounds.y + DIST_TOP, null); ((Graphics2D) graph).setComposite(saveComp); } else { - graph.drawImage(displayImage, clipBounds.x + DistSide, clipBounds.y + DIST_TOP, null); + graph.drawImage(displayImage, clipBounds.x + distSide, clipBounds.y + DIST_TOP, null); } } @@ -265,10 +274,13 @@ private void drawShadowedString(Graphics graph, String s, int x, int y) { s = s.substring(7); } + AttributedString text = new AttributedString(s); + text.addAttribute(TextAttribute.FONT, new Font(FONT.getFontName(), Font.PLAIN, (int) (FONT.getSize() * GUIPreferences.getInstance().getGUIScale())), 0, s.length()); + graph.setColor(SHADOW_COLOR); - graph.drawString(s, x + 1, y + 1); + graph.drawString(text.getIterator(), x + 1, y + 1); graph.setColor(textColor); - graph.drawString(s, x, y); + graph.drawString(text.getIterator(), x, y); } /** @@ -337,5 +349,18 @@ public void preferenceChange(PreferenceChangeEvent e) { if (e.getName().equals(KeyBindParser.KEYBINDS_CHANGED)) { changed = true; } + if (e.getName().equals(GUIPreferences.GUI_SCALE)) { + changed = true; + } + } + + @Override + public void actionPerformed(ActionEvent event) { + if (event.getActionCommand().equals(ClientGUI.VIEW_INCGUISCALE)) { + changed = true; + } + if (event.getActionCommand().equals(ClientGUI.VIEW_DECGUISCALE)) { + changed = true; + } } } From 0c1166e4d125627e194200d5d495c8496942d1cd Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Fri, 11 Nov 2022 10:17:27 -0500 Subject: [PATCH 12/18] RFE 426 overlay for Planetary Conditions update 11 --- .../i18n/megamek/client/messages.properties | 10 +- .../i18n/megamek/common/messages.properties | 18 ++-- .../client/ui/swing/GUIPreferences.java | 51 ++++++++- .../boardview/PlanetaryConditionsOverlay.java | 100 +++++++++++++----- 4 files changed, 134 insertions(+), 45 deletions(-) diff --git a/megamek/i18n/megamek/client/messages.properties b/megamek/i18n/megamek/client/messages.properties index 7cf36d47068..8d0fb0f4a25 100644 --- a/megamek/i18n/megamek/client/messages.properties +++ b/megamek/i18n/megamek/client/messages.properties @@ -178,7 +178,11 @@ AdvancedOptions.PlanetaryConditionsColorText.name=Planetary Conditions Color Tex AdvancedOptions.PlanetaryConditionsColorCold.name=Planetary Conditions Color Cold AdvancedOptions.PlanetaryConditionsColorHot.name=Planetary Conditions Color Hot AdvancedOptions.PlanetaryConditionsColorBackground.name=Planetary Conditions Color Background -AdvancedOptions.PlanetaryConditionsShowDefaults.name=Planetary Conditions Hide Default Conditons +AdvancedOptions.PlanetaryConditionsShowDefaults.name=Planetary Conditions Show Default Conditions +AdvancedOptions.PlanetaryConditionsShowHeader.name=Planetary Conditions Show Header +AdvancedOptions.PlanetaryConditionsShowLabels.name=Planetary Conditions Show Labels +AdvancedOptions.PlanetaryConditionsShowValues.name=Planetary Conditions Show Values +AdvancedOptions.PlanetaryConditionsShowIndicators.name=Planetary Conditions Show Indicators #Board Editor BoardEditor.BridgeBuildingElevError=Bridge/Building Elevation is an offset from the surface of a hex and hence must be a positive value! @@ -2349,8 +2353,8 @@ PlanetaryConditionsDialog.header.weather=Weather PlanetaryConditionsDialog.header.dynamic=Dynamic Wind Settings PlanetaryConditionsOverlay.heading=Planetary Conditions - press {0} to toggle this overlay -PlanetaryConditionsOverlay.Temperature=Temperature (deg C): -PlanetaryConditionsOverlay.Gravity=Gravity (g): +PlanetaryConditionsOverlay.Temperature=Temperature: +PlanetaryConditionsOverlay.Gravity=Gravity: PlanetaryConditionsOverlay.Light=Light: PlanetaryConditionsOverlay.AtmosphericPressure=Atmospheric Pressure: PlanetaryConditionsOverlay.EMI=EMI: diff --git a/megamek/i18n/megamek/common/messages.properties b/megamek/i18n/megamek/common/messages.properties index edfad426644..f9c3482a918 100644 --- a/megamek/i18n/megamek/common/messages.properties +++ b/megamek/i18n/megamek/common/messages.properties @@ -257,10 +257,10 @@ PlanetaryConditions.Indicator.Light.Dusk=\u263D \u263C PlanetaryConditions.Indicator.Light.FullMoon=\u26AB PlanetaryConditions.Indicator.Light.Moonless=\u26AA PlanetaryConditions.Indicator.Light.PitchBlack=\u2588 -PlanetaryConditions.Indicator.Fog.None= +PlanetaryConditions.Indicator.Fog.None=\uD83D\uDC41 PlanetaryConditions.Indicator.Fog.Light=\u2588 \u2022 PlanetaryConditions.Indicator.Fog.Heavy=\u2588 \u2588 -PlanetaryConditions.Indicator.WindStrength.Calm= +PlanetaryConditions.Indicator.WindStrength.Calm=\u2690 PlanetaryConditions.Indicator.WindStrength.LightGale=\u21F6 \u2022 \u2022 \u2022 PlanetaryConditions.Indicator.WindStrength.ModGale=\u21F6 \u21F6 \u2022 \u2022 PlanetaryConditions.Indicator.WindStrength.StrongGale=\u21F6 \u21F6 \u21F6 \u2022 @@ -276,7 +276,7 @@ PlanetaryConditions.Indicator.WindDirection.Southwest=\u2B08 PlanetaryConditions.Indicator.WindDirection.West=\u279D PlanetaryConditions.Indicator.WindDirection.Northwest=\u2B0A PlanetaryConditions.Indicator.WindDirection.RandomWindDirection= -PlanetaryConditions.Indicator.Weather.None= +PlanetaryConditions.Indicator.Weather.None=\u239A PlanetaryConditions.Indicator.Weather.LightRain=\u2601 \u2022 \u2022 \u2022 \u2022 PlanetaryConditions.Indicator.Weather.ModRain=\u2601 \u2601 \u2022 \u2022 \u2022 PlanetaryConditions.Indicator.Weather.HeavyRain=\u2601 \u2601 \u2601 \u2022 \u2022 @@ -294,16 +294,16 @@ PlanetaryConditions.Indicator.Atmosphere.Thin=\u2726 \u2726 \u2726 \u25AF \u2727 PlanetaryConditions.Indicator.Atmosphere.Standard=\u2726 \u2726 \u2726 \u25AE \u2727 \u2727 PlanetaryConditions.Indicator.Atmosphere.High=\u2726 \u2726 \u2726 \u25AE \u2726 \u2727 PlanetaryConditions.Indicator.Atmosphere.VHigh=\u2726 \u2726 \u2726 \u25AE \u2726 \u2726 -PlanetaryConditions.Indicator.SandBlowing.true=\u2713 -PlanetaryConditions.Indicator.SandBlowing.false=\u274C +PlanetaryConditions.Indicator.SandBlowing.true=\uD83C\uDF2C +PlanetaryConditions.Indicator.SandBlowing.false=\uD83D\uDC41 PlanetaryConditions.Indicator.Temperature.ExtremeCold=\u2744 -PlanetaryConditions.Indicator.Temperature.Normal= +PlanetaryConditions.Indicator.Temperature.Normal=\uD83C\uDF21 PlanetaryConditions.Indicator.Temperature.ExtremeHeat=\uD83D\uDD25 PlanetaryConditions.Indicator.Gravity.Low=\u2B71 -PlanetaryConditions.Indicator.Gravity.Normal= +PlanetaryConditions.Indicator.Gravity.Normal=\u23AF PlanetaryConditions.Indicator.Gravity.High=\u2B73 -PlanetaryConditions.Indicator.EMI.true=\u2713 -PlanetaryConditions.Indicator.EMI.false=\u274C +PlanetaryConditions.Indicator.EMI.true=\u2301 +PlanetaryConditions.Indicator.EMI.false=\u2312 UnitType.Aero=Aerospace Fighter UnitType.BattleArmor=Battle Armor UnitType.Conventional\ Fighter=Conventional Fighter diff --git a/megamek/src/megamek/client/ui/swing/GUIPreferences.java b/megamek/src/megamek/client/ui/swing/GUIPreferences.java index 73602896fdc..2443d322531 100644 --- a/megamek/src/megamek/client/ui/swing/GUIPreferences.java +++ b/megamek/src/megamek/client/ui/swing/GUIPreferences.java @@ -109,7 +109,11 @@ public class GUIPreferences extends PreferenceStoreProxy { public static final String ADVANCED_PLANETARY_CONDITIONS_COLOR_COLD = "AdvancedPlanetaryConditionsColorCold"; public static final String ADVANCED_PLANETARY_CONDITIONS_COLOR_HOT = "AdvancedPlanetaryConditionsColorHot"; public static final String ADVANCED_PLANETARY_CONDITIONS_COLOR_BACKGROUND = "AdvancedPlanetaryConditionsColorBackground"; - public static final String ADVANCED_PLANETARY_CONDITIONS_HIDE_DEFAULTS = "AdvancedPlanetaryConditionsShowDefaults"; + public static final String ADVANCED_PLANETARY_CONDITIONS_SHOW_DEFAULTS = "AdvancedPlanetaryConditionsShowDefaults"; + public static final String ADVANCED_PLANETARY_CONDITIONS_SHOW_HEADER = "AdvancedPlanetaryConditionsShowHeader"; + public static final String ADVANCED_PLANETARY_CONDITIONS_SHOW_LABELS = "AdvancedPlanetaryConditionsShowLabels"; + public static final String ADVANCED_PLANETARY_CONDITIONS_SHOW_VALUES = "AdvancedPlanetaryConditionsShowValues"; + public static final String ADVANCED_PLANETARY_CONDITIONS_SHOW_INDICATORS = "AdvancedPlanetaryConditionsShowIndicators"; /* --End advanced settings-- */ @@ -400,7 +404,11 @@ protected GUIPreferences() { setDefault(ADVANCED_PLANETARY_CONDITIONS_COLOR_COLD, DEFAULT_PLANETARY_CONDITIONS_COLD_COLOR); setDefault(ADVANCED_PLANETARY_CONDITIONS_COLOR_HOT, DEFAULT_PLANETARY_CONDITIONS_HOT_COLOR); setDefault(ADVANCED_PLANETARY_CONDITIONS_COLOR_BACKGROUND, DEFAULT_PLANETARY_CONDITIONS_BACKGROUND_COLOR); - setDefault(ADVANCED_PLANETARY_CONDITIONS_HIDE_DEFAULTS, false); + setDefault(ADVANCED_PLANETARY_CONDITIONS_SHOW_DEFAULTS, true); + setDefault(ADVANCED_PLANETARY_CONDITIONS_SHOW_HEADER, true); + setDefault(ADVANCED_PLANETARY_CONDITIONS_SHOW_LABELS, true); + setDefault(ADVANCED_PLANETARY_CONDITIONS_SHOW_VALUES, true); + setDefault(ADVANCED_PLANETARY_CONDITIONS_SHOW_INDICATORS, true); setDefault(ADVANCED_REPORT_COLOR_LINK, DEFAULT_REPORT_LINK_COLOR); @@ -1758,9 +1766,26 @@ public Color getPlanetaryConditionsColorBackground() { return getColor(ADVANCED_PLANETARY_CONDITIONS_COLOR_BACKGROUND); } - public Boolean getAdvancedPlanetaryConditionsHideDefaults() { - return getBoolean(ADVANCED_PLANETARY_CONDITIONS_HIDE_DEFAULTS); + public Boolean getAdvancedPlanetaryConditionsShowDefaults() { + return getBoolean(ADVANCED_PLANETARY_CONDITIONS_SHOW_DEFAULTS); } + + public Boolean getAdvancedPlanetaryConditionsShowHeader() { + return getBoolean(ADVANCED_PLANETARY_CONDITIONS_SHOW_HEADER); + } + + public Boolean getAdvancedPlanetaryConditionsShowLabels() { + return getBoolean(ADVANCED_PLANETARY_CONDITIONS_SHOW_LABELS); + } + + public Boolean getAdvancedPlanetaryConditionsShowValues() { + return getBoolean(ADVANCED_PLANETARY_CONDITIONS_SHOW_VALUES); + } + + public Boolean getAdvancedPlanetaryConditionsShowIndicators() { + return getBoolean(ADVANCED_PLANETARY_CONDITIONS_SHOW_INDICATORS); + } + public void setPlanetaryConditionsColorTitle(Color color) { store.setValue(ADVANCED_PLANETARY_CONDITIONS_COLOR_TITLE, getColorString(color)); } @@ -1782,7 +1807,23 @@ public void setPlanetaryConditionsColorBackground(Color color) { } public void setAdvancedPlanetaryConditionsHideDefaults(Boolean state) { - store.setValue(ADVANCED_PLANETARY_CONDITIONS_HIDE_DEFAULTS, state); + store.setValue(ADVANCED_PLANETARY_CONDITIONS_SHOW_DEFAULTS, state); + } + + public void setAdvancedPlanetaryConditionsHideHeader(Boolean state) { + store.setValue(ADVANCED_PLANETARY_CONDITIONS_SHOW_HEADER, state); + } + + public void setAdvancedPlanetaryConditionsHideLabels(Boolean state) { + store.setValue(ADVANCED_PLANETARY_CONDITIONS_SHOW_LABELS, state); + } + + public void setAdvancedPlanetaryConditionsHideValues(Boolean state) { + store.setValue(ADVANCED_PLANETARY_CONDITIONS_SHOW_VALUES, state); + } + + public void setAdvancedPlanetaryConditionsHideIndicators(Boolean state) { + store.setValue(ADVANCED_PLANETARY_CONDITIONS_SHOW_INDICATORS, state); } /** diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java index 4ec9c6efc61..0c5f41aadf9 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -58,7 +58,6 @@ public class PlanetaryConditionsOverlay implements ActionListener, IDisplayable, IPreferenceChangeListener { private static final Font FONT = new Font("SansSerif", Font.PLAIN, 13); private static final int DIST_TOP = 30; - private static final int DIST_SIDE = 500; private int distSide = 500; private int overlayWidth = 500; private static final int PADDING_X = 10; @@ -195,7 +194,14 @@ private List assembleTextLines() { String mod = KeyEvent.getModifiersExText(kcb.modifiers); String key = KeyEvent.getKeyText(kcb.key); String toggleKey = (mod.isEmpty() ? "" : mod + "+") + key; - result.add(String.format("#%02X%02X%02X", colorTitle.getRed(), colorTitle.getGreen(), colorTitle.getBlue()) + MessageFormat.format(PC_OVERLAY_HEADING, toggleKey)); + + String tmpStr = ""; + Boolean showHeading = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsShowHeader(); + tmpStr = (showHeading ? String.format("#%02X%02X%02X", colorTitle.getRed(), colorTitle.getGreen(), colorTitle.getBlue()) + MessageFormat.format(PC_OVERLAY_HEADING, toggleKey) : ""); + + if (tmpStr.length() > 0) { + result.add(tmpStr); + } if (clientGui != null) { // In a game, not the Board Editor @@ -209,43 +215,79 @@ private List assembleTextLines() { tempColor = String.format("#%02X%02X%02X", colorCold.getRed(), colorCold.getGreen(), colorCold.getBlue()); } - boolean hideDefaultConditions = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsHideDefaults(); + boolean showDefaultConditions = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsShowDefaults(); - if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().isExtremeTemperature())))) { - result.add(tempColor + PC_OVERLAY_TEMPERATURE + " " + temp + " " + currentGame.getPlanetaryConditions().getTemperatureIndicator()); + Boolean showLabel = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsShowLabels(); + Boolean showValue = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsShowValues(); + Boolean showIndicator = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsShowIndicators(); + + + if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().isExtremeTemperature())))) { + tmpStr = (showLabel ? PC_OVERLAY_TEMPERATURE + " " : ""); + tmpStr = tmpStr + (showValue ? temp + "\u00B0C " : ""); + tmpStr = tmpStr + (showIndicator ? (!showValue ? temp + "\u00B0C " : "" ) + currentGame.getPlanetaryConditions().getTemperatureIndicator() : ""); + result.add(tempColor + tmpStr); } - if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getGravity() != 1.0)))) { - result.add(PC_OVERLAY_GRAVITY + " " + currentGame.getPlanetaryConditions().getGravity() + " " + currentGame.getPlanetaryConditions().getGravityIndicator()); + if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getGravity() != 1.0)))) { + float grav = currentGame.getPlanetaryConditions().getGravity(); + tmpStr = (showLabel ? PC_OVERLAY_GRAVITY + " " : ""); + tmpStr = tmpStr + (showValue ? grav + "g " : ""); + tmpStr = tmpStr + (showIndicator ? (!showValue ? grav + "g " : "") + currentGame.getPlanetaryConditions().getGravityIndicator() : ""); + result.add(tmpStr); } - if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getLight() != PlanetaryConditions.L_DAY)))) { - result.add(PC_OVERLAY_LIGHT + " " + currentGame.getPlanetaryConditions().getLightDisplayableName() + " " + currentGame.getPlanetaryConditions().getLightIndicator()); + if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getLight() != PlanetaryConditions.L_DAY)))) { + tmpStr = (showLabel ? PC_OVERLAY_LIGHT + " " : ""); + tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getLightDisplayableName() + " " : ""); + tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getLightIndicator() : ""); + result.add(tmpStr); } - if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getAtmosphere() != PlanetaryConditions.ATMO_STANDARD)))) { - result.add(PC_OVERLAY_ATMOSPHERICPREASSURE + " " + currentGame.getPlanetaryConditions().getAtmosphereDisplayableName() + " " + currentGame.getPlanetaryConditions().getAtmosphereIndicator()); + if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getAtmosphere() != PlanetaryConditions.ATMO_STANDARD)))) { + tmpStr = (showLabel ? PC_OVERLAY_ATMOSPHERICPREASSURE + " " : ""); + tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getAtmosphereDisplayableName() + " " : ""); + tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getAtmosphereIndicator() : ""); + result.add(tmpStr); } - if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().hasEMI())))) { - result.add(PC_OVERLAY_EMI + " " + currentGame.getPlanetaryConditions().getEMIDisplayableValue() + " " + currentGame.getPlanetaryConditions().getEMIIndicator()); + if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().hasEMI())))) { + tmpStr = (showLabel ? PC_OVERLAY_EMI + " " : ""); + tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getEMIDisplayableValue() + " " : ""); + tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getEMIIndicator() : ""); + result.add(tmpStr); } - if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getWeather() != PlanetaryConditions.WE_NONE)))) { - result.add(PC_OVERLAY_WEATHER + " " + currentGame.getPlanetaryConditions().getWeatherDisplayableName() + " " + currentGame.getPlanetaryConditions().getWeatherIndicator()); + if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getWeather() != PlanetaryConditions.WE_NONE)))) { + tmpStr = (showLabel ? PC_OVERLAY_WEATHER + " " : ""); + tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getWeatherDisplayableName() + " " : ""); + tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getWeatherIndicator() : ""); + result.add(tmpStr); } - if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getWindStrength() != PlanetaryConditions.WI_NONE)))) { - result.add(PC_OVERLAY_WIND + " " + currentGame.getPlanetaryConditions().getWindDisplayableName() + " " + currentGame.getPlanetaryConditions().getWindStrengthIndicator()); - result.add(PC_OVERLAY_DIRECTION + " " + currentGame.getPlanetaryConditions().getWindDirDisplayableName() + " " + currentGame.getPlanetaryConditions().getWindDirectionIndicator()); + if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getWindStrength() != PlanetaryConditions.WI_NONE)))) { + tmpStr = (showLabel ? PC_OVERLAY_WIND + " " : ""); + tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getWindDisplayableName() + " " : ""); + tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getWindStrengthIndicator() : ""); + result.add(tmpStr); + tmpStr = (showLabel ? PC_OVERLAY_DIRECTION + " " : ""); + tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getWindDirDisplayableName() + " " : ""); + tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getWindDirectionIndicator() : ""); + result.add(tmpStr); } - if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().getFog() != PlanetaryConditions.FOG_NONE)))) { - result.add(PC_OVERLAY_FOG + " " + currentGame.getPlanetaryConditions().getFogDisplayableName() + " " + currentGame.getPlanetaryConditions().getFogIndicator()); + if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getFog() != PlanetaryConditions.FOG_NONE)))) { + tmpStr = (showLabel ? PC_OVERLAY_FOG + " " : ""); + tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getFogDisplayableName() + " " : ""); + tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getFogIndicator() : ""); + result.add(tmpStr); } - if (((!hideDefaultConditions) || ((hideDefaultConditions) && (currentGame.getPlanetaryConditions().isSandBlowing())))) { - result.add(PC_OVERLAY_BLOWINGSAND + " " + currentGame.getPlanetaryConditions().getSandBlowingDisplayableValue() + " " + currentGame.getPlanetaryConditions().getSandBlowingIndicator()); + if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().isSandBlowing())))) { + tmpStr = (showLabel ? PC_OVERLAY_BLOWINGSAND + " " : ""); + tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getSandBlowingDisplayableValue() + " " : ""); + tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getSandBlowingIndicator() : ""); + result.add(tmpStr); } } @@ -274,13 +316,15 @@ private void drawShadowedString(Graphics graph, String s, int x, int y) { s = s.substring(7); } - AttributedString text = new AttributedString(s); - text.addAttribute(TextAttribute.FONT, new Font(FONT.getFontName(), Font.PLAIN, (int) (FONT.getSize() * GUIPreferences.getInstance().getGUIScale())), 0, s.length()); + if (s.length() > 0) { + AttributedString text = new AttributedString(s); + text.addAttribute(TextAttribute.FONT, new Font(FONT.getFontName(), Font.PLAIN, (int) (FONT.getSize() * GUIPreferences.getInstance().getGUIScale())), 0, s.length()); - graph.setColor(SHADOW_COLOR); - graph.drawString(text.getIterator(), x + 1, y + 1); - graph.setColor(textColor); - graph.drawString(text.getIterator(), x, y); + graph.setColor(SHADOW_COLOR); + graph.drawString(text.getIterator(), x + 1, y + 1); + graph.setColor(textColor); + graph.drawString(text.getIterator(), x, y); + } } /** From 7e91de52aba03d756ab91ab35ce6afd06790e42c Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Fri, 11 Nov 2022 10:50:31 -0500 Subject: [PATCH 13/18] RFE 426 overlay for Planetary Conditions update 12 --- .../ui/swing/boardview/PlanetaryConditionsOverlay.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java index 0c5f41aadf9..07e25c7891f 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -175,7 +175,12 @@ private Rectangle getSize(Graphics graph, List lines, FontMetrics fm) { int width = 0; for (String line: lines) { if (fm.stringWidth(line) > width) { - width = fm.stringWidth(line); + if (line.startsWith("#") && line.length() > 7) { + width = fm.stringWidth(line) - 7; + } + else { + width = fm.stringWidth(line); + } } } int height = fm.getHeight() * lines.size(); From 1cae77ac54da2715e902ad976e706f83aeab62a5 Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Fri, 11 Nov 2022 11:38:24 -0500 Subject: [PATCH 14/18] RFE 426 overlay for Planetary Conditions update 13 --- .../client/ui/swing/boardview/PlanetaryConditionsOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java index 07e25c7891f..4d001d65008 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -208,7 +208,7 @@ private List assembleTextLines() { result.add(tmpStr); } - if (clientGui != null) { + if (clientGui != null && !currentGame.getBoard().inSpace()) { // In a game, not the Board Editor String tempColor = ""; From 7eb8363e8dc4992e1ac36cd9ea6932a7391bddf5 Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Fri, 11 Nov 2022 11:57:41 -0500 Subject: [PATCH 15/18] RFE 426 overlay for Planetary Conditions update 14 --- .../ui/swing/boardview/PlanetaryConditionsOverlay.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java index 4d001d65008..bb94553b98e 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -176,11 +176,10 @@ private Rectangle getSize(Graphics graph, List lines, FontMetrics fm) { for (String line: lines) { if (fm.stringWidth(line) > width) { if (line.startsWith("#") && line.length() > 7) { - width = fm.stringWidth(line) - 7; - } - else { - width = fm.stringWidth(line); + line = line.substring(7); } + + width = fm.stringWidth(line); } } int height = fm.getHeight() * lines.size(); From 877a5272dda5e7b15b951e343335536b68a75704 Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Sun, 13 Nov 2022 09:04:14 -0500 Subject: [PATCH 16/18] @kuronekochomusuke RFE 426 overlay for Planetary Conditions update 15 --- megamek/i18n/megamek/common/messages.properties | 4 ---- .../src/megamek/common/PlanetaryConditions.java | 16 +++++++--------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/megamek/i18n/megamek/common/messages.properties b/megamek/i18n/megamek/common/messages.properties index f9c3482a918..a0772661a5b 100644 --- a/megamek/i18n/megamek/common/messages.properties +++ b/megamek/i18n/megamek/common/messages.properties @@ -231,11 +231,9 @@ PlanetaryConditions.DisplayableName.WindStrength.Tornado\ F4=Tornado F4 PlanetaryConditions.DisplayableName.WindDirection.RandomWindDirection=Random PlanetaryConditions.DisplayableName.WindDirection.North=North PlanetaryConditions.DisplayableName.WindDirection.Northeast=Northeast -PlanetaryConditions.DisplayableName.WindDirection.East=East PlanetaryConditions.DisplayableName.WindDirection.Southeast=Southeast PlanetaryConditions.DisplayableName.WindDirection.South=South PlanetaryConditions.DisplayableName.WindDirection.Southwest=Southwest -PlanetaryConditions.DisplayableName.WindDirection.West=West PlanetaryConditions.DisplayableName.WindDirection.Northwest=NorthWest PlanetaryConditions.DisplayableName.Atmosphere.Vacuum=Vacuum PlanetaryConditions.DisplayableName.Atmosphere.Trace=Trace @@ -269,11 +267,9 @@ PlanetaryConditions.Indicator.WindStrength.TornadoF13=\uD83C\uDF2A \uD83C\uDF2A PlanetaryConditions.Indicator.WindStrength.TornadoF4=\uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A \uD83C\uDF2A PlanetaryConditions.Indicator.WindDirection.North=\u2193 PlanetaryConditions.Indicator.WindDirection.Northeast=\u2B0B -PlanetaryConditions.Indicator.WindDirection.East=\u2190 PlanetaryConditions.Indicator.WindDirection.Southeast=\u2B09 PlanetaryConditions.Indicator.WindDirection.South=\u2191 PlanetaryConditions.Indicator.WindDirection.Southwest=\u2B08 -PlanetaryConditions.Indicator.WindDirection.West=\u279D PlanetaryConditions.Indicator.WindDirection.Northwest=\u2B0A PlanetaryConditions.Indicator.WindDirection.RandomWindDirection= PlanetaryConditions.Indicator.Weather.None=\u239A diff --git a/megamek/src/megamek/common/PlanetaryConditions.java b/megamek/src/megamek/common/PlanetaryConditions.java index 81fc1532950..63da14ea971 100644 --- a/megamek/src/megamek/common/PlanetaryConditions.java +++ b/megamek/src/megamek/common/PlanetaryConditions.java @@ -136,30 +136,28 @@ public class PlanetaryConditions implements Serializable { // wind direction private static final String PC_NAME_WINDDIRECTION_NORTH = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.North"); private static final String PC_NAME_WINDDIRECTION_NORTHEAST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Northeast"); - private static final String PC_NAME_WINDDIRECTION_EAST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.East"); private static final String PC_NAME_WINDDIRECTION_SOUTHEAST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Southeast"); private static final String PC_NAME_WINDDIRECTION_SOUTH = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.South"); private static final String PC_NAME_WINDDIRECTION_SOUTHWEST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Southwest"); - private static final String PC_NAME_WINDDIRECTION_WEST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.West"); private static final String PC_NAME_WINDDIRECTION_NORTHWEST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Northwest"); private static final String PC_NAME_WINDDIRECTION_RANDOM = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.RandomWindDirection"); - private static String[] dirNames = { PC_NAME_WINDDIRECTION_NORTH, PC_NAME_WINDDIRECTION_NORTHEAST, PC_NAME_WINDDIRECTION_EAST, + // no east and west, because the map uses 6 side hex tiles. east and west are skipped. + private static String[] dirNames = { PC_NAME_WINDDIRECTION_NORTH, PC_NAME_WINDDIRECTION_NORTHEAST, PC_NAME_WINDDIRECTION_SOUTHEAST, PC_NAME_WINDDIRECTION_SOUTH, PC_NAME_WINDDIRECTION_SOUTHWEST, - PC_NAME_WINDDIRECTION_WEST, PC_NAME_WINDDIRECTION_NORTHWEST, PC_NAME_WINDDIRECTION_RANDOM }; + PC_NAME_WINDDIRECTION_NORTHWEST, PC_NAME_WINDDIRECTION_RANDOM }; public static final int DIR_SIZE = dirNames.length; - public static final int DIR_RANDOM = 8; + public static final int DIR_RANDOM = 6; private static final String PC_INDICATOR_WINDDIRECTION_NORTH = Messages.getString("PlanetaryConditions.Indicator.WindDirection.North"); private static final String PC_INDICATOR_WINDDIRECTION_NORTHEAST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Northeast"); - private static final String PC_INDICATOR_WINDDIRECTION_EAST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.East"); private static final String PC_INDICATOR_WINDDIRECTION_SOUTHEAST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Southeast"); private static final String PC_INDICATOR_WINDDIRECTION_SOUTH = Messages.getString("PlanetaryConditions.Indicator.WindDirection.South"); private static final String PC_INDICATOR_WINDDIRECTION_SOUTHWEST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Southwest"); - private static final String PC_INDICATOR_WINDDIRECTION_WEST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.West"); private static final String PC_INDICATOR_WINDDIRECTION_NORTHWEST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Northwest"); private static final String PC_INDICATOR_WINDDIRECTION_RANDOM = Messages.getString("PlanetaryConditions.Indicator.WindDirection.RandomWindDirection"); - private static String[] windDirectionIndicators = { PC_INDICATOR_WINDDIRECTION_NORTH, PC_INDICATOR_WINDDIRECTION_NORTHEAST, PC_INDICATOR_WINDDIRECTION_EAST, + // no east and west, because the map uses 6 side hex tiles. east and west are skipped. + private static String[] windDirectionIndicators = { PC_INDICATOR_WINDDIRECTION_NORTH, PC_INDICATOR_WINDDIRECTION_NORTHEAST, PC_INDICATOR_WINDDIRECTION_SOUTHEAST, PC_INDICATOR_WINDDIRECTION_SOUTH, PC_INDICATOR_WINDDIRECTION_SOUTHWEST, - PC_INDICATOR_WINDDIRECTION_WEST, PC_INDICATOR_WINDDIRECTION_NORTHWEST, PC_INDICATOR_WINDDIRECTION_RANDOM }; + PC_INDICATOR_WINDDIRECTION_NORTHWEST, PC_INDICATOR_WINDDIRECTION_RANDOM }; // atmospheric pressure public static final int ATMO_VACUUM = 0; From fe670819120f14ac9f7daea6d896a1064d4368a4 Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Wed, 16 Nov 2022 08:43:39 -0500 Subject: [PATCH 17/18] RFE 426 overlay for Planetary Conditions update 16 --- .../boardview/PlanetaryConditionsOverlay.java | 55 ++-- .../megamek/common/PlanetaryConditions.java | 280 +++++++++--------- 2 files changed, 163 insertions(+), 172 deletions(-) diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java index bb94553b98e..ce03a6436af 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -55,7 +55,7 @@ * * */ -public class PlanetaryConditionsOverlay implements ActionListener, IDisplayable, IPreferenceChangeListener { +public class PlanetaryConditionsOverlay implements IDisplayable, IPreferenceChangeListener { private static final Font FONT = new Font("SansSerif", Font.PLAIN, 13); private static final int DIST_TOP = 30; private int distSide = 500; @@ -84,17 +84,17 @@ public class PlanetaryConditionsOverlay implements ActionListener, IDisplayable, /** The transparency of the overlay. Only used while fading in/out. */ private float alpha = 1; - private static final String PC_OVERLAY_HEADING = Messages.getString("PlanetaryConditionsOverlay.heading"); - private static final String PC_OVERLAY_TEMPERATURE = Messages.getString("PlanetaryConditionsOverlay.Temperature"); - private static final String PC_OVERLAY_GRAVITY = Messages.getString("PlanetaryConditionsOverlay.Gravity"); - private static final String PC_OVERLAY_LIGHT = Messages.getString("PlanetaryConditionsOverlay.Light"); - private static final String PC_OVERLAY_ATMOSPHERICPREASSURE = Messages.getString("PlanetaryConditionsOverlay.AtmosphericPressure"); - private static final String PC_OVERLAY_EMI = Messages.getString("PlanetaryConditionsOverlay.EMI"); - private static final String PC_OVERLAY_WEATHER = Messages.getString("PlanetaryConditionsOverlay.Weather"); - private static final String PC_OVERLAY_WIND = Messages.getString("PlanetaryConditionsOverlay.Wind"); - private static final String PC_OVERLAY_DIRECTION = Messages.getString("PlanetaryConditionsOverlay.WindDirection"); - private static final String PC_OVERLAY_FOG = Messages.getString("PlanetaryConditionsOverlay.Fog"); - private static final String PC_OVERLAY_BLOWINGSAND = Messages.getString("PlanetaryConditionsOverlay.BlowingSand"); + private static final String MSG_HEADING = Messages.getString("PlanetaryConditionsOverlay.heading"); + private static final String MSG_TEMPERATURE = Messages.getString("PlanetaryConditionsOverlay.Temperature"); + private static final String MSG_GRAVITY = Messages.getString("PlanetaryConditionsOverlay.Gravity"); + private static final String MSG_LIGHT = Messages.getString("PlanetaryConditionsOverlay.Light"); + private static final String MSG_ATMOSPHERICPREASSURE = Messages.getString("PlanetaryConditionsOverlay.AtmosphericPressure"); + private static final String MSG_EMI = Messages.getString("PlanetaryConditionsOverlay.EMI"); + private static final String MSG_WEATHER = Messages.getString("PlanetaryConditionsOverlay.Weather"); + private static final String MSG_WIND = Messages.getString("PlanetaryConditionsOverlay.Wind"); + private static final String MSG_DIRECTION = Messages.getString("PlanetaryConditionsOverlay.WindDirection"); + private static final String MSG_FOG = Messages.getString("PlanetaryConditionsOverlay.Fog"); + private static final String MSG_BLOWINGSAND = Messages.getString("PlanetaryConditionsOverlay.BlowingSand"); /** * An overlay for the Boardview that displays a selection of Planetary Conditions @@ -201,7 +201,7 @@ private List assembleTextLines() { String tmpStr = ""; Boolean showHeading = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsShowHeader(); - tmpStr = (showHeading ? String.format("#%02X%02X%02X", colorTitle.getRed(), colorTitle.getGreen(), colorTitle.getBlue()) + MessageFormat.format(PC_OVERLAY_HEADING, toggleKey) : ""); + tmpStr = (showHeading ? String.format("#%02X%02X%02X", colorTitle.getRed(), colorTitle.getGreen(), colorTitle.getBlue()) + MessageFormat.format(MSG_HEADING, toggleKey) : ""); if (tmpStr.length() > 0) { result.add(tmpStr); @@ -227,7 +227,7 @@ private List assembleTextLines() { if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().isExtremeTemperature())))) { - tmpStr = (showLabel ? PC_OVERLAY_TEMPERATURE + " " : ""); + tmpStr = (showLabel ? MSG_TEMPERATURE + " " : ""); tmpStr = tmpStr + (showValue ? temp + "\u00B0C " : ""); tmpStr = tmpStr + (showIndicator ? (!showValue ? temp + "\u00B0C " : "" ) + currentGame.getPlanetaryConditions().getTemperatureIndicator() : ""); result.add(tempColor + tmpStr); @@ -235,60 +235,60 @@ private List assembleTextLines() { if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getGravity() != 1.0)))) { float grav = currentGame.getPlanetaryConditions().getGravity(); - tmpStr = (showLabel ? PC_OVERLAY_GRAVITY + " " : ""); + tmpStr = (showLabel ? MSG_GRAVITY + " " : ""); tmpStr = tmpStr + (showValue ? grav + "g " : ""); tmpStr = tmpStr + (showIndicator ? (!showValue ? grav + "g " : "") + currentGame.getPlanetaryConditions().getGravityIndicator() : ""); result.add(tmpStr); } if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getLight() != PlanetaryConditions.L_DAY)))) { - tmpStr = (showLabel ? PC_OVERLAY_LIGHT + " " : ""); + tmpStr = (showLabel ? MSG_LIGHT + " " : ""); tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getLightDisplayableName() + " " : ""); tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getLightIndicator() : ""); result.add(tmpStr); } if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getAtmosphere() != PlanetaryConditions.ATMO_STANDARD)))) { - tmpStr = (showLabel ? PC_OVERLAY_ATMOSPHERICPREASSURE + " " : ""); + tmpStr = (showLabel ? MSG_ATMOSPHERICPREASSURE + " " : ""); tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getAtmosphereDisplayableName() + " " : ""); tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getAtmosphereIndicator() : ""); result.add(tmpStr); } if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().hasEMI())))) { - tmpStr = (showLabel ? PC_OVERLAY_EMI + " " : ""); + tmpStr = (showLabel ? MSG_EMI + " " : ""); tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getEMIDisplayableValue() + " " : ""); tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getEMIIndicator() : ""); result.add(tmpStr); } if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getWeather() != PlanetaryConditions.WE_NONE)))) { - tmpStr = (showLabel ? PC_OVERLAY_WEATHER + " " : ""); + tmpStr = (showLabel ? MSG_WEATHER + " " : ""); tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getWeatherDisplayableName() + " " : ""); tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getWeatherIndicator() : ""); result.add(tmpStr); } if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getWindStrength() != PlanetaryConditions.WI_NONE)))) { - tmpStr = (showLabel ? PC_OVERLAY_WIND + " " : ""); + tmpStr = (showLabel ? MSG_WIND + " " : ""); tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getWindDisplayableName() + " " : ""); tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getWindStrengthIndicator() : ""); result.add(tmpStr); - tmpStr = (showLabel ? PC_OVERLAY_DIRECTION + " " : ""); + tmpStr = (showLabel ? MSG_DIRECTION + " " : ""); tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getWindDirDisplayableName() + " " : ""); tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getWindDirectionIndicator() : ""); result.add(tmpStr); } if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getFog() != PlanetaryConditions.FOG_NONE)))) { - tmpStr = (showLabel ? PC_OVERLAY_FOG + " " : ""); + tmpStr = (showLabel ? MSG_FOG + " " : ""); tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getFogDisplayableName() + " " : ""); tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getFogIndicator() : ""); result.add(tmpStr); } if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().isSandBlowing())))) { - tmpStr = (showLabel ? PC_OVERLAY_BLOWINGSAND + " " : ""); + tmpStr = (showLabel ? MSG_BLOWINGSAND + " " : ""); tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getSandBlowingDisplayableValue() + " " : ""); tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getSandBlowingIndicator() : ""); result.add(tmpStr); @@ -402,13 +402,4 @@ public void preferenceChange(PreferenceChangeEvent e) { } } - @Override - public void actionPerformed(ActionEvent event) { - if (event.getActionCommand().equals(ClientGUI.VIEW_INCGUISCALE)) { - changed = true; - } - if (event.getActionCommand().equals(ClientGUI.VIEW_DECGUISCALE)) { - changed = true; - } - } } diff --git a/megamek/src/megamek/common/PlanetaryConditions.java b/megamek/src/megamek/common/PlanetaryConditions.java index 63da14ea971..dd349fd1f30 100644 --- a/megamek/src/megamek/common/PlanetaryConditions.java +++ b/megamek/src/megamek/common/PlanetaryConditions.java @@ -34,21 +34,21 @@ public class PlanetaryConditions implements Serializable { public static final int L_FULL_MOON = 2; public static final int L_MOONLESS = 3; public static final int L_PITCH_BLACK = 4; - private static final String PC_NAME_LIGHT_DAYLIGHT = Messages.getString("PlanetaryConditions.DisplayableName.Light.Daylight"); - private static final String PC_NAME_LIGHT_DUSK = Messages.getString("PlanetaryConditions.DisplayableName.Light.Dusk"); - private static final String PC_NAME_LIGHT_FULLMOONNIGHT = Messages.getString("PlanetaryConditions.DisplayableName.Light.Full Moon Night"); - private static final String PC_NAME_LIGHT_MOONLESSNIGHT = Messages.getString("PlanetaryConditions.DisplayableName.Light.Moonless Night"); - private static final String PC_NAME_LIGHT_PITCHBLACK = Messages.getString("PlanetaryConditions.DisplayableName.Light.Pitch Black"); - private static String[] lightNames = { PC_NAME_LIGHT_DAYLIGHT, PC_NAME_LIGHT_DUSK, PC_NAME_LIGHT_FULLMOONNIGHT, - PC_NAME_LIGHT_MOONLESSNIGHT, PC_NAME_LIGHT_PITCHBLACK }; + private static final String MSG_NAME_LIGHT_DAYLIGHT = Messages.getString("PlanetaryConditions.DisplayableName.Light.Daylight"); + private static final String MSG_NAME_LIGHT_DUSK = Messages.getString("PlanetaryConditions.DisplayableName.Light.Dusk"); + private static final String MSG_NAME_LIGHT_FULLMOONNIGHT = Messages.getString("PlanetaryConditions.DisplayableName.Light.Full Moon Night"); + private static final String MSG_NAME_LIGHT_MOONLESSNIGHT = Messages.getString("PlanetaryConditions.DisplayableName.Light.Moonless Night"); + private static final String MSG_NAME_LIGHT_PITCHBLACK = Messages.getString("PlanetaryConditions.DisplayableName.Light.Pitch Black"); + private static String[] lightNames = { MSG_NAME_LIGHT_DAYLIGHT, MSG_NAME_LIGHT_DUSK, MSG_NAME_LIGHT_FULLMOONNIGHT, + MSG_NAME_LIGHT_MOONLESSNIGHT, MSG_NAME_LIGHT_PITCHBLACK }; public static final int L_SIZE = lightNames.length; - private static final String PC_INDICATOR_LIGHT_DAY = Messages.getString("PlanetaryConditions.Indicator.Light.Day"); - private static final String PC_INDICATOR_LIGHT_DUSK = Messages.getString("PlanetaryConditions.Indicator.Light.Dusk"); - private static final String PC_INDICATOR_LIGHT_FULL_MOON = Messages.getString("PlanetaryConditions.Indicator.Light.FullMoon"); - private static final String PC_INDICATOR_LIGHT_MOONLESS = Messages.getString("PlanetaryConditions.Indicator.Light.Moonless"); - private static final String PC_INDICATOR_LIGHT_PITCH_BLACK = Messages.getString("PlanetaryConditions.Indicator.Light.PitchBlack"); - private static String[] lightIndicators = { PC_INDICATOR_LIGHT_DAY, PC_INDICATOR_LIGHT_DUSK, PC_INDICATOR_LIGHT_FULL_MOON, - PC_INDICATOR_LIGHT_MOONLESS, PC_INDICATOR_LIGHT_PITCH_BLACK }; + private static final String MSG_INDICATOR_LIGHT_DAY = Messages.getString("PlanetaryConditions.Indicator.Light.Day"); + private static final String MSG_INDICATOR_LIGHT_DUSK = Messages.getString("PlanetaryConditions.Indicator.Light.Dusk"); + private static final String MSG_INDICATOR_LIGHT_FULL_MOON = Messages.getString("PlanetaryConditions.Indicator.Light.FullMoon"); + private static final String MSG_INDICATOR_LIGHT_MOONLESS = Messages.getString("PlanetaryConditions.Indicator.Light.Moonless"); + private static final String MSG_INDICATOR_LIGHT_PITCH_BLACK = Messages.getString("PlanetaryConditions.Indicator.Light.PitchBlack"); + private static String[] lightIndicators = { MSG_INDICATOR_LIGHT_DAY, MSG_INDICATOR_LIGHT_DUSK, MSG_INDICATOR_LIGHT_FULL_MOON, + MSG_INDICATOR_LIGHT_MOONLESS, MSG_INDICATOR_LIGHT_PITCH_BLACK }; // Weather public static final int WE_NONE = 0; @@ -67,39 +67,39 @@ public class PlanetaryConditions implements Serializable { public static final int WE_HEAVY_HAIL = 13;// NYI public static final int WE_LIGHTNING_STORM = 14;// NYI // public static final int WE_BLIZZARD = 11; does not exist anymore - private static final String PC_NAME_WEATHER_CLEAR = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Clear"); - private static final String PC_NAME_WEATHER_LIGHTRAIN = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Light Rain"); - private static final String PC_NAME_WEATHER_MODRAIN = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Moderate Rain"); - private static final String PC_NAME_WEATHER_HEAVYGRAIN = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Heavy Rain"); - private static final String PC_NAME_WEATHER_GUSTINGRAIN = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Gusting Rain"); - private static final String PC_NAME_WEATHER_TORRDOWNPOUR = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Torrential Downpour"); - private static final String PC_NAME_WEATHER_LIGHTSNOWFALL = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Light Snowfall"); - private static final String PC_NAME_WEATHER_MODSNOWFALL = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Moderate Snowfall"); - private static final String PC_NAME_WEATHER_SNOWFLUFFIES = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Snow Flurries"); - private static final String PC_NAME_WEATHER_HEAVYSNOWFALL = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Heavy Snowfall"); - private static final String PC_NAME_WEATHER_SLEET = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Sleet"); - private static final String PC_NAME_WEATHER_ICESTORM = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Ice Storm"); - private static String[] weatherNames = { PC_NAME_WEATHER_CLEAR, PC_NAME_WEATHER_LIGHTRAIN, PC_NAME_WEATHER_MODRAIN, - PC_NAME_WEATHER_HEAVYGRAIN, PC_NAME_WEATHER_GUSTINGRAIN, PC_NAME_WEATHER_TORRDOWNPOUR, - PC_NAME_WEATHER_LIGHTSNOWFALL, PC_NAME_WEATHER_MODSNOWFALL, PC_NAME_WEATHER_SNOWFLUFFIES, - PC_NAME_WEATHER_HEAVYSNOWFALL, PC_NAME_WEATHER_SLEET, PC_NAME_WEATHER_ICESTORM };//, "Light Hail", "Heavy Hail", "Lightning Storm" }; + private static final String MSG_NAME_WEATHER_CLEAR = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Clear"); + private static final String MSG_NAME_WEATHER_LIGHTRAIN = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Light Rain"); + private static final String MSG_NAME_WEATHER_MODRAIN = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Moderate Rain"); + private static final String MSG_NAME_WEATHER_HEAVYGRAIN = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Heavy Rain"); + private static final String MSG_NAME_WEATHER_GUSTINGRAIN = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Gusting Rain"); + private static final String MSG_NAME_WEATHER_TORRDOWNPOUR = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Torrential Downpour"); + private static final String MSG_NAME_WEATHER_LIGHTSNOWFALL = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Light Snowfall"); + private static final String MSG_NAME_WEATHER_MODSNOWFALL = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Moderate Snowfall"); + private static final String MSG_NAME_WEATHER_SNOWFLUFFIES = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Snow Flurries"); + private static final String MSG_NAME_WEATHER_HEAVYSNOWFALL = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Heavy Snowfall"); + private static final String MSG_NAME_WEATHER_SLEET = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Sleet"); + private static final String MSG_NAME_WEATHER_ICESTORM = Messages.getString("PlanetaryConditions.DisplayableName.Weather.Ice Storm"); + private static String[] weatherNames = { MSG_NAME_WEATHER_CLEAR, MSG_NAME_WEATHER_LIGHTRAIN, MSG_NAME_WEATHER_MODRAIN, + MSG_NAME_WEATHER_HEAVYGRAIN, MSG_NAME_WEATHER_GUSTINGRAIN, MSG_NAME_WEATHER_TORRDOWNPOUR, + MSG_NAME_WEATHER_LIGHTSNOWFALL, MSG_NAME_WEATHER_MODSNOWFALL, MSG_NAME_WEATHER_SNOWFLUFFIES, + MSG_NAME_WEATHER_HEAVYSNOWFALL, MSG_NAME_WEATHER_SLEET, MSG_NAME_WEATHER_ICESTORM };//, "Light Hail", "Heavy Hail", "Lightning Storm" }; public static final int WE_SIZE = weatherNames.length; - private static final String PC_INDICATOR_WEATHER_NONE = Messages.getString("PlanetaryConditions.Indicator.Weather.None"); - private static final String PC_INDICATOR_WEATHER_LIGHT_RAIN = Messages.getString("PlanetaryConditions.Indicator.Weather.LightRain"); - private static final String PC_INDICATOR_WEATHER_MOD_RAIN = Messages.getString("PlanetaryConditions.Indicator.Weather.ModRain"); - private static final String PC_INDICATOR_WEATHER_HEAVY_RAIN = Messages.getString("PlanetaryConditions.Indicator.Weather.HeavyRain"); - private static final String PC_INDICATOR_WEATHER_GUSTING_RAIN = Messages.getString("PlanetaryConditions.Indicator.Weather.GustingRain"); - private static final String PC_INDICATOR_WEATHER_DOWNPOUR = Messages.getString("PlanetaryConditions.Indicator.Weather.Downpour"); - private static final String PC_INDICATOR_WEATHER_LIGHT_SNOW = Messages.getString("PlanetaryConditions.Indicator.Weather.LightSnow"); - private static final String PC_INDICATOR_WEATHER_MOD_SNOW = Messages.getString("PlanetaryConditions.Indicator.Weather.ModSnow"); - private static final String PC_INDICATOR_WEATHER_SNOW_FLURRIES = Messages.getString("PlanetaryConditions.Indicator.Weather.SnowFlurries"); - private static final String PC_INDICATOR_WEATHER_HEAVY_SNOW = Messages.getString("PlanetaryConditions.Indicator.Weather.HeavySnow"); - private static final String PC_INDICATOR_WEATHER_SLEET = Messages.getString("PlanetaryConditions.Indicator.Weather.Sleet"); - private static final String PC_INDICATOR_WEATHER_ICE_STORM = Messages.getString("PlanetaryConditions.Indicator.Weather.IceStorm"); - private static String[] weatherIndicators = { PC_INDICATOR_WEATHER_NONE, PC_INDICATOR_WEATHER_LIGHT_RAIN, PC_INDICATOR_WEATHER_MOD_RAIN, - PC_INDICATOR_WEATHER_HEAVY_RAIN, PC_INDICATOR_WEATHER_GUSTING_RAIN, PC_INDICATOR_WEATHER_DOWNPOUR, - PC_INDICATOR_WEATHER_LIGHT_SNOW, PC_INDICATOR_WEATHER_MOD_SNOW, PC_INDICATOR_WEATHER_SNOW_FLURRIES, - PC_INDICATOR_WEATHER_HEAVY_SNOW, PC_INDICATOR_WEATHER_SLEET, PC_INDICATOR_WEATHER_ICE_STORM}; + private static final String MSG_INDICATOR_WEATHER_NONE = Messages.getString("PlanetaryConditions.Indicator.Weather.None"); + private static final String MSG_INDICATOR_WEATHER_LIGHT_RAIN = Messages.getString("PlanetaryConditions.Indicator.Weather.LightRain"); + private static final String MSG_INDICATOR_WEATHER_MOD_RAIN = Messages.getString("PlanetaryConditions.Indicator.Weather.ModRain"); + private static final String MSG_INDICATOR_WEATHER_HEAVY_RAIN = Messages.getString("PlanetaryConditions.Indicator.Weather.HeavyRain"); + private static final String MSG_INDICATOR_WEATHER_GUSTING_RAIN = Messages.getString("PlanetaryConditions.Indicator.Weather.GustingRain"); + private static final String MSG_INDICATOR_WEATHER_DOWNPOUR = Messages.getString("PlanetaryConditions.Indicator.Weather.Downpour"); + private static final String MSG_INDICATOR_WEATHER_LIGHT_SNOW = Messages.getString("PlanetaryConditions.Indicator.Weather.LightSnow"); + private static final String MSG_INDICATOR_WEATHER_MOD_SNOW = Messages.getString("PlanetaryConditions.Indicator.Weather.ModSnow"); + private static final String MSG_INDICATOR_WEATHER_SNOW_FLURRIES = Messages.getString("PlanetaryConditions.Indicator.Weather.SnowFlurries"); + private static final String MSG_INDICATOR_WEATHER_HEAVY_SNOW = Messages.getString("PlanetaryConditions.Indicator.Weather.HeavySnow"); + private static final String MSG_INDICATOR_WEATHER_SLEET = Messages.getString("PlanetaryConditions.Indicator.Weather.Sleet"); + private static final String MSG_INDICATOR_WEATHER_ICE_STORM = Messages.getString("PlanetaryConditions.Indicator.Weather.IceStorm"); + private static String[] weatherIndicators = { MSG_INDICATOR_WEATHER_NONE, MSG_INDICATOR_WEATHER_LIGHT_RAIN, MSG_INDICATOR_WEATHER_MOD_RAIN, + MSG_INDICATOR_WEATHER_HEAVY_RAIN, MSG_INDICATOR_WEATHER_GUSTING_RAIN, MSG_INDICATOR_WEATHER_DOWNPOUR, + MSG_INDICATOR_WEATHER_LIGHT_SNOW, MSG_INDICATOR_WEATHER_MOD_SNOW, MSG_INDICATOR_WEATHER_SNOW_FLURRIES, + MSG_INDICATOR_WEATHER_HEAVY_SNOW, MSG_INDICATOR_WEATHER_SLEET, MSG_INDICATOR_WEATHER_ICE_STORM}; // Wind public static final int WI_NONE = 0; @@ -109,55 +109,55 @@ public class PlanetaryConditions implements Serializable { public static final int WI_STORM = 4; public static final int WI_TORNADO_F13 = 5; public static final int WI_TORNADO_F4 = 6; - private static final String PC_NAME_WINDSTRENGTH_LIGHT_CALM = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Calm"); - private static final String PC_NAME_WINDSTRENGTH_LIGHT_GALE = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Light Gale"); - private static final String PC_NAME_WINDSTRENGTH_MOD_GALE = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Moderate Gale"); - private static final String PC_NAME_WINDSTRENGTH_STRONG_GALE = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Strong Gale"); - private static final String PC_NAME_WINDSTRENGTH_STORM = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Storm"); - private static final String PC_NAME_WINDSTRENGTH_TORNADO_F13 = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Tornado F1-F3"); - private static final String PC_NAME_WINDSTRENGTH_TORNADO_F4 = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Tornado F4"); - private static String[] windNames = { PC_NAME_WINDSTRENGTH_LIGHT_CALM, PC_NAME_WINDSTRENGTH_LIGHT_GALE, - PC_NAME_WINDSTRENGTH_MOD_GALE, PC_NAME_WINDSTRENGTH_STRONG_GALE, - PC_NAME_WINDSTRENGTH_STORM, PC_NAME_WINDSTRENGTH_TORNADO_F13, - PC_NAME_WINDSTRENGTH_TORNADO_F4 }; + private static final String MSG_NAME_WINDSTRENGTH_LIGHT_CALM = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Calm"); + private static final String MSG_NAME_WINDSTRENGTH_LIGHT_GALE = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Light Gale"); + private static final String MSG_NAME_WINDSTRENGTH_MOD_GALE = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Moderate Gale"); + private static final String MSG_NAME_WINDSTRENGTH_STRONG_GALE = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Strong Gale"); + private static final String MSG_NAME_WINDSTRENGTH_STORM = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Storm"); + private static final String MSG_NAME_WINDSTRENGTH_TORNADO_F13 = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Tornado F1-F3"); + private static final String MSG_NAME_WINDSTRENGTH_TORNADO_F4 = Messages.getString("PlanetaryConditions.DisplayableName.WindStrength.Tornado F4"); + private static String[] windNames = { MSG_NAME_WINDSTRENGTH_LIGHT_CALM, MSG_NAME_WINDSTRENGTH_LIGHT_GALE, + MSG_NAME_WINDSTRENGTH_MOD_GALE, MSG_NAME_WINDSTRENGTH_STRONG_GALE, + MSG_NAME_WINDSTRENGTH_STORM, MSG_NAME_WINDSTRENGTH_TORNADO_F13, + MSG_NAME_WINDSTRENGTH_TORNADO_F4 }; public static final int WI_SIZE = windNames.length; - private static final String PC_INDICATOR_WINDSTRENGTH_LIGHT_CALM = Messages.getString("PlanetaryConditions.Indicator.WindStrength.Calm"); - private static final String PC_INDICATOR_WINDSTRENGTH_LIGHT_GALE = Messages.getString("PlanetaryConditions.Indicator.WindStrength.LightGale"); - private static final String PC_INDICATOR_WINDSTRENGTH_MOD_GALE = Messages.getString("PlanetaryConditions.Indicator.WindStrength.ModGale"); - private static final String PC_INDICATOR_WINDSTRENGTH_STRONG_GALE = Messages.getString("PlanetaryConditions.Indicator.WindStrength.StrongGale"); - private static final String PC_INDICATOR_WINDSTRENGTH_STORM = Messages.getString("PlanetaryConditions.Indicator.WindStrength.Storm"); - private static final String PC_INDICATOR_WINDSTRENGTH_TORNADO_F13 = Messages.getString("PlanetaryConditions.Indicator.WindStrength.TornadoF13"); - private static final String PC_INDICATOR_WINDSTRENGTH_TORNADO_F4 = Messages.getString("PlanetaryConditions.Indicator.WindStrength.TornadoF4"); - private static String[] windStrengthIndicators = { PC_INDICATOR_WINDSTRENGTH_LIGHT_CALM, PC_INDICATOR_WINDSTRENGTH_LIGHT_GALE, - PC_INDICATOR_WINDSTRENGTH_MOD_GALE, PC_INDICATOR_WINDSTRENGTH_STRONG_GALE, - PC_INDICATOR_WINDSTRENGTH_STORM, PC_INDICATOR_WINDSTRENGTH_TORNADO_F13, - PC_INDICATOR_WINDSTRENGTH_TORNADO_F4 }; + private static final String MSG_INDICATOR_WINDSTRENGTH_LIGHT_CALM = Messages.getString("PlanetaryConditions.Indicator.WindStrength.Calm"); + private static final String MSG_INDICATOR_WINDSTRENGTH_LIGHT_GALE = Messages.getString("PlanetaryConditions.Indicator.WindStrength.LightGale"); + private static final String MSG_INDICATOR_WINDSTRENGTH_MOD_GALE = Messages.getString("PlanetaryConditions.Indicator.WindStrength.ModGale"); + private static final String MSG_INDICATOR_WINDSTRENGTH_STRONG_GALE = Messages.getString("PlanetaryConditions.Indicator.WindStrength.StrongGale"); + private static final String MSG_INDICATOR_WINDSTRENGTH_STORM = Messages.getString("PlanetaryConditions.Indicator.WindStrength.Storm"); + private static final String MSG_INDICATOR_WINDSTRENGTH_TORNADO_F13 = Messages.getString("PlanetaryConditions.Indicator.WindStrength.TornadoF13"); + private static final String MSG_INDICATOR_WINDSTRENGTH_TORNADO_F4 = Messages.getString("PlanetaryConditions.Indicator.WindStrength.TornadoF4"); + private static String[] windStrengthIndicators = { MSG_INDICATOR_WINDSTRENGTH_LIGHT_CALM, MSG_INDICATOR_WINDSTRENGTH_LIGHT_GALE, + MSG_INDICATOR_WINDSTRENGTH_MOD_GALE, MSG_INDICATOR_WINDSTRENGTH_STRONG_GALE, + MSG_INDICATOR_WINDSTRENGTH_STORM, MSG_INDICATOR_WINDSTRENGTH_TORNADO_F13, + MSG_INDICATOR_WINDSTRENGTH_TORNADO_F4 }; // wind direction - private static final String PC_NAME_WINDDIRECTION_NORTH = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.North"); - private static final String PC_NAME_WINDDIRECTION_NORTHEAST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Northeast"); - private static final String PC_NAME_WINDDIRECTION_SOUTHEAST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Southeast"); - private static final String PC_NAME_WINDDIRECTION_SOUTH = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.South"); - private static final String PC_NAME_WINDDIRECTION_SOUTHWEST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Southwest"); - private static final String PC_NAME_WINDDIRECTION_NORTHWEST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Northwest"); - private static final String PC_NAME_WINDDIRECTION_RANDOM = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.RandomWindDirection"); + private static final String MSG_NAME_WINDDIRECTION_NORTH = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.North"); + private static final String MSG_NAME_WINDDIRECTION_NORTHEAST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Northeast"); + private static final String MSG_NAME_WINDDIRECTION_SOUTHEAST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Southeast"); + private static final String MSG_NAME_WINDDIRECTION_SOUTH = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.South"); + private static final String MSG_NAME_WINDDIRECTION_SOUTHWEST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Southwest"); + private static final String MSG_NAME_WINDDIRECTION_NORTHWEST = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.Northwest"); + private static final String MSG_NAME_WINDDIRECTION_RANDOM = Messages.getString("PlanetaryConditions.DisplayableName.WindDirection.RandomWindDirection"); // no east and west, because the map uses 6 side hex tiles. east and west are skipped. - private static String[] dirNames = { PC_NAME_WINDDIRECTION_NORTH, PC_NAME_WINDDIRECTION_NORTHEAST, - PC_NAME_WINDDIRECTION_SOUTHEAST, PC_NAME_WINDDIRECTION_SOUTH, PC_NAME_WINDDIRECTION_SOUTHWEST, - PC_NAME_WINDDIRECTION_NORTHWEST, PC_NAME_WINDDIRECTION_RANDOM }; + private static String[] dirNames = { MSG_NAME_WINDDIRECTION_NORTH, MSG_NAME_WINDDIRECTION_NORTHEAST, + MSG_NAME_WINDDIRECTION_SOUTHEAST, MSG_NAME_WINDDIRECTION_SOUTH, MSG_NAME_WINDDIRECTION_SOUTHWEST, + MSG_NAME_WINDDIRECTION_NORTHWEST, MSG_NAME_WINDDIRECTION_RANDOM }; public static final int DIR_SIZE = dirNames.length; public static final int DIR_RANDOM = 6; - private static final String PC_INDICATOR_WINDDIRECTION_NORTH = Messages.getString("PlanetaryConditions.Indicator.WindDirection.North"); - private static final String PC_INDICATOR_WINDDIRECTION_NORTHEAST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Northeast"); - private static final String PC_INDICATOR_WINDDIRECTION_SOUTHEAST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Southeast"); - private static final String PC_INDICATOR_WINDDIRECTION_SOUTH = Messages.getString("PlanetaryConditions.Indicator.WindDirection.South"); - private static final String PC_INDICATOR_WINDDIRECTION_SOUTHWEST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Southwest"); - private static final String PC_INDICATOR_WINDDIRECTION_NORTHWEST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Northwest"); - private static final String PC_INDICATOR_WINDDIRECTION_RANDOM = Messages.getString("PlanetaryConditions.Indicator.WindDirection.RandomWindDirection"); + private static final String MSG_INDICATOR_WINDDIRECTION_NORTH = Messages.getString("PlanetaryConditions.Indicator.WindDirection.North"); + private static final String MSG_INDICATOR_WINDDIRECTION_NORTHEAST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Northeast"); + private static final String MSG_INDICATOR_WINDDIRECTION_SOUTHEAST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Southeast"); + private static final String MSG_INDICATOR_WINDDIRECTION_SOUTH = Messages.getString("PlanetaryConditions.Indicator.WindDirection.South"); + private static final String MSG_INDICATOR_WINDDIRECTION_SOUTHWEST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Southwest"); + private static final String MSG_INDICATOR_WINDDIRECTION_NORTHWEST = Messages.getString("PlanetaryConditions.Indicator.WindDirection.Northwest"); + private static final String MSG_INDICATOR_WINDDIRECTION_RANDOM = Messages.getString("PlanetaryConditions.Indicator.WindDirection.RandomWindDirection"); // no east and west, because the map uses 6 side hex tiles. east and west are skipped. - private static String[] windDirectionIndicators = { PC_INDICATOR_WINDDIRECTION_NORTH, PC_INDICATOR_WINDDIRECTION_NORTHEAST, - PC_INDICATOR_WINDDIRECTION_SOUTHEAST, PC_INDICATOR_WINDDIRECTION_SOUTH, PC_INDICATOR_WINDDIRECTION_SOUTHWEST, - PC_INDICATOR_WINDDIRECTION_NORTHWEST, PC_INDICATOR_WINDDIRECTION_RANDOM }; + private static String[] windDirectionIndicators = { MSG_INDICATOR_WINDDIRECTION_NORTH, MSG_INDICATOR_WINDDIRECTION_NORTHEAST, + MSG_INDICATOR_WINDDIRECTION_SOUTHEAST, MSG_INDICATOR_WINDDIRECTION_SOUTH, MSG_INDICATOR_WINDDIRECTION_SOUTHWEST, + MSG_INDICATOR_WINDDIRECTION_NORTHWEST, MSG_INDICATOR_WINDDIRECTION_RANDOM }; // atmospheric pressure public static final int ATMO_VACUUM = 0; @@ -166,44 +166,44 @@ public class PlanetaryConditions implements Serializable { public static final int ATMO_STANDARD = 3; public static final int ATMO_HIGH = 4; public static final int ATMO_VHIGH = 5; - private static final String PC_NAME_ATMOSPHERE_VACUUM = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Vacuum"); - private static final String PC_NAME_ATMOSPHERE_TRACE = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Trace"); - private static final String PC_NAME_ATMOSPHERE_THIN = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Thin"); - private static final String PC_NAME_ATMOSPHERE_STANDARD = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Standard"); - private static final String PC_NAME_ATMOSPHERE_HIGH = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.High"); - private static final String PC_NAME_ATMOSPHERE_VHIGH = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Very High"); - public static String[] atmoNames = { PC_NAME_ATMOSPHERE_VACUUM, PC_NAME_ATMOSPHERE_TRACE, PC_NAME_ATMOSPHERE_THIN, - PC_NAME_ATMOSPHERE_STANDARD, PC_NAME_ATMOSPHERE_HIGH, PC_NAME_ATMOSPHERE_VHIGH }; + private static final String MSG_NAME_ATMOSPHERE_VACUUM = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Vacuum"); + private static final String MSG_NAME_ATMOSPHERE_TRACE = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Trace"); + private static final String MSG_NAME_ATMOSPHERE_THIN = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Thin"); + private static final String MSG_NAME_ATMOSPHERE_STANDARD = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Standard"); + private static final String MSG_NAME_ATMOSPHERE_HIGH = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.High"); + private static final String MSG_NAME_ATMOSPHERE_VHIGH = Messages.getString("PlanetaryConditions.DisplayableName.Atmosphere.Very High"); + public static String[] atmoNames = { MSG_NAME_ATMOSPHERE_VACUUM, MSG_NAME_ATMOSPHERE_TRACE, MSG_NAME_ATMOSPHERE_THIN, + MSG_NAME_ATMOSPHERE_STANDARD, MSG_NAME_ATMOSPHERE_HIGH, MSG_NAME_ATMOSPHERE_VHIGH }; public static final int ATMO_SIZE = atmoNames.length; - private static final String PC_INDICATOR_ATMOSPHERE_VACUUM = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.Vacuum"); - private static final String PC_INDICATOR_ATMOSPHERE_TRACE = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.Trace"); - private static final String PC_INDICATOR_ATMOSPHERE_THIN = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.Thin"); - private static final String PC_INDICATOR_ATMOSPHERE_STANDARD = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.Standard"); - private static final String PC_INDICATOR_ATMOSPHERE_HIGH = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.High"); - private static final String PC_INDICATOR_ATMOSPHERE_VHIGH = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.VHigh"); - private static String[] atmosphereIndicators = { PC_INDICATOR_ATMOSPHERE_VACUUM, PC_INDICATOR_ATMOSPHERE_TRACE, PC_INDICATOR_ATMOSPHERE_THIN, - PC_INDICATOR_ATMOSPHERE_STANDARD ,PC_INDICATOR_ATMOSPHERE_HIGH ,PC_INDICATOR_ATMOSPHERE_VHIGH }; + private static final String MSG_INDICATOR_ATMOSPHERE_VACUUM = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.Vacuum"); + private static final String MSG_INDICATOR_ATMOSPHERE_TRACE = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.Trace"); + private static final String MSG_INDICATOR_ATMOSPHERE_THIN = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.Thin"); + private static final String MSG_INDICATOR_ATMOSPHERE_STANDARD = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.Standard"); + private static final String MSG_INDICATOR_ATMOSPHERE_HIGH = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.High"); + private static final String MSG_INDICATOR_ATMOSPHERE_VHIGH = Messages.getString("PlanetaryConditions.Indicator.Atmosphere.VHigh"); + private static String[] atmosphereIndicators = { MSG_INDICATOR_ATMOSPHERE_VACUUM, MSG_INDICATOR_ATMOSPHERE_TRACE, MSG_INDICATOR_ATMOSPHERE_THIN, + MSG_INDICATOR_ATMOSPHERE_STANDARD ,MSG_INDICATOR_ATMOSPHERE_HIGH ,MSG_INDICATOR_ATMOSPHERE_VHIGH }; // fog public static final int FOG_NONE = 0; public static final int FOG_LIGHT = 1; public static final int FOG_HEAVY = 2; - private static final String PC_NAME_FOG_NONE = Messages.getString("PlanetaryConditions.DisplayableName.Fog.None"); - private static final String PC_NAME_FOG_LIGHT = Messages.getString("PlanetaryConditions.DisplayableName.Fog.Light Fog"); - private static final String PC_NAME_FOG_HEAVY = Messages.getString("PlanetaryConditions.DisplayableName.Fog.Heavy Fog"); - private static String[] fogNames = { PC_NAME_FOG_NONE, PC_NAME_FOG_LIGHT, PC_NAME_FOG_HEAVY }; + private static final String MSG_NAME_FOG_NONE = Messages.getString("PlanetaryConditions.DisplayableName.Fog.None"); + private static final String MSG_NAME_FOG_LIGHT = Messages.getString("PlanetaryConditions.DisplayableName.Fog.Light Fog"); + private static final String MSG_NAME_FOG_HEAVY = Messages.getString("PlanetaryConditions.DisplayableName.Fog.Heavy Fog"); + private static String[] fogNames = { MSG_NAME_FOG_NONE, MSG_NAME_FOG_LIGHT, MSG_NAME_FOG_HEAVY }; public static final int FOG_SIZE = fogNames.length; - private static final String PC_INDICATOR_FOG_NONE = Messages.getString("PlanetaryConditions.Indicator.Fog.None"); - private static final String PC_INDICATOR_FOG_LIGHT = Messages.getString("PlanetaryConditions.Indicator.Fog.Light"); - private static final String PC_INDICATOR_FOG_HEAVY = Messages.getString("PlanetaryConditions.Indicator.Fog.Heavy"); - private static String[] fogIndicators = { PC_INDICATOR_FOG_NONE, PC_INDICATOR_FOG_LIGHT, PC_INDICATOR_FOG_HEAVY }; + private static final String MSG_INDICATOR_FOG_NONE = Messages.getString("PlanetaryConditions.Indicator.Fog.None"); + private static final String MSG_INDICATOR_FOG_LIGHT = Messages.getString("PlanetaryConditions.Indicator.Fog.Light"); + private static final String MSG_INDICATOR_FOG_HEAVY = Messages.getString("PlanetaryConditions.Indicator.Fog.Heavy"); + private static String[] fogIndicators = { MSG_INDICATOR_FOG_NONE, MSG_INDICATOR_FOG_LIGHT, MSG_INDICATOR_FOG_HEAVY }; // misc private boolean blowingSand = false; - private static final String PC_NAME_BLOWINGSAND_TRUE = Messages.getString("PlanetaryConditions.DisplayableName.SandBlowing.true"); - private static final String PC_NAME_BLOWINGSAND_FALSE = Messages.getString("PlanetaryConditions.DisplayableName.SandBlowing.false"); - private static final String PC_INDICATOR_BLOWINGSAND_TRUE = Messages.getString("PlanetaryConditions.Indicator.SandBlowing.true"); - private static final String PC_INDICATOR_BLOWINGSAND_FALSE = Messages.getString("PlanetaryConditions.Indicator.SandBlowing.false"); + private static final String MSG_NAME_BLOWINGSAND_TRUE = Messages.getString("PlanetaryConditions.DisplayableName.SandBlowing.true"); + private static final String MSG_NAME_BLOWINGSAND_FALSE = Messages.getString("PlanetaryConditions.DisplayableName.SandBlowing.false"); + private static final String MSG_INDICATOR_BLOWINGSAND_TRUE = Messages.getString("PlanetaryConditions.Indicator.SandBlowing.true"); + private static final String MSG_INDICATOR_BLOWINGSAND_FALSE = Messages.getString("PlanetaryConditions.Indicator.SandBlowing.false"); private boolean sandStorm = false; private boolean runOnce = false; @@ -221,20 +221,20 @@ public class PlanetaryConditions implements Serializable { private int fog = FOG_NONE; private int temperature = 25; private int oldTemperature = 25; - private static final String PC_NAME_TEMPERATURE_COLD = Messages.getString("PlanetaryConditions.DisplayableName.Temperature.ExtremeCold"); - private static final String PC_NAME_TEMPERATURE_HEAT = Messages.getString("PlanetaryConditions.DisplayableName.Temperature.ExtremeHeat"); - private static final String PC_INDICATOR_TEMPERATURE_COLD = Messages.getString("PlanetaryConditions.Indicator.Temperature.ExtremeCold"); - private static final String PC_INDICATOR_TEMPERATURE_HEAT= Messages.getString("PlanetaryConditions.Indicator.Temperature.ExtremeHeat"); - private static final String PC_INDICATOR_TEMPERATURE_NORMAL = Messages.getString("PlanetaryConditions.Indicator.Temperature.Normal"); + private static final String MSG_NAME_TEMPERATURE_COLD = Messages.getString("PlanetaryConditions.DisplayableName.Temperature.ExtremeCold"); + private static final String MSG_NAME_TEMPERATURE_HEAT = Messages.getString("PlanetaryConditions.DisplayableName.Temperature.ExtremeHeat"); + private static final String MSG_INDICATOR_TEMPERATURE_COLD = Messages.getString("PlanetaryConditions.Indicator.Temperature.ExtremeCold"); + private static final String MSG_INDICATOR_TEMPERATURE_HEAT= Messages.getString("PlanetaryConditions.Indicator.Temperature.ExtremeHeat"); + private static final String MSG_INDICATOR_TEMPERATURE_NORMAL = Messages.getString("PlanetaryConditions.Indicator.Temperature.Normal"); private float gravity = (float) 1.0; - private static final String PC_INDICATOR_GRAVITY_LOW= Messages.getString("PlanetaryConditions.Indicator.Gravity.Low"); - private static final String PC_INDICATOR_GRAVITY_NORMAL = Messages.getString("PlanetaryConditions.Indicator.Gravity.Normal"); - private static final String PC_INDICATOR_GRAVITY_HIGH = Messages.getString("PlanetaryConditions.Indicator.Gravity.High"); + private static final String MSG_INDICATOR_GRAVITY_LOW= Messages.getString("PlanetaryConditions.Indicator.Gravity.Low"); + private static final String MSG_INDICATOR_GRAVITY_NORMAL = Messages.getString("PlanetaryConditions.Indicator.Gravity.Normal"); + private static final String MSG_INDICATOR_GRAVITY_HIGH = Messages.getString("PlanetaryConditions.Indicator.Gravity.High"); private boolean emi = false; - private static final String PC_NAME_EMI_TRUE = Messages.getString("PlanetaryConditions.DisplayableName.EMI.true"); - private static final String PC_NAME_EMI_FALSE = Messages.getString("PlanetaryConditions.DisplayableName.EMI.false"); - private static final String PC_INDICATOR_EMI_TRUE = Messages.getString("PlanetaryConditions.Indicator.EMI.true"); - private static final String PC_INDICATOR_EMI_FALSE = Messages.getString("PlanetaryConditions.Indicator.EMI.false"); + private static final String MSG_NAME_EMI_TRUE = Messages.getString("PlanetaryConditions.DisplayableName.EMI.true"); + private static final String MSG_NAME_EMI_FALSE = Messages.getString("PlanetaryConditions.DisplayableName.EMI.false"); + private static final String MSG_INDICATOR_EMI_TRUE = Messages.getString("PlanetaryConditions.Indicator.EMI.true"); + private static final String MSG_INDICATOR_EMI_FALSE = Messages.getString("PlanetaryConditions.Indicator.EMI.false"); private boolean terrainAffected = true; private int maxWindStrength = PlanetaryConditions.WI_TORNADO_F4; private int minWindStrength = PlanetaryConditions.WI_NONE; @@ -288,9 +288,9 @@ public static String getWeatherDisplayableName(int type) { public static String getTemperatureDisplayableName(int temp) { if (isExtremeTemperature(temp) && (temp > 0)) { - return String.format("%d (%s)", temp, PC_NAME_TEMPERATURE_HEAT); + return String.format("%d (%s)", temp, MSG_NAME_TEMPERATURE_HEAT); } else if (isExtremeTemperature(temp) && (temp <= 0)) { - return String.format("%d (%s)", temp, PC_NAME_TEMPERATURE_COLD); + return String.format("%d (%s)", temp, MSG_NAME_TEMPERATURE_COLD); } else { return String.valueOf(temp); } @@ -1241,40 +1241,40 @@ public String getAtmosphereIndicator() { public String getGravityIndicator() { if (gravity > 1.0) { - return PC_INDICATOR_GRAVITY_HIGH; + return MSG_INDICATOR_GRAVITY_HIGH; } else if ((gravity < 1.0)) { - return PC_INDICATOR_GRAVITY_LOW; + return MSG_INDICATOR_GRAVITY_LOW; } - return PC_INDICATOR_GRAVITY_NORMAL; + return MSG_INDICATOR_GRAVITY_NORMAL; } public String getTemperatureIndicator() { if (isExtremeTemperatureHeat()) { - return PC_INDICATOR_TEMPERATURE_HEAT; + return MSG_INDICATOR_TEMPERATURE_HEAT; } else if (isExtremeTemperatureCold()) { - return PC_INDICATOR_TEMPERATURE_COLD; + return MSG_INDICATOR_TEMPERATURE_COLD; } - return PC_INDICATOR_TEMPERATURE_NORMAL; + return MSG_INDICATOR_TEMPERATURE_NORMAL; } public String getEMIIndicator() { - return hasEMI() ? PC_INDICATOR_EMI_TRUE : PC_INDICATOR_EMI_FALSE; + return hasEMI() ? MSG_INDICATOR_EMI_TRUE : MSG_INDICATOR_EMI_FALSE; } public String getSandBlowingIndicator() { - return hasEMI() ? PC_INDICATOR_BLOWINGSAND_TRUE : PC_INDICATOR_BLOWINGSAND_FALSE; + return hasEMI() ? MSG_INDICATOR_BLOWINGSAND_TRUE : MSG_INDICATOR_BLOWINGSAND_FALSE; } public String getEMIDisplayableValue() { - return hasEMI() ? PC_NAME_EMI_TRUE : PC_NAME_EMI_FALSE; + return hasEMI() ? MSG_NAME_EMI_TRUE : MSG_NAME_EMI_FALSE; } public String getSandBlowingDisplayableValue() { - return isSandBlowing() ? PC_NAME_BLOWINGSAND_TRUE : PC_NAME_BLOWINGSAND_FALSE; + return isSandBlowing() ? MSG_NAME_BLOWINGSAND_TRUE : MSG_NAME_BLOWINGSAND_FALSE; } } From 1c4a7961dae8aeab3f3f40e53f6d47818ef6346b Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Wed, 14 Dec 2022 16:15:41 -0500 Subject: [PATCH 18/18] RFE 426 overlay for Planetary Conditions update 17 --- .../ui/swing/boardview/PlanetaryConditionsOverlay.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java index ce03a6436af..b833ac1feb3 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -394,12 +394,8 @@ public void gameTurnChange(GameTurnChangeEvent e) { @Override public void preferenceChange(PreferenceChangeEvent e) { - if (e.getName().equals(KeyBindParser.KEYBINDS_CHANGED)) { - changed = true; - } - if (e.getName().equals(GUIPreferences.GUI_SCALE)) { - changed = true; - } + // change on any preference change + changed = true; } }