Skip to content

Commit

Permalink
Merge pull request #4129 from kuronekochomusuke/unitToolTipFixes
Browse files Browse the repository at this point in the history
Unit tool tip fixes
  • Loading branch information
HammerGS authored Feb 7, 2023
2 parents 51a4f8b + ff48773 commit c0ba10d
Show file tree
Hide file tree
Showing 8 changed files with 763 additions and 527 deletions.
59 changes: 33 additions & 26 deletions megamek/i18n/megamek/client/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -498,27 +498,29 @@ BoardView1.Tooltip.AbbreviationUpperLeg=UL
BoardView1.Tooltip.AbbreviationLowerLeg=LL
BoardView1.Tooltip.AbbreviationLowerFoot=F
BoardView1.Tooltip.ActiveTroopers=Active Troopers
BoardView1.Tooltip.AeroVelAltFuel=<I>Velocity: {0}, Altitude: {1}, Fuel: {2}</I>
BoardView1.Tooltip.AeroStartingVelAlt=<I>Starting Velocity: {0}, Altitude: {1}</I>
BoardView1.Tooltip.AeroVelAltFuel=Velocity: {0}, Altitude: {1}, Fuel: {2}
BoardView1.Tooltip.AeroStartingVelAlt=Starting Velocity: {0}, Altitude: {1}
BoardView1.Tooltip.AndAC=/AC
BoardView1.Tooltip.Ammo=Ammo
BoardView1.Tooltip.AntiPersonnel=Anti-Personnel
BoardView1.Tooltip.AP=AP
BoardView1.Tooltip.ArmorInternals=Armor {0}; Internal {1}
BoardView1.Tooltip.ArmorCapital=Capital
BoardView1.Tooltip.Armor=Armor: {0}
BoardView1.Tooltip.ArtilleryAttack1=Artillery: {0} in 1 turn<BR><FONT SIZE=-2>&nbsp;&nbsp;Ammo: {1}</FONT>
BoardView1.Tooltip.ArtilleryAttackN=Artillery: {0} in {2} turns<BR><FONT SIZE=-2>&nbsp;&nbsp;Ammo: {1}</FONT>
BoardView1.Tooltip.Arrow=<FONT COLOR=#{0}>&#10145; </FONT>
BoardView1.Tooltip.BlockColored=<FONT COLOR=#{1}>{0}</FONT>
BoardView1.Tooltip.ArtilleryAttackOne1=Artillery: {0} in 1 turn
BoardView1.Tooltip.ArtilleryAttackOne2=Ammo: {0}
BoardView1.Tooltip.ArtilleryAttackN1=Artillery: {0} in {1} turns
BoardView1.Tooltip.ArtilleryAttackN2=Ammo: {0}
BoardView1.Tooltip.Arrow=&#10145;
BoardView1.Tooltip.BlockColored={0}
BoardView1.Tooltip.BV=BV: {0} / {1} ({2, number, percent})
BoardView1.Tooltip.CannotSurvive=Cannot survive
BoardView1.Tooltip.CannotSurviveAtmo=Cannot survive on a low/high atmosphere map!
BoardView1.Tooltip.CannotSurviveGround=Cannot survive on a ground map!
BoardView1.Tooltip.CannotSurviveSpace=Cannot survive in space!
BoardView1.Tooltip.CarriedUnits=Carried Units
BoardView1.Tooltip.Charging=(Charging)
BoardView1.Tooltip.ChassisPlayer=<B>{0}{2} - {1}</B>
BoardView1.Tooltip.ChassisPlayer={0}{2} - {1}
BoardView1.Tooltip.Clan=(C)
BoardView1.Tooltip.ClanBrackets=[Clan]
BoardView1.Tooltip.ClanParens=(Clan)
Expand All @@ -530,13 +532,13 @@ BoardView1.Tooltip.C3M=C3M
BoardView1.Tooltip.IsDestroyed=<S>
BoardView1.Tooltip.IS=(IS)
BoardView1.Tooltip.ISBracket=[IS]
BoardView1.Tooltip.DFA=<BR><I><FONT COLOR=RED>(Death from Above)</FONT></I>
BoardView1.Tooltip.DFA=(Death from Above)
BoardView1.Tooltip.Distance1=Distance from the selected unit: 1 Hex
BoardView1.Tooltip.DistanceN=Distance from the selected unit: {0} Hexes
BoardView1.Tooltip.DistanceMove1=<I>Distance from the movement end point: 1 Hex</I>
BoardView1.Tooltip.DistanceMoveN=<I>Distance from the movement end point: {0} Hexes</I>
BoardView1.Tooltip.Elev=<I><FONT COLOR=#A030A0>Elevation: {0}</FONT></I>
BoardView1.Tooltip.Evade=<BR><I><FONT COLOR=RED>(Evading)</FONT></I>
BoardView1.Tooltip.DistanceMove1=Distance from the movement end point: 1 Hex
BoardView1.Tooltip.DistanceMoveN=Distance from the movement end point: {0} Hexes
BoardView1.Tooltip.Elev=Elevation: {0}
BoardView1.Tooltip.Evade=(Evading)
BoardView1.Tooltip.Facing=Facing
BoardView1.Tooltip.Fighters=Fighters
BoardView1.Tooltip.FighterSquadronEmpty=This Fighter Squadron is empty
Expand All @@ -550,47 +552,50 @@ BoardView1.Tooltip.HotLoadedParens=(Hot-Loaded)
BoardView1.Tooltip.Immobile=Immobile
BoardView1.Tooltip.InfSpec=Specialization: {0}
BoardView1.Tooltip.Internals=Internal: {0}
BoardView1.Tooltip.Jammed=<FONT COLOR=#FF0000>Jammed by Enemy ECM</FONT>
BoardView1.Tooltip.Jammed=Jammed by Enemy ECM
BoardView1.Tooltip.JumpBoosters=Jump Boosters
BoardView1.Tooltip.JumpJets=Jump Jets
BoardView1.Tooltip.LightDmg=LIGHT DMG
BoardView1.Tooltip.ModerateDmg=MODERATE DMG
BoardView1.Tooltip.Movement=Movement: {0}/{1}
BoardView1.Tooltip.MovementF=<I>{0} {1} (TMM: {2})</I>
BoardView1.Tooltip.MovementF={0} {1} (TMM: {2})
BoardView1.Tooltip.NC3=NC3
BoardView1.Tooltip.Network=Network
BoardView1.Tooltip.NotYetMoved=<I>Has not yet moved</I>
BoardView1.Tooltip.NoMove=<I>Did not move (Mod: {0})</I>
BoardView1.Tooltip.NotYetMoved=Has not yet moved
BoardView1.Tooltip.NoMove=Did not move (Mod: {0})
BoardView1.Tooltip.NullWeaponName=NULL Weapon Name!
BoardView1.Tooltip.OutOfAmmo=Out of Ammo!
BoardView1.Tooltip.PartialWing=Partial Wing
BoardView1.Tooltip.PilotPortrait=<TD VALIGN="top"><IMG WIDTH={1} HEIGHT={2} SRC=\"file:{0}\"></TD>
BoardView1.Tooltip.Pilot=Pilot
BoardView1.Tooltip.Prone=Prone
BoardView1.Tooltip.Rapidfire=Rapid-fire
BoardView1.Tooltip.SeenBy=Seen by: {0}
BoardView1.Tooltip.Sensors=Sensor: {0}, Range: {1}
BoardView1.Tooltip.Shots=shots
BoardView1.Tooltip.Someone=Someone
BoardView1.Tooltip.Standard=Standard
BoardView1.Tooltip.StartingElev=<I><FONT COLOR=#A030A0>Starting Elevation: {0}</FONT></I>
BoardView1.Tooltip.StartingElev=Starting Elevation: {0}
BoardView1.Tooltip.Narced=Narc pod attached!
BoardView1.Tooltip.INarced=iNarc pod attached!
BoardView1.Tooltip.SensorsHexInRange=Hex is in sensor range
BoardView1.Tooltip.SensorsHexNotInRange=Hex is <FONT COLOR=RED>not</FONT> in sensor range
BoardView1.Tooltip.SensorsHexNotInRange1=Hex is
BoardView1.Tooltip.SensorsHexNotInRange2=not
BoardView1.Tooltip.SensorsHexNotInRange3= in sensor range
BoardView1.Tooltip.Spotting=Spotting {0}
BoardView1.Tooltip.Swarmed=<FONT COLOR=#FF0000>Swarmed by {0}</FONT>
BoardView1.Tooltip.TakingCover=<BR><I><FONT COLOR=RED>(Taking Cover)</FONT></I>
BoardView1.Tooltip.Swarmed=Swarmed by {0}
BoardView1.Tooltip.TakingCover=(Taking Cover)
BoardView1.Tooltip.TF=TF
BoardView1.Tooltip.ThisUnit=This unit
BoardView1.Tooltip.Towing=Towing: {0}
BoardView1.Tooltip.Turns=turns
BoardView1.Tooltip.TurretLocked=<I><FONT COLOR=RED>Turret locked!</FONT></I>
BoardView1.Tooltip.TurretLocked=Turret locked!
BoardView1.Tooltip.Twist=Twist
BoardView1.Tooltip.UnconnectedC3Computer=Unconnected C3 Computer
BoardView1.Tooltip.Undamaged=UNDAMAGED
BoardView1.Tooltip.UnjammingRAC=Unjamming RAC
BoardView1.Tooltip.Unknown=UNKNOWN
BoardView1.Tooltip.Weapon={3}&nbsp;{1}{2}
BoardView1.Tooltip.Wreckof=Wreck of
BoardView1.Tooltip.Weapon={3} {1}{2}
BoardView1.Tooltip.Wreckof=Wreck of
BoardView1.Tooltip.X=x
BoardView1.Tooltip.ZZ=ZZ

Expand All @@ -602,8 +607,10 @@ BoardView1.Tooltip.BldgBasementCollapsed=<BR><I><FONT COLOR=RED>(collapsed)</FON
BoardView1.Tooltip.Bridge={1} <BR>Height: {0}, CF: {2}
BoardView1.Tooltip.FuelTank={1} <BR>Height: {0}, CF: {2}<BR>Magnitude: {3}

BoardView1.Tooltip.ArtyAutoHint=<FONT SIZE=-2><I>You can show all players&#39;<BR>deployment zones on the board<BR>by pressing {0}.</I></FONT>
BoardView1.Tooltip.ArtyAutoHeader=Deployment Hex for Players:<BR>
BoardView1.Tooltip.ArtyAutoHint1=You can show all players&#39;
BoardView1.Tooltip.ArtyAutoHint2=deployment zones on the board
BoardView1.Tooltip.ArtyAutoHint3= by pressing {0}.
BoardView1.Tooltip.ArtyAutoHeader=Deployment Hex for Players:

#Hidden Units
BoardView1.Tooltip.Hidden=<FONT COLOR=RED>Hidden!</FONT>
Expand Down
27 changes: 17 additions & 10 deletions megamek/src/megamek/client/ui/swing/boardview/AttackSprite.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
import megamek.common.actions.PushAttackAction;
import megamek.common.actions.SearchlightAttackAction;
import megamek.common.actions.WeaponAttackAction;
import megamek.common.enums.GamePhase;

import static megamek.client.ui.swing.util.UIUtil.guiScaledFontHTML;
import static megamek.client.ui.swing.util.UIUtil.uiBlack;

/**
* Sprite and info for an attack. Does not actually use the image buffer as
Expand Down Expand Up @@ -402,16 +406,19 @@ public void addWeapon(SearchlightAttackAction attack) {

@Override
public StringBuffer getTooltip() {
StringBuffer tipString = new StringBuffer();
tipString.append("<FONT COLOR=#");
tipString.append(Integer.toHexString(attackColor.getRGB() & 0xFFFFFF));
tipString.append(">");
tipString.append(attackerDesc
+ "<BR>&nbsp;&nbsp;" + Messages.getString("BoardView1.on") + "&nbsp;&nbsp;" + targetDesc);
tipString.append("</FONT>");
for (String wpD: weaponDescs) {
tipString.append("<BR>"+wpD);
GamePhase phase = this.boardView1.game.getPhase();
String result = "";
String sAttacherDesc = "";

sAttacherDesc = attackerDesc + "<BR>&nbsp;&nbsp;" + Messages.getString("BoardView1.on") + " " + targetDesc;
result = guiScaledFontHTML(attackColor) + sAttacherDesc + "</FONT>";
String sAttacks = "";
if ((phase.isFiring()) || (phase.isPhysical())) {
for (String wpD : weaponDescs) {
sAttacks += "<BR>" + wpD;
}
result += guiScaledFontHTML(uiBlack()) + sAttacks + "</FONT>";
}
return tipString;
return new StringBuffer().append(result);
}
}
Loading

0 comments on commit c0ba10d

Please sign in to comment.