forked from External/mage
game: improved game logs for faced-down spells and exiled cards - now it support popup hint to view card/permanent (part of #11884, related to #11881, #8781)
This commit is contained in:
parent
4334ac8987
commit
c8a9a1a9db
8 changed files with 77 additions and 26 deletions
|
|
@ -757,7 +757,9 @@ public final class CardUtil {
|
|||
}
|
||||
|
||||
public static boolean haveEmptyName(String name) {
|
||||
return name == null || name.isEmpty() || name.equals(EmptyNames.FACE_DOWN_CREATURE.toString()) || name.equals(EmptyNames.FACE_DOWN_TOKEN.toString());
|
||||
return name == null
|
||||
|| name.isEmpty()
|
||||
|| EmptyNames.isEmptyName(name);
|
||||
}
|
||||
|
||||
public static boolean haveEmptyName(MageObject object) {
|
||||
|
|
|
|||
|
|
@ -33,12 +33,15 @@ public final class GameLog {
|
|||
static final String LOG_TT_COLOR_COLORLESS = "#94A4BA";
|
||||
static final String LOG_COLOR_NEUTRAL = "#F0F8FF"; // AliceBlue
|
||||
|
||||
private static String getNameForLogs(MageObject mageObject) {
|
||||
if (mageObject.getName().equals(EmptyNames.FACE_DOWN_CREATURE.toString())
|
||||
|| mageObject.getName().equals(EmptyNames.FACE_DOWN_TOKEN.toString())) {
|
||||
private static String getNameForLogs(MageObject object) {
|
||||
return getNameForLogs(object.getName());
|
||||
}
|
||||
|
||||
private static String getNameForLogs(String objectName) {
|
||||
if (EmptyNames.isEmptyName(objectName)) {
|
||||
return EmptyNames.EMPTY_NAME_IN_LOGS;
|
||||
} else {
|
||||
return mageObject.getName();
|
||||
return objectName;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -74,14 +77,27 @@ public final class GameLog {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create object "link" in game logs
|
||||
*/
|
||||
public static String getNeutralObjectIdName(String objectName, UUID objectId) {
|
||||
return getColoredObjectIdName(
|
||||
new ObjectColor(),
|
||||
objectId,
|
||||
getNameForLogs(objectName),
|
||||
String.format("[%s]", objectId.toString().substring(0, 3)),
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare html text with additional object info (can be used for card popup in GUI)
|
||||
*
|
||||
* @param color text color of the colored part
|
||||
* @param objectID object id
|
||||
* @param visibleColorPart colored part, popup will be work on it
|
||||
* @param color text color of the colored part
|
||||
* @param objectID object id
|
||||
* @param visibleColorPart colored part, popup will be work on it
|
||||
* @param visibleNormalPart additional part with default color
|
||||
* @param alternativeName alternative name, popup will use it on unknown object id or name
|
||||
* @param alternativeName alternative name, popup will use it on unknown object id or name
|
||||
* @return
|
||||
*/
|
||||
public static String getColoredObjectIdName(ObjectColor color,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue