* GUI: added card hints with current and next rooms in card rules (#8012);

This commit is contained in:
Oleg Agafonov 2021-08-29 01:00:49 +04:00
parent f35ca8112c
commit 1809fb516a
5 changed files with 23 additions and 2 deletions

View file

@ -667,6 +667,12 @@ public final class ManaSymbols {
if (replaced.contains(HintUtils.HINT_ICON_REQUIRE)) {
replaced = replaced.replace(HintUtils.HINT_ICON_REQUIRE, GuiDisplayUtil.getHintIconHtml("require", symbolSize) + " ");
}
if (replaced.contains(HintUtils.HINT_ICON_DUNGEON_ROOM_CURRENT)) {
replaced = replaced.replace(HintUtils.HINT_ICON_DUNGEON_ROOM_CURRENT, GuiDisplayUtil.getHintIconHtml("arrow-right-square-fill-green", symbolSize) + " ");
}
if (replaced.contains(HintUtils.HINT_ICON_DUNGEON_ROOM_NEXT)) {
replaced = replaced.replace(HintUtils.HINT_ICON_DUNGEON_ROOM_NEXT, GuiDisplayUtil.getHintIconHtml("arrow-down-right-square fill-yellow", symbolSize) + " ");
}
// ignored data restore
replaced = replaced

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -18,6 +18,8 @@ public class HintUtils {
public static final String HINT_ICON_BAD = "ICON_BAD";
public static final String HINT_ICON_RESTRICT = "ICON_RESTRICT";
public static final String HINT_ICON_REQUIRE = "ICON_REQUIRE";
public static final String HINT_ICON_DUNGEON_ROOM_CURRENT = "ICON_DUNGEON_ROOM_CURRENT";
public static final String HINT_ICON_DUNGEON_ROOM_NEXT = "ICON_DUNGEON_ROOM_NEXT";
//
public static final String HINT_START_MARK = "<br/><hintstart/>"; // workaround to find hint text in rules list and shows it in html
@ -34,7 +36,7 @@ public class HintUtils {
String hex = colorToHtml(color);
res = String.format("<font color=%s>%s</font>", hex, text);
} else {
res = text;
res = (text == null ? "" : text);
}
// icon

View file

@ -11,6 +11,7 @@ import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.hint.HintUtils;
import mage.abilities.text.TextPart;
import mage.cards.FrameStyle;
import mage.choices.Choice;
@ -125,7 +126,19 @@ public class Dungeon implements CommandObject {
"Currently in " + currentRoom.getName() :
"Not currently in a room"
) + ")</i>");
dungeonRooms.stream().map(DungeonRoom::toString).forEach(rules::add);
dungeonRooms.stream()
.map(room -> {
// mark useful rooms by icons
String prefix = "";
if (room.equals(currentRoom)) {
prefix += HintUtils.prepareText(null, null, HintUtils.HINT_ICON_DUNGEON_ROOM_CURRENT);
}
if (currentRoom != null && currentRoom.getNextRooms().stream().anyMatch(room::equals)) {
prefix += HintUtils.prepareText(null, null, HintUtils.HINT_ICON_DUNGEON_ROOM_NEXT);
}
return prefix + room;
})
.forEach(rules::add);
return rules;
}