forked from unimatrix/web
Render the player mission journal in the opt-in fullscreen viewer
This commit is contained in:
parent
a7448814de
commit
f3e6fe29b0
1 changed files with 54 additions and 11 deletions
|
|
@ -36,6 +36,8 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
private static final int LAST_ROW = 5, LAST_CARD_HEIGHT = 64;
|
||||
private static final Font CARD_TITLE = new Font(Font.SANS_SERIF, Font.BOLD, 17);
|
||||
private static final Font CARD_LORE = new Font(Font.SANS_SERIF, Font.PLAIN, 13);
|
||||
private static final int JOURNAL_LORE_LINES = 5;
|
||||
private static final Font JOURNAL_LORE = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
|
||||
private static final Font CHECKOUT_TERMS = new Font(Font.SANS_SERIF, Font.BOLD, 15);
|
||||
private static final int PREVIOUS = -1, NEXT = -2, EMPTY = -3;
|
||||
private static final int CHECKOUT_BACK = 45, CHECKOUT_BUY = 49, CHECKOUT_CONTROLS = 2;
|
||||
|
|
@ -451,6 +453,7 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
return switch (scene.document.style()) {
|
||||
case ORGANISATION -> new Palette(new Color(16, 31, 37), new Color(29, 75, 79), new Color(142, 228, 211));
|
||||
case EXCHANGE, EXCHANGE_CHECKOUT -> new Palette(new Color(42, 28, 18), new Color(91, 62, 36), new Color(245, 208, 139));
|
||||
case JOURNAL -> new Palette(new Color(30, 40, 31), new Color(61, 80, 51), new Color(235, 212, 154));
|
||||
case HOUSE -> new Palette(new Color(34, 26, 39), new Color(72, 52, 79), new Color(244, 211, 152));
|
||||
case AUTO -> scene.roleplay == null
|
||||
? new Palette(new Color(25, 40, 46), new Color(52, 93, 107), new Color(237, 199, 105))
|
||||
|
|
@ -475,6 +478,12 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
for (Card card : document.cards()) {
|
||||
boolean seal = document.style() == Style.HOUSE && nativeArt(card.material()) != null;
|
||||
graphics.setFont(CARD_TITLE);
|
||||
if (document.style() == Style.JOURNAL) {
|
||||
if (!wrap(graphics, card.title(), 114, 2).complete) return false;
|
||||
graphics.setFont(JOURNAL_LORE);
|
||||
if (!journalLore(graphics, card).complete) return false;
|
||||
continue;
|
||||
}
|
||||
if (!wrap(graphics, card.title(), 114, seal ? 2 : 3).complete) return false;
|
||||
graphics.setFont(CARD_LORE);
|
||||
if (!wrap(graphics, styledLore(document.style(), card), 114, seal ? 2 : 3).complete) return false;
|
||||
|
|
@ -503,6 +512,16 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
return lines;
|
||||
}
|
||||
|
||||
private static Wrapped journalLore(java.awt.Graphics2D draw, Card card) {
|
||||
var lines = new ArrayList<String>();
|
||||
for (String entry : card.lore()) {
|
||||
var wrapped = wrap(draw, entry, 114, JOURNAL_LORE_LINES - lines.size());
|
||||
lines.addAll(wrapped.lines());
|
||||
if (!wrapped.complete()) return new Wrapped(lines, false);
|
||||
}
|
||||
return new Wrapped(lines, true);
|
||||
}
|
||||
|
||||
private static String styledLore(Style style, Card card) {
|
||||
if (card.lore().isEmpty()) return "";
|
||||
if (style == Style.HOUSE && card.material().startsWith("house_"))
|
||||
|
|
@ -534,6 +553,12 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
draw.setColor(palette.background.darker());
|
||||
draw.fillRect(644, 389, 120, 232);
|
||||
switch (document.style()) {
|
||||
case JOURNAL -> {
|
||||
drawResource(draw, "/mcgui/dunerealms-season-logo-v2.png", 650, 449, 108, 96);
|
||||
draw.setColor(palette.accent);
|
||||
draw.drawLine(650, 446, 758, 446);
|
||||
draw.drawLine(650, 549, 758, 549);
|
||||
}
|
||||
case EXCHANGE_CHECKOUT -> {
|
||||
draw.setColor(Color.WHITE);
|
||||
draw.setFont(CHECKOUT_TERMS);
|
||||
|
|
@ -565,7 +590,20 @@ final class PaperDecisionsScene implements DecisionsViewTransport, Listener, Aut
|
|||
if (style == Style.AUTO) return false;
|
||||
String art = nativeArt(card.material());
|
||||
draw.setColor(palette.accent);
|
||||
if (style == Style.ORGANISATION) {
|
||||
if (style == Style.JOURNAL) {
|
||||
draw.drawLine(x + 7, y + 48, x + 121, y + 48);
|
||||
draw.setColor(Color.WHITE);
|
||||
draw.setFont(CARD_TITLE);
|
||||
writeWrapped(draw, card.title(), x + 7, y + 21, 114, 2);
|
||||
draw.setColor(palette.accent);
|
||||
draw.setFont(JOURNAL_LORE);
|
||||
int lineY = y + 64;
|
||||
for (String line : journalLore(draw, card).lines()) {
|
||||
draw.drawString(line, x + 7, lineY);
|
||||
lineY += draw.getFontMetrics().getHeight();
|
||||
}
|
||||
return true;
|
||||
} else if (style == Style.ORGANISATION) {
|
||||
draw.fillRect(x, y + 3, 4, 122);
|
||||
draw.drawLine(x + 7, y + 69, x + 119, y + 69);
|
||||
} else if (style == Style.EXCHANGE || style == Style.EXCHANGE_CHECKOUT) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff