mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Removed redundant code
This commit is contained in:
@@ -505,14 +505,25 @@ public class MatchScreen extends FScreen {
|
|||||||
float x = topPlayerPanel.getField().getLeft();
|
float x = topPlayerPanel.getField().getLeft();
|
||||||
float y = midField - topPlayerPanel.getField().getHeight();
|
float y = midField - topPlayerPanel.getField().getHeight();
|
||||||
float w = getWidth() - x;
|
float w = getWidth() - x;
|
||||||
|
float bgFullWidth, scaledbgHeight;
|
||||||
|
float bgHeight = midField + bottomPlayerPanel.getField().getHeight() - y;
|
||||||
if(FModel.getPreferences().getPrefBoolean(FPref.UI_DYNAMIC_PLANECHASE_BG)
|
if(FModel.getPreferences().getPrefBoolean(FPref.UI_DYNAMIC_PLANECHASE_BG)
|
||||||
&& hasActivePlane())
|
&& hasActivePlane()) {
|
||||||
setPlanarBG(g, getPlaneName(), x, y, w, midField);
|
String imageName = getPlaneName()
|
||||||
|
.replace(" ", "_")
|
||||||
|
.replace("'", "")
|
||||||
|
.replace("-", "");
|
||||||
|
if (FSkinTexture.getValues().contains(imageName)) {
|
||||||
|
bgFullWidth = bgHeight * FSkinTexture.valueOf(imageName).getWidth() / FSkinTexture.valueOf(imageName).getHeight();
|
||||||
|
if (bgFullWidth < w) {
|
||||||
|
scaledbgHeight = w * (bgHeight / bgFullWidth);
|
||||||
|
bgFullWidth = w;
|
||||||
|
bgHeight = scaledbgHeight;
|
||||||
|
}
|
||||||
|
g.drawImage(FSkinTexture.valueOf(imageName), x + (w - bgFullWidth) / 2, y, bgFullWidth, bgHeight, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
float bgFullWidth;
|
|
||||||
float scaledbgHeight;
|
|
||||||
float bgHeight = midField + bottomPlayerPanel.getField().getHeight() - y;
|
|
||||||
bgFullWidth = bgHeight * FSkinTexture.BG_MATCH.getWidth() / FSkinTexture.BG_MATCH.getHeight();
|
bgFullWidth = bgHeight * FSkinTexture.BG_MATCH.getWidth() / FSkinTexture.BG_MATCH.getHeight();
|
||||||
if (bgFullWidth < w) {
|
if (bgFullWidth < w) {
|
||||||
scaledbgHeight = w * (bgHeight / bgFullWidth);
|
scaledbgHeight = w * (bgHeight / bgFullWidth);
|
||||||
@@ -657,34 +668,5 @@ public class MatchScreen extends FScreen {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
private void setPlanarBG(Graphics g, String planeName, float x, float y, float w, float midField ){
|
|
||||||
float planeFullWidth;
|
|
||||||
float scaledPlaneHeight;
|
|
||||||
float planeHeight = midField + bottomPlayerPanel.getField().getHeight() - y;
|
|
||||||
String imageName = planeName
|
|
||||||
.replace(" ", "_")
|
|
||||||
.replace("'", "")
|
|
||||||
.replace("-", "");
|
|
||||||
if (FSkinTexture.getValues().contains(imageName))
|
|
||||||
{
|
|
||||||
planeFullWidth = planeHeight * FSkinTexture.valueOf(imageName).getWidth() / FSkinTexture.valueOf(imageName).getHeight();
|
|
||||||
if (planeFullWidth < w) {
|
|
||||||
scaledPlaneHeight = w * (planeHeight / planeFullWidth);
|
|
||||||
planeFullWidth = w;
|
|
||||||
planeHeight = scaledPlaneHeight;
|
|
||||||
}
|
|
||||||
g.drawImage(FSkinTexture.valueOf(imageName), x + (w - planeFullWidth) / 2, y, planeFullWidth, planeHeight, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
planeFullWidth = planeHeight * FSkinTexture.BG_MATCH.getWidth() / FSkinTexture.BG_MATCH.getHeight();
|
|
||||||
if (planeFullWidth < w) {
|
|
||||||
scaledPlaneHeight = w * (planeHeight / planeFullWidth);
|
|
||||||
planeFullWidth = w;
|
|
||||||
planeHeight = scaledPlaneHeight;
|
|
||||||
}
|
|
||||||
g.drawImage(FSkinTexture.BG_MATCH, x + (w - planeFullWidth) / 2, y, planeFullWidth, planeHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user