mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
darken non-selectable cards when selecting (needs work)
This commit is contained in:
@@ -253,14 +253,14 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
|||||||
g2d.rotate(getTappedAngle(), cardXOffset + edgeOffset, (cardYOffset + cardHeight)
|
g2d.rotate(getTappedAngle(), cardXOffset + edgeOffset, (cardYOffset + cardHeight)
|
||||||
- edgeOffset);
|
- edgeOffset);
|
||||||
}
|
}
|
||||||
boolean selectable = matchUI.isSelectable(getCard());
|
// System.out.println("Paint " + getCard() + " selecting " + matchUI.isSelecting());
|
||||||
if ( titleText!=null ) { // selectable cards have colored names
|
boolean nonselectable = matchUI.isSelecting() && !matchUI.isSelectable(getCard());
|
||||||
titleText.setForeground(selectable?Color.cyan:Color.white);
|
if ( titleText!=null ) { // non-selectable cards have gray names
|
||||||
|
titleText.setForeground(nonselectable?Color.DARK_GRAY:Color.WHITE);
|
||||||
}
|
}
|
||||||
// if ( imagePanel != null ) { // if selecting, darken non-selectable cards - needs more refreshing to do right
|
if ( imagePanel != null ) { // if selecting, darken non-selectable cards - needs more refreshing to do right
|
||||||
// imagePanel.setBrightness(selectable?1.0f:(matchUI.isSelecting()?0.5f:1.0f));
|
imagePanel.setBrightness(nonselectable?0.4f:1.0f);
|
||||||
//}
|
} super.paint(g2d);
|
||||||
super.paint(g2d);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -304,7 +304,8 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
|||||||
colorIsSet = true;
|
colorIsSet = true;
|
||||||
} else if (ed != null && ed.isWhiteBorder() && state.getFoilIndex() == 0) {
|
} else if (ed != null && ed.isWhiteBorder() && state.getFoilIndex() == 0) {
|
||||||
// Non-foil cards from white-bordered sets are drawn with white border
|
// Non-foil cards from white-bordered sets are drawn with white border
|
||||||
g2d.setColor(Color.WHITE);
|
// unless selecting and card is not selectable
|
||||||
|
g2d.setColor(matchUI.isSelecting()&&!matchUI.isSelectable(getCard())?Color.DARK_GRAY:Color.WHITE);
|
||||||
colorIsSet = true;
|
colorIsSet = true;
|
||||||
}
|
}
|
||||||
if (colorIsSet) {
|
if (colorIsSet) {
|
||||||
@@ -314,9 +315,10 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (matchUI.isSelectable(getCard())) { // Replace border for selectable cards
|
if (matchUI.isSelectable(getCard())) { // Replace border for selectable cards
|
||||||
g2d.setColor(Color.cyan);
|
g2d.setColor(Color.WHITE);
|
||||||
|
final int ins = 1;
|
||||||
|
g2d.fillRoundRect(cardXOffset+ins, cardYOffset+ins, cardWidth-ins*2, cardHeight-ins*2, cornerSize-ins, cornerSize-ins);
|
||||||
// final int n2 = Math.max(2, Math.round(2 * cardWidth * CardPanel.SELECTED_BORDER_SIZE));
|
// final int n2 = Math.max(2, Math.round(2 * cardWidth * CardPanel.SELECTED_BORDER_SIZE));
|
||||||
g2d.fillRoundRect(cardXOffset, (cardYOffset) + offset, cardWidth, cardHeight, cornerSize, cornerSize);
|
|
||||||
// g2d.fillRoundRect(cardXOffset - n2, (cardYOffset - n2) + offset, cardWidth + (n2 * 2), cardHeight + (n2 * 2), cornerSize + n2, cornerSize + n2);
|
// g2d.fillRoundRect(cardXOffset - n2, (cardYOffset - n2) + offset, cardWidth + (n2 * 2), cardHeight + (n2 * 2), cornerSize + n2, cornerSize + n2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -368,6 +370,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
|||||||
final boolean canShow = matchUI.mayView(card);
|
final boolean canShow = matchUI.mayView(card);
|
||||||
final boolean showText = !imagePanel.hasImage() || !isAnimationPanel;
|
final boolean showText = !imagePanel.hasImage() || !isAnimationPanel;
|
||||||
|
|
||||||
|
System.out.println("doLayout " + card);
|
||||||
displayCardNameOverlay(showText && canShow && showCardNameOverlay(), imgSize, imgPos);
|
displayCardNameOverlay(showText && canShow && showCardNameOverlay(), imgSize, imgPos);
|
||||||
displayPTOverlay(showText && (canShow || card.isFaceDown()) && showCardPowerOverlay(), imgSize, imgPos);
|
displayPTOverlay(showText && (canShow || card.isFaceDown()) && showCardPowerOverlay(), imgSize, imgPos);
|
||||||
displayCardIdOverlay(showText && canShow && showCardIdOverlay(), imgSize, imgPos);
|
displayCardIdOverlay(showText && canShow && showCardIdOverlay(), imgSize, imgPos);
|
||||||
@@ -793,6 +796,7 @@ public class CardPanel extends SkinnedPanel implements CardContainer, IDisposabl
|
|||||||
return FModel.getPreferences().getPrefBoolean(preferenceName);
|
return FModel.getPreferences().getPrefBoolean(preferenceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// don't show overlays on non-selectable cards when selecting
|
||||||
private boolean isShowingOverlays() {
|
private boolean isShowingOverlays() {
|
||||||
return isPreferenceEnabled(FPref.UI_SHOW_CARD_OVERLAYS) && card != null;
|
return isPreferenceEnabled(FPref.UI_SHOW_CARD_OVERLAYS) && card != null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user