mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
-Fix bug with HQ Token.
This commit is contained in:
@@ -28,7 +28,7 @@ public class GUI_PictureHQ extends JDialog
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public GUI_PictureHQ(JFrame frame, String c)
|
public GUI_PictureHQ(JFrame frame, Card c)
|
||||||
{
|
{
|
||||||
super(frame);
|
super(frame);
|
||||||
this.setUndecorated(true);
|
this.setUndecorated(true);
|
||||||
@@ -41,16 +41,15 @@ public class GUI_PictureHQ extends JDialog
|
|||||||
getContentPane().add(jPanelPictureHQ, BorderLayout.CENTER);
|
getContentPane().add(jPanelPictureHQ, BorderLayout.CENTER);
|
||||||
jPanelPictureHQ.setBorder(BorderFactory.createEtchedBorder());;
|
jPanelPictureHQ.setBorder(BorderFactory.createEtchedBorder());;
|
||||||
jPanelPictureHQ.removeAll();
|
jPanelPictureHQ.removeAll();
|
||||||
jPanelPictureHQ.add(GuiDisplayUtil.getPictureHQ(c));
|
jPanelPictureHQ.add(GuiDisplayUtil.getPictureHQ(c));
|
||||||
jPanelPictureHQ.revalidate();
|
jPanelPictureHQ.revalidate();
|
||||||
jPanelPictureHQ.addMouseListener(new CustomListener());
|
jPanelPictureHQ.addMouseListener(new CustomListener());
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void letsGo(JFrame frame, String c) throws IOException
|
public void letsGo(JFrame frame, Card c) throws IOException
|
||||||
{
|
{
|
||||||
GUI_PictureHQ trayWindow = new GUI_PictureHQ(frame, c);
|
GUI_PictureHQ trayWindow = new GUI_PictureHQ(frame, c);
|
||||||
int heightHQ = GuiDisplayUtil.getPictureHQheight(c);
|
int heightHQ = GuiDisplayUtil.getPictureHQheight(c);
|
||||||
|
|||||||
@@ -92,8 +92,7 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
|
|||||||
private Action COMPUTER_GRAVEYARD_ACTION;
|
private Action COMPUTER_GRAVEYARD_ACTION;
|
||||||
private Action COMPUTER_REMOVED_ACTION;
|
private Action COMPUTER_REMOVED_ACTION;
|
||||||
private Action CONCEDE_ACTION;
|
private Action CONCEDE_ACTION;
|
||||||
public String cardN;
|
public Card cCardHQ;
|
||||||
public String cOwner;
|
|
||||||
|
|
||||||
public GuiDisplay3() {
|
public GuiDisplay3() {
|
||||||
setupActions();
|
setupActions();
|
||||||
@@ -505,13 +504,7 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
|
|||||||
else this.cdArea.setText(tokenText + counterText);
|
else this.cdArea.setText(tokenText + counterText);
|
||||||
|
|
||||||
cdPanel.setBorder(GuiDisplayUtil.getBorder(c));
|
cdPanel.setBorder(GuiDisplayUtil.getBorder(c));
|
||||||
|
cCardHQ = c;
|
||||||
if(c.getOwner()=="Computer" && c.isFaceDown()==true){
|
|
||||||
cardN = "morph";
|
|
||||||
}else{
|
|
||||||
cardN = c.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//picture
|
//picture
|
||||||
@@ -1174,37 +1167,37 @@ public class GuiDisplay3 extends JFrame implements Display, NewConstants, NewCon
|
|||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
|
|
||||||
if (picturePanel.getComponentCount()!=0){
|
if (picturePanel.getComponentCount()!=0){
|
||||||
cardN= GuiDisplayUtil.cleanString(cardN);
|
if(cCardHQ.isFaceDown()==true && cCardHQ.getOwner()=="Computer"){
|
||||||
cardN = cardN+".jpg";
|
return;
|
||||||
|
}else{
|
||||||
if(GuiDisplayUtil.IsPictureHQExists(cardN)){
|
if(GuiDisplayUtil.IsPictureHQExists(cCardHQ)){
|
||||||
int cWidth = 0;
|
int cWidth = 0;
|
||||||
try {
|
try {
|
||||||
cWidth = GuiDisplayUtil.getPictureHQwidth(cardN);
|
cWidth = GuiDisplayUtil.getPictureHQwidth(cCardHQ);
|
||||||
} catch (IOException e2) {
|
} catch (IOException e2) {
|
||||||
|
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
}
|
}
|
||||||
int cHeight = 0;
|
int cHeight = 0;
|
||||||
try {
|
try {
|
||||||
cHeight = GuiDisplayUtil.getPictureHQheight(cardN);
|
cHeight = GuiDisplayUtil.getPictureHQheight(cCardHQ);
|
||||||
} catch (IOException e2) {
|
} catch (IOException e2) {
|
||||||
|
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(cWidth>=312 &&cHeight >=445){
|
if(cWidth>=312 &&cHeight >=445){
|
||||||
|
|
||||||
GUI_PictureHQ hq = new GUI_PictureHQ(GuiDisplay3.this,cardN);
|
GUI_PictureHQ hq = new GUI_PictureHQ(GuiDisplay3.this,cCardHQ);
|
||||||
try {
|
try {
|
||||||
hq.letsGo(GuiDisplay3.this, cardN);
|
hq.letsGo(GuiDisplay3.this, cCardHQ);
|
||||||
cardN = cardN.substring(0, cardN.length()-4);
|
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}}
|
}}}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import javax.imageio.*;
|
|||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
@@ -210,27 +211,31 @@ public class GuiDisplayUtil implements NewConstants {
|
|||||||
|
|
||||||
|
|
||||||
if(file.exists()) {
|
if(file.exists()) {
|
||||||
int cWidth = 0;
|
if(c.isFaceDown()){
|
||||||
int cHeight = 0;
|
return new PicturePanel(file);
|
||||||
try {
|
}else{
|
||||||
cWidth = GuiDisplayUtil.getPictureHQwidth(filename);
|
int cWidth = 0;
|
||||||
} catch (IOException e) {
|
int cHeight = 0;
|
||||||
|
try {
|
||||||
|
cWidth = GuiDisplayUtil.getPictureHQwidth(c);
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
cHeight = GuiDisplayUtil.getPictureHQheight(c);
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
e.printStackTrace();
|
if(cWidth<=312 || cHeight<=445) {
|
||||||
}
|
return new PicturePanel(file);
|
||||||
|
}else{
|
||||||
try {
|
return new PicturePanelResize(file);
|
||||||
cHeight = GuiDisplayUtil.getPictureHQheight(filename);
|
}
|
||||||
} catch (IOException e) {
|
}
|
||||||
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if(cWidth<=312 || cHeight<=445) {
|
|
||||||
return new PicturePanel(file);
|
|
||||||
}else{
|
|
||||||
return new PicturePanelResize(file);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
JPanel p = new JPanel();
|
JPanel p = new JPanel();
|
||||||
|
|
||||||
@@ -249,27 +254,52 @@ public class GuiDisplayUtil implements NewConstants {
|
|||||||
}//getPicture()
|
}//getPicture()
|
||||||
|
|
||||||
|
|
||||||
public static JPanel getPictureHQ(String c) {
|
public static JPanel getPictureHQ(Card c) {
|
||||||
File file = new File(ForgeProps.getFile(IMAGE_BASE), c);
|
|
||||||
|
String loc = "";
|
||||||
|
if (c.isToken()== false)
|
||||||
|
loc = IMAGE_BASE;
|
||||||
|
else
|
||||||
|
loc = IMAGE_TOKEN;
|
||||||
|
String filename = GuiDisplayUtil.cleanString(c.getImageName()) + ".jpg";
|
||||||
|
File file = new File(ForgeProps.getFile(loc), filename);
|
||||||
return new PicturePanel(file);
|
return new PicturePanel(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static int getPictureHQheight(String c) throws IOException{
|
public static int getPictureHQheight(Card c) throws IOException{
|
||||||
File file = new File(ForgeProps.getFile(IMAGE_BASE), c);
|
String loc = "";
|
||||||
|
if (c.isToken()== false)
|
||||||
|
loc = IMAGE_BASE;
|
||||||
|
else
|
||||||
|
loc = IMAGE_TOKEN;
|
||||||
|
String filename = GuiDisplayUtil.cleanString(c.getImageName()) + ".jpg";
|
||||||
|
File file = new File(ForgeProps.getFile(loc), filename);
|
||||||
BufferedImage a = ImageIO.read(file);
|
BufferedImage a = ImageIO.read(file);
|
||||||
return a.getHeight();
|
return a.getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getPictureHQwidth(String c) throws IOException{
|
public static int getPictureHQwidth(Card c) throws IOException{
|
||||||
File file = new File(ForgeProps.getFile(IMAGE_BASE), c);
|
String loc = "";
|
||||||
|
if (c.isToken()== false)
|
||||||
|
loc = IMAGE_BASE;
|
||||||
|
else
|
||||||
|
loc = IMAGE_TOKEN;
|
||||||
|
String filename = GuiDisplayUtil.cleanString(c.getImageName()) + ".jpg";
|
||||||
|
File file = new File(ForgeProps.getFile(loc), filename);
|
||||||
BufferedImage a = ImageIO.read(file);
|
BufferedImage a = ImageIO.read(file);
|
||||||
return a.getWidth();
|
return a.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean IsPictureHQExists(String c) {
|
public static boolean IsPictureHQExists(Card c) {
|
||||||
File file = new File(ForgeProps.getFile(IMAGE_BASE), c);
|
String loc = "";
|
||||||
|
if (c.isToken()== false)
|
||||||
|
loc = IMAGE_BASE;
|
||||||
|
else
|
||||||
|
loc = IMAGE_TOKEN;
|
||||||
|
String filename = GuiDisplayUtil.cleanString(c.getImageName()) + ".jpg";
|
||||||
|
File file = new File(ForgeProps.getFile(loc), filename);
|
||||||
if(file.exists()){
|
if(file.exists()){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay {
|
|||||||
|
|
||||||
private CardList top;
|
private CardList top;
|
||||||
private CardList bottom;
|
private CardList bottom;
|
||||||
public String cardN;
|
public Card cCardHQ;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
@@ -399,7 +399,7 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay {
|
|||||||
//change card name if needed
|
//change card name if needed
|
||||||
c = AllZone.CardFactory.copyCard(c);
|
c = AllZone.CardFactory.copyCard(c);
|
||||||
if(AllZone.NameChanger.shouldChangeCardName()) c = AllZone.NameChanger.changeCard(c);
|
if(AllZone.NameChanger.shouldChangeCardName()) c = AllZone.NameChanger.changeCard(c);
|
||||||
cardN = c.getName();
|
cCardHQ = c;
|
||||||
CardDetailUtil.updateCardDetail(c, cdTextArea, cardDetailPanel, picturePanel, new JLabel[] {
|
CardDetailUtil.updateCardDetail(c, cdTextArea, cardDetailPanel, picturePanel, new JLabel[] {
|
||||||
cdLabel1, cdLabel2, cdLabel3, cdLabel4, cdLabel5});
|
cdLabel1, cdLabel2, cdLabel3, cdLabel4, cdLabel5});
|
||||||
}
|
}
|
||||||
@@ -726,29 +726,28 @@ public class Gui_DeckEditor extends JFrame implements CardDetail, DeckDisplay {
|
|||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
|
|
||||||
if (picturePanel.getComponentCount()!=0){
|
if (picturePanel.getComponentCount()!=0){
|
||||||
cardN= GuiDisplayUtil.cleanString(cardN);
|
|
||||||
cardN = cardN+".jpg";
|
if(GuiDisplayUtil.IsPictureHQExists(cCardHQ)){
|
||||||
if(GuiDisplayUtil.IsPictureHQExists(cardN)){
|
|
||||||
int cWidth = 0;
|
int cWidth = 0;
|
||||||
try {
|
try {
|
||||||
cWidth = GuiDisplayUtil.getPictureHQwidth(cardN);
|
cWidth = GuiDisplayUtil.getPictureHQwidth(cCardHQ);
|
||||||
} catch (IOException e2) {
|
} catch (IOException e2) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
}
|
}
|
||||||
int cHeight = 0;
|
int cHeight = 0;
|
||||||
try {
|
try {
|
||||||
cHeight = GuiDisplayUtil.getPictureHQheight(cardN);
|
cHeight = GuiDisplayUtil.getPictureHQheight(cCardHQ);
|
||||||
} catch (IOException e2) {
|
} catch (IOException e2) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cWidth>=312 &&cHeight >=445){
|
if(cWidth>=312 &&cHeight >=445){
|
||||||
GUI_PictureHQ hq = new GUI_PictureHQ(Gui_DeckEditor.this,cardN);
|
GUI_PictureHQ hq = new GUI_PictureHQ(Gui_DeckEditor.this,cCardHQ);
|
||||||
try {
|
try {
|
||||||
hq.letsGo(Gui_DeckEditor.this, cardN);
|
hq.letsGo(Gui_DeckEditor.this, cCardHQ);
|
||||||
cardN = cardN.substring(0, cardN.length()-4);
|
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
|
|||||||
public boolean filterUsed;
|
public boolean filterUsed;
|
||||||
private CardList top;
|
private CardList top;
|
||||||
private CardList bottom;
|
private CardList bottom;
|
||||||
public String cardN;
|
public Card cCardHQ;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -432,7 +432,7 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
|
|||||||
//change card name if needed
|
//change card name if needed
|
||||||
c = AllZone.CardFactory.copyCard(c);
|
c = AllZone.CardFactory.copyCard(c);
|
||||||
if(AllZone.NameChanger.shouldChangeCardName()) c = AllZone.NameChanger.changeCard(c);
|
if(AllZone.NameChanger.shouldChangeCardName()) c = AllZone.NameChanger.changeCard(c);
|
||||||
cardN = c.getName();
|
cCardHQ = c;
|
||||||
CardDetailUtil.updateCardDetail(c, cdTextArea, cardDetailPanel, picturePanel, new JLabel[] {
|
CardDetailUtil.updateCardDetail(c, cdTextArea, cardDetailPanel, picturePanel, new JLabel[] {
|
||||||
cdLabel1, cdLabel2, cdLabel3, cdLabel4, cdLabel5});
|
cdLabel1, cdLabel2, cdLabel3, cdLabel4, cdLabel5});
|
||||||
}
|
}
|
||||||
@@ -788,20 +788,19 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
|
|||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
|
|
||||||
if (picturePanel.getComponentCount()!=0){
|
if (picturePanel.getComponentCount()!=0){
|
||||||
cardN= GuiDisplayUtil.cleanString(cardN);
|
|
||||||
cardN = cardN+".jpg";
|
|
||||||
|
|
||||||
if(GuiDisplayUtil.IsPictureHQExists(cardN)){
|
if(GuiDisplayUtil.IsPictureHQExists(cCardHQ)){
|
||||||
int cWidth = 0;
|
int cWidth = 0;
|
||||||
try {
|
try {
|
||||||
cWidth = GuiDisplayUtil.getPictureHQwidth(cardN);
|
cWidth = GuiDisplayUtil.getPictureHQwidth(cCardHQ);
|
||||||
} catch (IOException e2) {
|
} catch (IOException e2) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
}
|
}
|
||||||
int cHeight = 0;
|
int cHeight = 0;
|
||||||
try {
|
try {
|
||||||
cHeight = GuiDisplayUtil.getPictureHQheight(cardN);
|
cHeight = GuiDisplayUtil.getPictureHQheight(cCardHQ);
|
||||||
} catch (IOException e2) {
|
} catch (IOException e2) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e2.printStackTrace();
|
e2.printStackTrace();
|
||||||
@@ -809,10 +808,9 @@ public class Gui_Quest_DeckEditor extends JFrame implements CardDetail, DeckDisp
|
|||||||
|
|
||||||
if(cWidth>=312 &&cHeight >=445){
|
if(cWidth>=312 &&cHeight >=445){
|
||||||
|
|
||||||
GUI_PictureHQ hq = new GUI_PictureHQ(Gui_Quest_DeckEditor.this,cardN);
|
GUI_PictureHQ hq = new GUI_PictureHQ(Gui_Quest_DeckEditor.this,cCardHQ);
|
||||||
try {
|
try {
|
||||||
hq.letsGo(Gui_Quest_DeckEditor.this, cardN);
|
hq.letsGo(Gui_Quest_DeckEditor.this, cCardHQ);
|
||||||
cardN = cardN.substring(0, cardN.length()-4);
|
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user