Skip to content

Commit

Permalink
correct issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kuronekochomusuke committed Oct 13, 2024
1 parent a0c3098 commit 598fd99
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public String getTooltip(Point point, Coords movementTarget) {
if (!game.getBoard().contains(coords)) {
return null;
}

String fontSizeAttr = String.format("class=%s", GUIP.getUnitToolTipFontSizeMod());
Entity selectedEntity = (clientGui != null) ? clientGui.getDisplayedUnit() : null;
Player localPlayer = localPlayer();
Hex mhex = game.getBoard().getHex(coords);
Expand Down Expand Up @@ -125,9 +127,13 @@ public String getTooltip(Point point, Coords movementTarget) {
String sInvalidHex = Messages.getString("BoardView1.invalidHex");
sInvalidHex += "<BR>";
sInvalidHex += String.join("<BR>", errors);
attr = String.format("FACE=Dialog COLOR=%s", UIUtil.toColorHexString((GUIP.getUnitToolTipFGColor())));
attr = String.format("FACE=Dialog COLOR=%s", UIUtil.toColorHexString((GUIP.getUnitToolTipTerrainFGColor())));
sInvalidHex += UIUtil.tag("FONT", attr, sInvalidHex);
result += "<BR>" + sInvalidHex;
sInvalidHex = UIUtil.tag("span", fontSizeAttr, sInvalidHex);
col = UIUtil.tag("TD", "", sInvalidHex);
row = UIUtil.tag("TR", "", col);
attr = String.format("BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipTerrainBGColor()));
result += UIUtil.tag("TABLE", attr, row);
}
}
}
Expand Down Expand Up @@ -177,6 +183,7 @@ public String getTooltip(Point point, Coords movementTarget) {

String attr = String.format("FACE=Dialog COLOR=%s", UIUtil.toColorHexString(GUIP.getUnitToolTipBlockFGColor()));
sUnitsInfo = UIUtil.tag("FONT", attr, sUnitsInfo);
sUnitsInfo = UIUtil.tag("span", fontSizeAttr, sUnitsInfo);
String col = UIUtil.tag("TD", "", sUnitsInfo);
String row = UIUtil.tag("TR", "", col);
attr = String.format("BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBlockBGColor()));
Expand All @@ -191,6 +198,7 @@ public String getTooltip(Point point, Coords movementTarget) {

String attr = String.format("FACE=Dialog COLOR=%s", UIUtil.toColorHexString(GUIP.getUnitToolTipAltFGColor()));
sAttackSprite = UIUtil.tag("FONT", attr, sAttackSprite);
sAttackSprite = UIUtil.tag("span", fontSizeAttr, sAttackSprite);
String col = UIUtil.tag("TD", "", sAttackSprite);
String row = UIUtil.tag("TR", "", col);
attr = String.format("BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipAltBGColor()));
Expand Down Expand Up @@ -231,6 +239,7 @@ public String getTooltip(Point point, Coords movementTarget) {

String attr = String.format("FACE=Dialog COLOR=%s", UIUtil.toColorHexString(GUIP.getUnitToolTipBlockFGColor()));
msg_artilleryatack = UIUtil.tag("FONT", attr, msg_artilleryatack);
msg_artilleryatack = UIUtil.tag("span", fontSizeAttr, msg_artilleryatack);
String col = UIUtil.tag("TD", "", msg_artilleryatack);
String row = UIUtil.tag("TR", "", col);
attr = String.format("BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBlockBGColor()));
Expand Down Expand Up @@ -261,7 +270,11 @@ public String getTooltip(Point point, Coords movementTarget) {
String attr = String.format("FACE=Dialog COLOR=%s", UIUtil.toColorHexString(GUIP.getUnitToolTipFGColor()));
msg_artilleryautohit = UIUtil.tag("FONT", attr, msg_artilleryautohit);

result += msg_artilleryautohit + "<BR>";
msg_artilleryautohit = UIUtil.tag("span", fontSizeAttr, msg_artilleryautohit);
String col = UIUtil.tag("TD", "", msg_artilleryautohit);
String row = UIUtil.tag("TR", "", col);
attr = String.format("BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBGColor()));
result += UIUtil.tag("TABLE", attr, row);
}

final Collection<SpecialHexDisplay> shdList = game.getBoard().getSpecialHexDisplay(coords);
Expand Down Expand Up @@ -295,7 +308,11 @@ public String getTooltip(Point point, Coords movementTarget) {
}
}

result += sSpecialHex;
sSpecialHex = UIUtil.tag("span", fontSizeAttr, sSpecialHex);
String col = UIUtil.tag("TD", "", sSpecialHex);
String row = UIUtil.tag("TR", "", col);
String attr = String.format("BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBGColor()));
result += UIUtil.tag("TABLE", attr, row);
}

StringBuilder txt = new StringBuilder();
Expand Down Expand Up @@ -356,8 +373,7 @@ public void appendEntityTooltip(StringBuffer txt, @Nullable Entity entity) {

String result = "<HR STYLE=WIDTH:90% />";
String entityTip = UnitToolTip.getEntityTipGame(entity, localPlayer()).toString();
String table = UnitToolTip.addPlayerColorBoarder(GUIP, entity, entityTip);
result += table;
result += entityTip;

txt.append(result);
}
Expand Down
12 changes: 6 additions & 6 deletions megamek/src/megamek/client/ui/swing/tooltip/HexTooltip.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static String getHexTip(Hex mhex, @Nullable Client client, GUIPreferences
sFuelTank = UIUtil.tag("span", fontSizeAttr, sFuelTank);
String col = UIUtil.tag("TD", "", sFuelTank);
String row = UIUtil.tag("TR", "", col);
attr = String.format("BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBuildingBGColor()));
attr = String.format("CELLSPACING=0 CELLPADDING=0 BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBuildingBGColor()));
String table = UIUtil.tag("TABLE", attr, row);
result.append(table);
}
Expand Down Expand Up @@ -105,7 +105,7 @@ public static String getHexTip(Hex mhex, @Nullable Client client, GUIPreferences
sBuilding = UIUtil.tag("span", fontSizeAttr, sBuilding);
String col = UIUtil.tag("TD", "", sBuilding);
String row = UIUtil.tag("TR", "", col);
attr = String.format("BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBuildingBGColor()));
attr = String.format("CELLSPACING=0 CELLPADDING=0 BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBuildingBGColor()));
String table = UIUtil.tag("TABLE", attr, row);
result.append(table);
}
Expand Down Expand Up @@ -133,7 +133,7 @@ public static String getHexTip(Hex mhex, @Nullable Client client, GUIPreferences
sBridge = UIUtil.tag("span", fontSizeAttr, sBridge);
String col = UIUtil.tag("TD", "", sBridge);
String row = UIUtil.tag("TR", "", col);
attr = String.format("BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBuildingBGColor()));
attr = String.format("CELLSPACING=0 CELLPADDING=0 BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBuildingBGColor()));
String table = UIUtil.tag("TABLE", attr, row);
result.append(table);
}
Expand Down Expand Up @@ -204,7 +204,7 @@ public static String getBuildingTargetTip(BuildingTarget target, Board board, GU
sBuilding = UIUtil.tag("span", fontSizeAttr, sBuilding);
String col = UIUtil.tag("TD", "", sBuilding);
String row = UIUtil.tag("TR", "", col);
attr = String.format("BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBuildingBGColor()));
attr = String.format("CELLSPACING=0 CELLPADDING=0 BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBuildingBGColor()));
String table = UIUtil.tag("TABLE", attr, row);

return table;
Expand Down Expand Up @@ -353,7 +353,7 @@ public static String getAttilleryHit(GUIPreferences GUIP, Game game, Coords coor
sAttilleryAutoHix = UIUtil.tag("span", fontSizeAttr, sAttilleryAutoHix);
String col = UIUtil.tag("TD", "", sAttilleryAutoHix);
String row = UIUtil.tag("TR", "", col);
attr = String.format("BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBGColor()));
attr = String.format("CELLSPACING=0 CELLPADDING=0 BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipBGColor()));
String table = UIUtil.tag("TABLE", attr, row);

return table;
Expand Down Expand Up @@ -399,7 +399,7 @@ public static String getWrecks(GUIPreferences GUIP, BoardView bv, Coords coords)
rows += row;
}

attr = String.format("BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipAltBGColor()));
attr = String.format("CELLSPACING=0 CELLPADDING=0 BORDER=0 BGCOLOR=%s width=100%%", GUIPreferences.hexColor(GUIP.getUnitToolTipAltBGColor()));
String table = UIUtil.tag("TABLE", attr, rows);
result = table;
}
Expand Down
Loading

0 comments on commit 598fd99

Please sign in to comment.