forked from External/mage
* Some changes to distance calculation of enchantments on the battlefield. Added minimal permanet size preference setting (not working correctly yet).
This commit is contained in:
parent
541e6a7f9b
commit
3b0f7b074f
6 changed files with 519 additions and 248 deletions
|
|
@ -69,7 +69,8 @@ public class GUISizeHelper {
|
|||
public static Dimension otherZonesCardDimension;
|
||||
public static int otherZonesCardVerticalOffset;
|
||||
|
||||
public static Dimension battlefieldCardDimension;
|
||||
public static Dimension battlefieldCardMinDimension;
|
||||
public static Dimension battlefieldCardMaxDimension;
|
||||
|
||||
public static Dimension editorCardDimension;
|
||||
public static int editorCardOffsetSize;
|
||||
|
|
@ -144,8 +145,10 @@ public class GUISizeHelper {
|
|||
otherZonesCardVerticalOffset = otherZonesCardDimension.height / 10;
|
||||
}
|
||||
|
||||
int battlefieldCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_BATTLEFIELD_SIZE, 14);
|
||||
battlefieldCardDimension = new Dimension(CARD_IMAGE_WIDTH * battlefieldCardSize / 42, CARD_IMAGE_HEIGHT * battlefieldCardSize / 42);
|
||||
int battlefieldCardMinSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_BATTLEFIELD_MIN_SIZE, 10);
|
||||
battlefieldCardMinDimension = new Dimension(CARD_IMAGE_WIDTH * battlefieldCardMinSize / 42, CARD_IMAGE_HEIGHT * battlefieldCardMinSize / 42);
|
||||
int battlefieldCardMaxSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_BATTLEFIELD_MAX_SIZE, 14);
|
||||
battlefieldCardMaxDimension = new Dimension(CARD_IMAGE_WIDTH * battlefieldCardMaxSize / 42, CARD_IMAGE_HEIGHT * battlefieldCardMaxSize / 42);
|
||||
|
||||
int editorCardSize = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_GUI_CARD_EDITOR_SIZE, 14);
|
||||
editorCardDimension = new Dimension(CARD_IMAGE_WIDTH * editorCardSize / 42, CARD_IMAGE_HEIGHT * editorCardSize / 42);
|
||||
|
|
|
|||
|
|
@ -23,13 +23,12 @@ public class OldCardLayoutStrategy implements CardLayoutStrategy {
|
|||
/**
|
||||
* This offset is used once to shift all attachments
|
||||
*/
|
||||
private static final int ATTACHMENTS_DX_OFFSET = 11;
|
||||
private static final int ATTACHMENTS_MIN_DX_OFFSET = 12;
|
||||
|
||||
/**
|
||||
* This offset is used for each attachment
|
||||
*/
|
||||
private static final int ATTACHMENT_DX_OFFSET = 0;
|
||||
private static final int ATTACHMENT_DY_OFFSET = 11;
|
||||
private static final int ATTACHMENT_MIN_DY_OFFSET = 12;
|
||||
|
||||
@Override
|
||||
public void doLayout(JLayeredPane jLayeredPane, int width) {
|
||||
|
|
@ -56,7 +55,7 @@ public class OldCardLayoutStrategy implements CardLayoutStrategy {
|
|||
perm.getLinks().clear();
|
||||
Rectangle rectangleBaseCard = perm.getBounds();
|
||||
if (!Plugins.getInstance().isCardPluginLoaded()) {
|
||||
for (UUID attachmentId: permanent.getAttachments()) {
|
||||
for (UUID attachmentId : permanent.getAttachments()) {
|
||||
MagePermanent link = permanents.get(attachmentId);
|
||||
if (link != null) {
|
||||
perm.getLinks().add(link);
|
||||
|
|
@ -67,15 +66,16 @@ public class OldCardLayoutStrategy implements CardLayoutStrategy {
|
|||
}
|
||||
} else {
|
||||
int index = permanent.getAttachments().size();
|
||||
for (UUID attachmentId: permanent.getAttachments()) {
|
||||
for (UUID attachmentId : permanent.getAttachments()) {
|
||||
MagePermanent link = permanents.get(attachmentId);
|
||||
if (link != null) {
|
||||
link.setBounds(rectangleBaseCard);
|
||||
perm.getLinks().add(link);
|
||||
int dyOffset = Math.max(perm.getHeight() / 10, ATTACHMENT_MIN_DY_OFFSET);
|
||||
if (index == 1) {
|
||||
rectangleBaseCard.translate(ATTACHMENTS_DX_OFFSET, ATTACHMENT_DY_OFFSET); // do it once
|
||||
rectangleBaseCard.translate(Math.max(perm.getWidth() / 10, ATTACHMENTS_MIN_DX_OFFSET), dyOffset); // do it once
|
||||
} else {
|
||||
rectangleBaseCard.translate(ATTACHMENT_DX_OFFSET, ATTACHMENT_DY_OFFSET);
|
||||
rectangleBaseCard.translate(0, dyOffset);
|
||||
}
|
||||
perm.setBounds(rectangleBaseCard);
|
||||
jLayeredPane.moveToFront(link);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue