diff --git a/megamek/i18n/megamek/client/messages.properties b/megamek/i18n/megamek/client/messages.properties index 0e446b7d905..a4170b14b02 100644 --- a/megamek/i18n/megamek/client/messages.properties +++ b/megamek/i18n/megamek/client/messages.properties @@ -173,6 +173,16 @@ 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 +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 AdvancedOptions.UnitToolTipSeenByResolution.name=UnitToolTip - Seen By Resolution [1=Someone,2=Team,3=Player] #Board Editor @@ -926,6 +936,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 @@ -1533,6 +1544,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 @@ -1578,7 +1591,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 - #LOS / Ruler tool LOSDialog.inFirstHex=Unit type in the first hex: LOSDialog.InSecondHex=Unit type in the second hex: @@ -2341,6 +2353,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: +PlanetaryConditionsOverlay.Gravity=Gravity: +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..a0772661a5b 100644 --- a/megamek/i18n/megamek/common/messages.properties +++ b/megamek/i18n/megamek/common/messages.properties @@ -201,51 +201,105 @@ 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.Southeast=Southeast -PlanetaryConditions.South=South -PlanetaryConditions.Southwest=Southwest -PlanetaryConditions.Northwest=Northwest -PlanetaryConditions.ExtremeHeat=Extreme Heat -PlanetaryConditions.ExtremeCold=Extreme Cold +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.Southeast=Southeast +PlanetaryConditions.DisplayableName.WindDirection.South=South +PlanetaryConditions.DisplayableName.WindDirection.Southwest=Southwest +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 +PlanetaryConditions.Indicator.Light.Moonless=\u26AA +PlanetaryConditions.Indicator.Light.PitchBlack=\u2588 +PlanetaryConditions.Indicator.Fog.None=\uD83D\uDC41 +PlanetaryConditions.Indicator.Fog.Light=\u2588 \u2022 +PlanetaryConditions.Indicator.Fog.Heavy=\u2588 \u2588 +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 +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.Southeast=\u2B09 +PlanetaryConditions.Indicator.WindDirection.South=\u2191 +PlanetaryConditions.Indicator.WindDirection.Southwest=\u2B08 +PlanetaryConditions.Indicator.WindDirection.Northwest=\u2B0A +PlanetaryConditions.Indicator.WindDirection.RandomWindDirection= +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 +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.SandBlowing.true=\uD83C\uDF2C +PlanetaryConditions.Indicator.SandBlowing.false=\uD83D\uDC41 +PlanetaryConditions.Indicator.Temperature.ExtremeCold=\u2744 +PlanetaryConditions.Indicator.Temperature.Normal=\uD83C\uDF21 +PlanetaryConditions.Indicator.Temperature.ExtremeHeat=\uD83D\uDD25 +PlanetaryConditions.Indicator.Gravity.Low=\u2B71 +PlanetaryConditions.Indicator.Gravity.Normal=\u23AF +PlanetaryConditions.Indicator.Gravity.High=\u2B73 +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/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/mmconf/defaultKeyBinds.xml b/megamek/mmconf/defaultKeyBinds.xml index 91628d1b021..c4fe389f7e5 100644 --- a/megamek/mmconf/defaultKeyBinds.xml +++ b/megamek/mmconf/defaultKeyBinds.xml @@ -162,7 +162,7 @@ - viewActingUnit + viewActingUnit 86 0 false @@ -357,6 +357,13 @@ false + + togglePlanetaryConditions + 80 + 128 + false + + clientSettings 67 diff --git a/megamek/src/megamek/client/ui/swing/ClientGUI.java b/megamek/src/megamek/client/ui/swing/ClientGUI.java index c52b00f1091..bd77d798b44 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 2fdbe137d10..267af94d5fb 100644 --- a/megamek/src/megamek/client/ui/swing/GUIPreferences.java +++ b/megamek/src/megamek/client/ui/swing/GUIPreferences.java @@ -103,6 +103,17 @@ public class GUIPreferences extends PreferenceStoreProxy { public static final String ADVANCED_HEAT_COLOR_30 = "AdvancedHeatColor30"; 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"; + 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"; public static final String ADVANCED_UNITTOOLTIP_SEENBYRESOLUTION = "AdvancedUnitToolTipSeenByResolution"; /* --End advanced settings-- */ @@ -254,6 +265,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"; @@ -299,6 +311,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); @@ -383,6 +400,17 @@ 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_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); setDefault(ADVANCED_UNITTOOLTIP_SEENBYRESOLUTION, 3); @@ -544,6 +572,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); @@ -1724,6 +1753,86 @@ 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 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)); + } + + 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)); + } + + public void setAdvancedPlanetaryConditionsHideDefaults(Boolean 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); + } + public void setAdvancedUnitToolTipSeenByResolution(int i) { store.setValue(ADVANCED_UNITTOOLTIP_SEENBYRESOLUTION, i); } @@ -1756,6 +1865,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 f6053638bf3..daa2ed3f197 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..b833ac1feb3 --- /dev/null +++ b/megamek/src/megamek/client/ui/swing/boardview/PlanetaryConditionsOverlay.java @@ -0,0 +1,401 @@ +/* +* 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.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; + +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.PlanetaryConditions; +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 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; + 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; + + 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 + * 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); + GUIPreferences.getInstance().addPreferenceChangeListener(this); + } + + @Override + 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 + if (changed) { + changed = false; + + // calculate the size from the text lines, font and padding + 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); + + // 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 + 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(); + } + } + + distSide = clientGui.getWidth() - (overlayWidth + 100); + + // 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 + distSide, clipBounds.y + DIST_TOP, null); + ((Graphics2D) graph).setComposite(saveComp); + } else { + graph.drawImage(displayImage, clipBounds.x + distSide, 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) { + if (line.startsWith("#") && line.length() > 7) { + line = line.substring(7); + } + + 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<>(); + + 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; + + String tmpStr = ""; + Boolean showHeading = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsShowHeader(); + 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); + } + + if (clientGui != null && !currentGame.getBoard().inSpace()) { + // In a game, not the Board Editor + + String tempColor = ""; + int temp = currentGame.getPlanetaryConditions().getTemperature(); + + 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()); + } + + boolean showDefaultConditions = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsShowDefaults(); + + Boolean showLabel = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsShowLabels(); + Boolean showValue = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsShowValues(); + Boolean showIndicator = GUIPreferences.getInstance().getAdvancedPlanetaryConditionsShowIndicators(); + + + if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().isExtremeTemperature())))) { + tmpStr = (showLabel ? MSG_TEMPERATURE + " " : ""); + tmpStr = tmpStr + (showValue ? temp + "\u00B0C " : ""); + tmpStr = tmpStr + (showIndicator ? (!showValue ? temp + "\u00B0C " : "" ) + currentGame.getPlanetaryConditions().getTemperatureIndicator() : ""); + result.add(tempColor + tmpStr); + } + + if (((showDefaultConditions) || ((!showDefaultConditions) && (currentGame.getPlanetaryConditions().getGravity() != 1.0)))) { + float grav = currentGame.getPlanetaryConditions().getGravity(); + 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 ? 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 ? 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 ? 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 ? 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 ? MSG_WIND + " " : ""); + tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getWindDisplayableName() + " " : ""); + tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getWindStrengthIndicator() : ""); + result.add(tmpStr); + 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 ? 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 ? MSG_BLOWINGSAND + " " : ""); + tmpStr = tmpStr + (showValue ? currentGame.getPlanetaryConditions().getSandBlowingDisplayableValue() + " " : ""); + tmpStr = tmpStr + (showIndicator ? currentGame.getPlanetaryConditions().getSandBlowingIndicator() : ""); + result.add(tmpStr); + } + } + + 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 = 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) { + 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); + } + + 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); + } + } + + /** + * 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) { + // change on any preference change + 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), diff --git a/megamek/src/megamek/common/PlanetaryConditions.java b/megamek/src/megamek/common/PlanetaryConditions.java index 4bca4e7510e..dd349fd1f30 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 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 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; @@ -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 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 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; @@ -68,15 +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 String[] windNames = { "Calm", "Light Gale", "Moderate Gale", "Strong Gale", "Storm", "Tornado F1-F3", "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 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 String[] dirNames = { "North", "Northeast", "Southeast", "South", "Southwest", "Northwest", "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 = { 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 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 = { 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; @@ -85,20 +166,45 @@ 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 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 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 String[] fogNames = { "None", "Light Fog", "Heavy Fog" }; + 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 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 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; @@ -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 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 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 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; @@ -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, MSG_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, MSG_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"); } @@ -1046,4 +1164,117 @@ private void doSandStormCheck() { public void setRunOnce(boolean run) { runOnce = run; } + + public boolean isExtremeTemperatureHeat() { + return (isExtremeTemperature() && (temperature > 0)); + } + + 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() { + 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() { + 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() { + 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() { + 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() { + 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() { + return getAtmosphereIndicator(atmosphere); + } + + public String getGravityIndicator() { + if (gravity > 1.0) { + return MSG_INDICATOR_GRAVITY_HIGH; + } + else if ((gravity < 1.0)) { + return MSG_INDICATOR_GRAVITY_LOW; + } + + return MSG_INDICATOR_GRAVITY_NORMAL; + } + + public String getTemperatureIndicator() { + if (isExtremeTemperatureHeat()) { + return MSG_INDICATOR_TEMPERATURE_HEAT; + } + else if (isExtremeTemperatureCold()) { + return MSG_INDICATOR_TEMPERATURE_COLD; + } + + return MSG_INDICATOR_TEMPERATURE_NORMAL; + } + + public String getEMIIndicator() { + return hasEMI() ? MSG_INDICATOR_EMI_TRUE : MSG_INDICATOR_EMI_FALSE; + } + + public String getSandBlowingIndicator() { + return hasEMI() ? MSG_INDICATOR_BLOWINGSAND_TRUE : MSG_INDICATOR_BLOWINGSAND_FALSE; + } + + public String getEMIDisplayableValue() { + return hasEMI() ? MSG_NAME_EMI_TRUE : MSG_NAME_EMI_FALSE; + } + + public String getSandBlowingDisplayableValue() { + return isSandBlowing() ? MSG_NAME_BLOWINGSAND_TRUE : MSG_NAME_BLOWINGSAND_FALSE; + } + }