mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
Merge pull request #1997 from kevlahnota/newmaster2
update ImageCache, CardImageRenderer, CardRenderer, CardZoom and Rewa…
This commit is contained in:
@@ -21,6 +21,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ScissorStack;
|
|||||||
import forge.assets.FImage;
|
import forge.assets.FImage;
|
||||||
import forge.assets.FSkinColor;
|
import forge.assets.FSkinColor;
|
||||||
import forge.assets.FSkinFont;
|
import forge.assets.FSkinFont;
|
||||||
|
import forge.assets.ImageCache;
|
||||||
import forge.toolbox.FDisplayObject;
|
import forge.toolbox.FDisplayObject;
|
||||||
import forge.util.TextBounds;
|
import forge.util.TextBounds;
|
||||||
import forge.util.Utils;
|
import forge.util.Utils;
|
||||||
@@ -49,6 +50,7 @@ public class Graphics {
|
|||||||
private final ShaderProgram shaderPixelateWarp = new ShaderProgram(Shaders.vertPixelateShader, Shaders.fragPixelateShaderWarp);
|
private final ShaderProgram shaderPixelateWarp = new ShaderProgram(Shaders.vertPixelateShader, Shaders.fragPixelateShaderWarp);
|
||||||
private final ShaderProgram shaderChromaticAbberation = new ShaderProgram(Shaders.vertPixelateShader, Shaders.fragChromaticAbberation);
|
private final ShaderProgram shaderChromaticAbberation = new ShaderProgram(Shaders.vertPixelateShader, Shaders.fragChromaticAbberation);
|
||||||
private final ShaderProgram shaderHueShift = new ShaderProgram(Shaders.vertPixelateShader, Shaders.fragHueShift);
|
private final ShaderProgram shaderHueShift = new ShaderProgram(Shaders.vertPixelateShader, Shaders.fragHueShift);
|
||||||
|
private final ShaderProgram shaderRoundedRect = new ShaderProgram(Shaders.vertPixelateShader, Shaders.fragRoundedRect);
|
||||||
|
|
||||||
private Texture dummyTexture = null;
|
private Texture dummyTexture = null;
|
||||||
|
|
||||||
@@ -64,6 +66,10 @@ public class Graphics {
|
|||||||
return shaderGrayscale;
|
return shaderGrayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ShaderProgram getShaderRoundedRect() {
|
||||||
|
return shaderRoundedRect;
|
||||||
|
}
|
||||||
|
|
||||||
public ShaderProgram getShaderWarp() {
|
public ShaderProgram getShaderWarp() {
|
||||||
return shaderWarp;
|
return shaderWarp;
|
||||||
}
|
}
|
||||||
@@ -879,6 +885,44 @@ public class Graphics {
|
|||||||
batch.begin();
|
batch.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void drawCardRoundRect(Texture image, TextureRegion damage_overlay, float x, float y, float w, float h, boolean drawGray, boolean damaged) {
|
||||||
|
if (image == null)
|
||||||
|
return;
|
||||||
|
batch.end();
|
||||||
|
shaderRoundedRect.bind();
|
||||||
|
shaderRoundedRect.setUniformf("u_resolution", image.getWidth(), image.getHeight());
|
||||||
|
shaderRoundedRect.setUniformf("edge_radius", (image.getHeight() / image.getWidth()) * ImageCache.getRadius(image));
|
||||||
|
shaderRoundedRect.setUniformf("u_gray", drawGray ? 0.8f : 0f);
|
||||||
|
batch.setShader(shaderRoundedRect);
|
||||||
|
batch.begin();
|
||||||
|
//draw
|
||||||
|
batch.draw(image, adjustX(x), adjustY(y, h), w, h);
|
||||||
|
//reset
|
||||||
|
batch.end();
|
||||||
|
batch.setShader(null);
|
||||||
|
batch.begin();
|
||||||
|
if (damage_overlay != null && damaged)
|
||||||
|
batch.draw(damage_overlay, adjustX(x), adjustY(y, h), w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawCardRoundRect(Texture image, float x, float y, float w, float h, float originX, float originY, float rotation) {
|
||||||
|
if (image == null)
|
||||||
|
return;
|
||||||
|
batch.end();
|
||||||
|
shaderRoundedRect.bind();
|
||||||
|
shaderRoundedRect.setUniformf("u_resolution", image.getWidth(), image.getHeight());
|
||||||
|
shaderRoundedRect.setUniformf("edge_radius", (image.getHeight() / image.getWidth()) * ImageCache.getRadius(image));
|
||||||
|
shaderRoundedRect.setUniformf("u_gray", 0f);
|
||||||
|
batch.setShader(shaderRoundedRect);
|
||||||
|
batch.begin();
|
||||||
|
//draw
|
||||||
|
drawRotatedImage(image, x, y, w, h, originX, originY, 0, 0, image.getWidth(), image.getHeight(), rotation);
|
||||||
|
//reset
|
||||||
|
batch.end();
|
||||||
|
batch.setShader(null);
|
||||||
|
batch.begin();
|
||||||
|
}
|
||||||
|
|
||||||
public void drawHueShift(Texture image, float x, float y, float w, float h, Float time) {
|
public void drawHueShift(Texture image, float x, float y, float w, float h, Float time) {
|
||||||
if (image == null)
|
if (image == null)
|
||||||
return;
|
return;
|
||||||
@@ -1287,6 +1331,7 @@ public class Graphics {
|
|||||||
bitmapFont.setColor(color.r, color.g, color.b, alpha);
|
bitmapFont.setColor(color.r, color.g, color.b, alpha);
|
||||||
bitmapFont.draw(batch, text, x, y);
|
bitmapFont.draw(batch, text, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawText(BitmapFont bitmapFont, GlyphLayout layout, float x, float y) {
|
public void drawText(BitmapFont bitmapFont, GlyphLayout layout, float x, float y) {
|
||||||
if (bitmapFont == null || layout == null)
|
if (bitmapFont == null || layout == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -42,6 +42,42 @@ public class Shaders {
|
|||||||
" v_texCoords = a_texCoord0;\n" +
|
" v_texCoords = a_texCoord0;\n" +
|
||||||
" gl_Position = u_projTrans * a_position;\n" +
|
" gl_Position = u_projTrans * a_position;\n" +
|
||||||
"}";
|
"}";
|
||||||
|
public static final String fragRoundedRect = "#ifdef GL_ES\n" +
|
||||||
|
"#define LOWP lowp\n" +
|
||||||
|
"precision mediump float;\n" +
|
||||||
|
"#else\n" +
|
||||||
|
"#define LOWP \n" +
|
||||||
|
"#endif\n" +
|
||||||
|
"varying vec2 v_texCoords;\n" +
|
||||||
|
"uniform sampler2D u_texture;\n" +
|
||||||
|
"uniform vec2 u_resolution;\n" +
|
||||||
|
"uniform float edge_radius;\n" +
|
||||||
|
"uniform float u_gray;\n" +
|
||||||
|
"vec4 color = vec4(1.0,1.0,1.0,1.0);\n" +
|
||||||
|
"float gradientIntensity = 0.5;\n" +
|
||||||
|
"\n" +
|
||||||
|
"void main() {\n" +
|
||||||
|
" vec2 uv = v_texCoords;\n" +
|
||||||
|
" vec2 uv_base_center = uv * 2.0 - 1.0;\n" +
|
||||||
|
"\n" +
|
||||||
|
" vec2 half_resolution = u_resolution.xy * 0.5;\n" +
|
||||||
|
" vec2 abs_rounded_center = half_resolution.xy - edge_radius;\n" +
|
||||||
|
" vec2 abs_pixel_coord = vec2( abs(uv_base_center.x * half_resolution.x), abs(uv_base_center.y * half_resolution.y) );\n" +
|
||||||
|
"\n" +
|
||||||
|
" float alpha = 1.0;\n" +
|
||||||
|
" vec4 col = color * texture2D(u_texture, uv);\n" +
|
||||||
|
" if (abs_pixel_coord.x > abs_rounded_center.x && abs_pixel_coord.y > abs_rounded_center.y) {\n" +
|
||||||
|
" float r = length(abs_pixel_coord - abs_rounded_center);\n" +
|
||||||
|
" alpha = smoothstep(edge_radius, edge_radius - gradientIntensity, r);\n" +
|
||||||
|
" \n" +
|
||||||
|
" }\n" +
|
||||||
|
"\tif (u_gray > 0.0) {\n" +
|
||||||
|
"\t float grey = dot( col.rgb, vec3(0.22, 0.707, 0.071) );\n" +
|
||||||
|
"\t\tvec3 blendedColor = mix(col.rgb, vec3(grey), 1.0);\n" +
|
||||||
|
"\t\tcol = vec4(blendedColor.rgb, col.a);\n" +
|
||||||
|
"\t}\n" +
|
||||||
|
" gl_FragColor = col*alpha;\n" +
|
||||||
|
"}";
|
||||||
public static final String fragHueShift = "#ifdef GL_ES\n" +
|
public static final String fragHueShift = "#ifdef GL_ES\n" +
|
||||||
"#define LOWP lowp\n" +
|
"#define LOWP lowp\n" +
|
||||||
"precision mediump float;\n" +
|
"precision mediump float;\n" +
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package forge.adventure.scene;
|
package forge.adventure.scene;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.controllers.Controller;
|
||||||
|
import com.badlogic.gdx.controllers.Controllers;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
||||||
@@ -54,11 +56,26 @@ public class RewardScene extends UIScene {
|
|||||||
ui.onButtonPress("done", () -> RewardScene.this.done());
|
ui.onButtonPress("done", () -> RewardScene.this.done());
|
||||||
ui.onButtonPress("detail",()->RewardScene.this.toggleToolTip());
|
ui.onButtonPress("detail",()->RewardScene.this.toggleToolTip());
|
||||||
detailButton = ui.findActor("detail");
|
detailButton = ui.findActor("detail");
|
||||||
if (Forge.getDeviceAdapter().getGamepads().isEmpty())
|
|
||||||
detailButton.setVisible(false);
|
detailButton.setVisible(false);
|
||||||
doneButton = ui.findActor("done");
|
doneButton = ui.findActor("done");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void connected(Controller controller) {
|
||||||
|
super.connected(controller);
|
||||||
|
updateDetailButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disconnected(Controller controller) {
|
||||||
|
super.disconnected(controller);
|
||||||
|
updateDetailButton();
|
||||||
|
}
|
||||||
|
private void updateDetailButton() {
|
||||||
|
detailButton.setVisible(Controllers.getCurrent() != null);
|
||||||
|
detailButton.layout();
|
||||||
|
}
|
||||||
|
|
||||||
private void toggleToolTip() {
|
private void toggleToolTip() {
|
||||||
|
|
||||||
Selectable selectable=getSelected();
|
Selectable selectable=getSelected();
|
||||||
@@ -159,6 +176,13 @@ public class RewardScene extends UIScene {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enter() {
|
||||||
|
updateDetailButton();
|
||||||
|
super.enter();
|
||||||
|
}
|
||||||
|
|
||||||
private void showLootOrDone() {
|
private void showLootOrDone() {
|
||||||
boolean exit = true;
|
boolean exit = true;
|
||||||
for (Actor actor : new Array.ArrayIterator<>(generated)) {
|
for (Actor actor : new Array.ArrayIterator<>(generated)) {
|
||||||
|
|||||||
@@ -17,13 +17,11 @@ public abstract class Scene implements Disposable {
|
|||||||
@Override
|
@Override
|
||||||
public void connected(Controller controller) {
|
public void connected(Controller controller) {
|
||||||
Forge.getCurrentScene().connected(controller);
|
Forge.getCurrentScene().connected(controller);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disconnected(Controller controller) {
|
public void disconnected(Controller controller) {
|
||||||
Forge.getCurrentScene().disconnected(controller);
|
Forge.getCurrentScene().disconnected(controller);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -41,10 +39,11 @@ public abstract class Scene implements Disposable {
|
|||||||
return Forge.getCurrentScene().axisMoved(controller, i, v);
|
return Forge.getCurrentScene().axisMoved(controller, i, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static private SceneControllerListener listener = null;
|
static private SceneControllerListener listener = null;
|
||||||
|
|
||||||
public Scene() {
|
public Scene() {
|
||||||
if(listener==null)
|
if (listener == null) {
|
||||||
{
|
|
||||||
listener = new SceneControllerListener();
|
listener = new SceneControllerListener();
|
||||||
Controllers.addListener(listener);
|
Controllers.addListener(listener);
|
||||||
}
|
}
|
||||||
@@ -59,9 +58,10 @@ public abstract class Scene implements Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract void act(float delta);
|
public abstract void act(float delta);
|
||||||
public abstract void render();
|
|
||||||
public boolean leave() {
|
|
||||||
|
|
||||||
|
public abstract void render();
|
||||||
|
|
||||||
|
public boolean leave() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,5 +91,4 @@ public abstract class Scene implements Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
|||||||
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
|
||||||
import com.badlogic.gdx.utils.Align;
|
import com.badlogic.gdx.utils.Align;
|
||||||
import com.badlogic.gdx.utils.Disposable;
|
import com.badlogic.gdx.utils.Disposable;
|
||||||
|
import com.badlogic.gdx.utils.Scaling;
|
||||||
import com.github.tommyettinger.textra.TextraButton;
|
import com.github.tommyettinger.textra.TextraButton;
|
||||||
import forge.Forge;
|
import forge.Forge;
|
||||||
import forge.Graphics;
|
import forge.Graphics;
|
||||||
@@ -54,6 +55,7 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
HoldTooltip holdTooltip;
|
HoldTooltip holdTooltip;
|
||||||
Reward reward;
|
Reward reward;
|
||||||
ShaderProgram shaderGrayscale = Forge.getGraphics().getShaderGrayscale();
|
ShaderProgram shaderGrayscale = Forge.getGraphics().getShaderGrayscale();
|
||||||
|
ShaderProgram shaderRoundRect = Forge.getGraphics().getShaderRoundedRect();
|
||||||
|
|
||||||
final int preview_w = 488; //Width and height for generated images.
|
final int preview_w = 488; //Width and height for generated images.
|
||||||
final int preview_h = 680;
|
final int preview_h = 680;
|
||||||
@@ -73,7 +75,7 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
|
|
||||||
public static int renderedCount = 0; //Counter for cards that require rendering a preview.
|
public static int renderedCount = 0; //Counter for cards that require rendering a preview.
|
||||||
static final ImageFetcher fetcher = GuiBase.getInterface().getImageFetcher();
|
static final ImageFetcher fetcher = GuiBase.getInterface().getImageFetcher();
|
||||||
Image toolTipImage;
|
RewardImage toolTipImage;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
@@ -124,7 +126,7 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
((TextureRegionDrawable) toolTipImage.getDrawable()).getRegion().getTexture().dispose();
|
((TextureRegionDrawable) toolTipImage.getDrawable()).getRegion().getTexture().dispose();
|
||||||
}
|
}
|
||||||
toolTipImage.remove();
|
toolTipImage.remove();
|
||||||
toolTipImage = new Image(processDrawable(image));
|
toolTipImage = new RewardImage(processDrawable(image));
|
||||||
if (GuiBase.isAndroid() || Forge.hasGamepad()) {
|
if (GuiBase.isAndroid() || Forge.hasGamepad()) {
|
||||||
if (holdTooltip.tooltip_image.getDrawable() instanceof TextureRegionDrawable) {
|
if (holdTooltip.tooltip_image.getDrawable() instanceof TextureRegionDrawable) {
|
||||||
((TextureRegionDrawable) holdTooltip.tooltip_image.getDrawable()).getRegion().getTexture().dispose();
|
((TextureRegionDrawable) holdTooltip.tooltip_image.getDrawable()).getRegion().getTexture().dispose();
|
||||||
@@ -328,12 +330,12 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
if (alternate) {
|
if (alternate) {
|
||||||
if (alt != null) {
|
if (alt != null) {
|
||||||
holdTooltip.tooltip_actor.clear();
|
holdTooltip.tooltip_actor.clear();
|
||||||
holdTooltip.tooltip_actor.add(new Image(processDrawable(alt)));
|
holdTooltip.tooltip_actor.add(new RewardImage(processDrawable(alt)));
|
||||||
} else {
|
} else {
|
||||||
if (T == null)
|
if (T == null)
|
||||||
T = renderPlaceholder(getGraphics(), altCard);
|
T = renderPlaceholder(getGraphics(), altCard);
|
||||||
holdTooltip.tooltip_actor.clear();
|
holdTooltip.tooltip_actor.clear();
|
||||||
holdTooltip.tooltip_actor.add(new Image(processDrawable(T)));
|
holdTooltip.tooltip_actor.add(new RewardImage(processDrawable(T)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (toolTipImage != null) {
|
if (toolTipImage != null) {
|
||||||
@@ -345,11 +347,11 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
if (hover) {
|
if (hover) {
|
||||||
if (alternate) {
|
if (alternate) {
|
||||||
if (alt != null) {
|
if (alt != null) {
|
||||||
tooltip.setActor(new Image(processDrawable(alt)));
|
tooltip.setActor(new RewardImage(processDrawable(alt)));
|
||||||
} else {
|
} else {
|
||||||
if (T == null)
|
if (T == null)
|
||||||
T = renderPlaceholder(getGraphics(), altCard);
|
T = renderPlaceholder(getGraphics(), altCard);
|
||||||
tooltip.setActor(new Image(processDrawable(T)));
|
tooltip.setActor(new RewardImage(processDrawable(T)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (toolTipImage != null)
|
if (toolTipImage != null)
|
||||||
@@ -414,7 +416,7 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
if (Forge.isTextureFilteringEnabled())
|
if (Forge.isTextureFilteringEnabled())
|
||||||
image.setFilter(Texture.TextureFilter.MipMapLinearLinear, Texture.TextureFilter.Linear);
|
image.setFilter(Texture.TextureFilter.MipMapLinearLinear, Texture.TextureFilter.Linear);
|
||||||
if (toolTipImage == null)
|
if (toolTipImage == null)
|
||||||
toolTipImage = new Image(processDrawable(image));
|
toolTipImage = new RewardImage(processDrawable(image));
|
||||||
if (GuiBase.isAndroid() || Forge.hasGamepad()) {
|
if (GuiBase.isAndroid() || Forge.hasGamepad()) {
|
||||||
if (holdTooltip == null)
|
if (holdTooltip == null)
|
||||||
holdTooltip = new HoldTooltip(toolTipImage);
|
holdTooltip = new HoldTooltip(toolTipImage);
|
||||||
@@ -502,7 +504,7 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
//Rendering code ends here.
|
//Rendering code ends here.
|
||||||
|
|
||||||
if (toolTipImage == null)
|
if (toolTipImage == null)
|
||||||
toolTipImage = new Image(processDrawable(generatedTooltip));
|
toolTipImage = new RewardImage(processDrawable(generatedTooltip));
|
||||||
|
|
||||||
if (GuiBase.isAndroid() || Forge.hasGamepad()) {
|
if (GuiBase.isAndroid() || Forge.hasGamepad()) {
|
||||||
if (holdTooltip == null)
|
if (holdTooltip == null)
|
||||||
@@ -631,6 +633,21 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
|
|
||||||
private void drawCard(Batch batch, Texture image, float x, float width) {
|
private void drawCard(Batch batch, Texture image, float x, float width) {
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
|
if (image.toString().contains(".fullborder.") && Forge.enableUIMask.equals("Full")) {
|
||||||
|
batch.end();
|
||||||
|
shaderRoundRect.bind();
|
||||||
|
shaderRoundRect.setUniformf("u_resolution", image.getWidth(), image.getHeight());
|
||||||
|
shaderRoundRect.setUniformf("edge_radius", (image.getHeight()/image.getWidth())*20);
|
||||||
|
shaderRoundRect.setUniformf("u_gray", sold ? 1f : 0f);
|
||||||
|
batch.setShader(shaderRoundRect);
|
||||||
|
batch.begin();
|
||||||
|
//draw rounded
|
||||||
|
batch.draw(image, x, -getHeight() / 2, width, getHeight());
|
||||||
|
//reset
|
||||||
|
batch.end();
|
||||||
|
batch.setShader(null);
|
||||||
|
batch.begin();
|
||||||
|
} else {
|
||||||
if (!sold)
|
if (!sold)
|
||||||
batch.draw(ImageCache.croppedBorderImage(image), x, -getHeight() / 2, width, getHeight());
|
batch.draw(ImageCache.croppedBorderImage(image), x, -getHeight() / 2, width, getHeight());
|
||||||
else {
|
else {
|
||||||
@@ -649,6 +666,7 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Graphics getGraphics() {
|
private Graphics getGraphics() {
|
||||||
if (graphics == null)
|
if (graphics == null)
|
||||||
@@ -725,18 +743,20 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
}
|
}
|
||||||
|
|
||||||
class HoldTooltip extends ActorGestureListener {
|
class HoldTooltip extends ActorGestureListener {
|
||||||
Image tooltip_image;
|
RewardImage tooltip_image;
|
||||||
Table tooltip_actor;
|
Table tooltip_actor;
|
||||||
float height;
|
float height;
|
||||||
TextraButton switchButton;
|
TextraButton switchButton;
|
||||||
//Vector2 tmp = new Vector2();
|
//Vector2 tmp = new Vector2();
|
||||||
|
|
||||||
public HoldTooltip(Image tooltip_image) {
|
public HoldTooltip(RewardImage tooltip_image) {
|
||||||
this.tooltip_image = tooltip_image;
|
this.tooltip_image = tooltip_image;
|
||||||
tooltip_actor = new Table();
|
tooltip_actor = new Table();
|
||||||
tooltip_actor.add(this.tooltip_image);
|
tooltip_actor.add(this.tooltip_image);
|
||||||
tooltip_actor.align(Align.center);
|
tooltip_actor.align(Align.center);
|
||||||
tooltip_actor.setSize(this.tooltip_image.getPrefWidth(), this.tooltip_image.getPrefHeight());
|
tooltip_actor.setSize(this.tooltip_image.getPrefWidth(), this.tooltip_image.getPrefHeight());
|
||||||
|
tooltip_actor.setX(Scene.getIntendedWidth() / 2 - tooltip_actor.getWidth() / 2);
|
||||||
|
tooltip_actor.setY(Scene.getIntendedHeight() / 2 - tooltip_actor.getHeight() / 2);
|
||||||
this.height = tooltip_actor.getHeight();
|
this.height = tooltip_actor.getHeight();
|
||||||
switchButton = Controls.newTextButton("Flip");
|
switchButton = Controls.newTextButton("Flip");
|
||||||
switchButton.addListener(new ClickListener() {
|
switchButton.addListener(new ClickListener() {
|
||||||
@@ -760,17 +780,6 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
if (reward.getCard().hasBackFace())
|
if (reward.getCard().hasBackFace())
|
||||||
actor.getStage().addActor(switchButton);
|
actor.getStage().addActor(switchButton);
|
||||||
}
|
}
|
||||||
//Vector2 point = actor.localToStageCoordinates(tmp.set(x, y));
|
|
||||||
if (Forge.isLandscapeMode()) {
|
|
||||||
//right if poosible, if exceeds width, draw left
|
|
||||||
tooltip_actor.setX(actor.getRight());
|
|
||||||
if (tooltip_actor.getX() + tooltip_actor.getWidth() > Scene.getIntendedWidth())
|
|
||||||
tooltip_actor.setX(Math.max(0, actor.getX() - tooltip_actor.getWidth()));
|
|
||||||
} else {
|
|
||||||
//middle
|
|
||||||
tooltip_actor.setX(Scene.getIntendedWidth() / 2 - tooltip_actor.getWidth() / 2);
|
|
||||||
}
|
|
||||||
tooltip_actor.setY(Scene.getIntendedHeight() / 2 - tooltip_actor.getHeight() / 2);
|
|
||||||
|
|
||||||
actor.getStage().addActor(tooltip_actor);
|
actor.getStage().addActor(tooltip_actor);
|
||||||
return super.longPress(actor, x, y);
|
return super.longPress(actor, x, y);
|
||||||
@@ -807,4 +816,58 @@ public class RewardActor extends Actor implements Disposable, ImageFetcher.Callb
|
|||||||
shown = false;
|
shown = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class RewardImage extends Image {
|
||||||
|
public RewardImage(TextureRegionDrawable processDrawable) {
|
||||||
|
setDrawable(processDrawable);
|
||||||
|
setScaling(Scaling.stretch);
|
||||||
|
setAlign(Align.center);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void draw(Batch batch, float parentAlpha) {
|
||||||
|
try {
|
||||||
|
if (getDrawable() instanceof TextureRegionDrawable) {
|
||||||
|
Texture t = ((TextureRegionDrawable) getDrawable()).getRegion().getTexture();
|
||||||
|
if (t != null) {
|
||||||
|
float x = GuiBase.isAndroid() || Forge.hasGamepad() ? Scene.getIntendedWidth() / 2 - holdTooltip.tooltip_actor.getWidth() / 2: tooltip.getActor().getImageX();
|
||||||
|
float y = GuiBase.isAndroid() || Forge.hasGamepad() ? Scene.getIntendedHeight() / 2 - holdTooltip.tooltip_actor.getHeight() / 2 : tooltip.getActor().getImageY();
|
||||||
|
float w = GuiBase.isAndroid() || Forge.hasGamepad() ? holdTooltip.tooltip_actor.getPrefWidth() : tooltip.getActor().getPrefWidth();
|
||||||
|
float h = GuiBase.isAndroid() || Forge.hasGamepad() ? holdTooltip.tooltip_actor.getPrefHeight() : tooltip.getActor().getPrefHeight();
|
||||||
|
if (t.toString().contains(".fullborder.") && Forge.enableUIMask.equals("Full")) {
|
||||||
|
batch.end();
|
||||||
|
shaderRoundRect.bind();
|
||||||
|
shaderRoundRect.setUniformf("u_resolution", t.getWidth(), t.getHeight());
|
||||||
|
shaderRoundRect.setUniformf("edge_radius", (t.getHeight()/t.getWidth())*ImageCache.getRadius(t));
|
||||||
|
shaderRoundRect.setUniformf("u_gray", sold ? 0.8f : 0f);
|
||||||
|
batch.setShader(shaderRoundRect);
|
||||||
|
batch.begin();
|
||||||
|
//draw rounded
|
||||||
|
batch.draw(t, x, y, w, h);
|
||||||
|
//reset
|
||||||
|
batch.end();
|
||||||
|
batch.setShader(null);
|
||||||
|
batch.begin();
|
||||||
|
} else {
|
||||||
|
batch.end();
|
||||||
|
shaderGrayscale.bind();
|
||||||
|
shaderGrayscale.setUniformf("u_grayness", sold ? 1f : 0f);
|
||||||
|
shaderGrayscale.setUniformf("u_bias", sold ? 0.8f : 1f);
|
||||||
|
batch.setShader(shaderGrayscale);
|
||||||
|
batch.begin();
|
||||||
|
//draw gray
|
||||||
|
batch.draw(t, x, y, w, h);
|
||||||
|
//reset
|
||||||
|
batch.end();
|
||||||
|
batch.setShader(null);
|
||||||
|
batch.begin();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
super.draw(batch, parentAlpha);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ public class ImageCache {
|
|||||||
static EvictingQueue<String> q;
|
static EvictingQueue<String> q;
|
||||||
static Set<String> cardsLoaded;
|
static Set<String> cardsLoaded;
|
||||||
static Queue<String> syncQ;
|
static Queue<String> syncQ;
|
||||||
|
|
||||||
public static void initCache(int capacity) {
|
public static void initCache(int capacity) {
|
||||||
//override maxCardCapacity
|
//override maxCardCapacity
|
||||||
maxCardCapacity = capacity;
|
maxCardCapacity = capacity;
|
||||||
@@ -93,14 +94,14 @@ public class ImageCache {
|
|||||||
int cl = GuiBase.isAndroid() ? maxCardCapacity + (capacity / 3) : 400;
|
int cl = GuiBase.isAndroid() ? maxCardCapacity + (capacity / 3) : 400;
|
||||||
cardsLoaded = new HashSet<>(cl);
|
cardsLoaded = new HashSet<>(cl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Texture getDefaultImage() {
|
public static Texture getDefaultImage() {
|
||||||
return Forge.getAssets().getDefaultImage();
|
return Forge.getAssets().getDefaultImage();
|
||||||
}
|
}
|
||||||
public static FImage BlackBorder = FSkinImage.IMG_BORDER_BLACK;
|
|
||||||
public static FImage WhiteBorder = FSkinImage.IMG_BORDER_WHITE;
|
|
||||||
private static final HashMap<String, Pair<String, Boolean>> imageBorder = new HashMap<>(1024);
|
|
||||||
|
|
||||||
|
private static final HashMap<String, ImageRecord> imageRecord = new HashMap<>(1024);
|
||||||
private static boolean imageLoaded, delayLoadRequested;
|
private static boolean imageLoaded, delayLoadRequested;
|
||||||
|
|
||||||
public static void allowSingleLoad() {
|
public static void allowSingleLoad() {
|
||||||
imageLoaded = false; //reset at the beginning of each render
|
imageLoaded = false; //reset at the beginning of each render
|
||||||
delayLoadRequested = false;
|
delayLoadRequested = false;
|
||||||
@@ -110,9 +111,11 @@ public class ImageCache {
|
|||||||
missingIconKeys.clear();
|
missingIconKeys.clear();
|
||||||
ImageKeys.clearMissingCards();
|
ImageKeys.clearMissingCards();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clearGeneratedCards() {
|
public static void clearGeneratedCards() {
|
||||||
Forge.getAssets().generatedCards().clear();
|
Forge.getAssets().generatedCards().clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void disposeTextures() {
|
public static void disposeTextures() {
|
||||||
CardRenderer.clearcardArtCache();
|
CardRenderer.clearcardArtCache();
|
||||||
//unload all cardsLoaded
|
//unload all cardsLoaded
|
||||||
@@ -124,6 +127,7 @@ public class ImageCache {
|
|||||||
cardsLoaded.clear();
|
cardsLoaded.clear();
|
||||||
((Forge) Gdx.app.getApplicationListener()).needsUpdate = true;
|
((Forge) Gdx.app.getApplicationListener()).needsUpdate = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update counter for use with adventure mode since it uses direct loading for assetmanager for loot and shops
|
* Update counter for use with adventure mode since it uses direct loading for assetmanager for loot and shops
|
||||||
*/
|
*/
|
||||||
@@ -209,6 +213,7 @@ public class ImageCache {
|
|||||||
public static Texture getImage(String imageKey, boolean useDefaultIfNotFound) {
|
public static Texture getImage(String imageKey, boolean useDefaultIfNotFound) {
|
||||||
return getImage(imageKey, useDefaultIfNotFound, false);
|
return getImage(imageKey, useDefaultIfNotFound, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Texture getImage(String imageKey, boolean useDefaultIfNotFound, boolean others) {
|
public static Texture getImage(String imageKey, boolean useDefaultIfNotFound, boolean others) {
|
||||||
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DISABLE_CARD_IMAGES))
|
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DISABLE_CARD_IMAGES))
|
||||||
return null;
|
return null;
|
||||||
@@ -239,7 +244,9 @@ public class ImageCache {
|
|||||||
// Load from file and add to cache if not found in cache initially.
|
// Load from file and add to cache if not found in cache initially.
|
||||||
image = getAsset(imageKey, imageFile, others);
|
image = getAsset(imageKey, imageFile, others);
|
||||||
|
|
||||||
if (image != null) { return image; }
|
if (image != null) {
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
if (imageLoaded) { //prevent loading more than one image each render for performance
|
if (imageLoaded) { //prevent loading more than one image each render for performance
|
||||||
if (!delayLoadRequested) {
|
if (!delayLoadRequested) {
|
||||||
@@ -266,19 +273,21 @@ public class ImageCache {
|
|||||||
/*fix not loading image file since we intentionally not to update the cache in order for the
|
/*fix not loading image file since we intentionally not to update the cache in order for the
|
||||||
image fetcher to update automatically after the card image/s are downloaded*/
|
image fetcher to update automatically after the card image/s are downloaded*/
|
||||||
imageLoaded = false;
|
imageLoaded = false;
|
||||||
if (image != null && imageBorder.get(image.toString()) == null)
|
if (image != null && imageRecord.get(image.toString()) == null)
|
||||||
imageBorder.put(image.toString(), Pair.of(Color.valueOf("#171717").toString(), false)); //black border
|
imageRecord.put(image.toString(), new ImageRecord(Color.valueOf("#171717").toString(), false, getRadius(image))); //black border
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Texture getAsset(String imageKey, File file, boolean others) {
|
static Texture getAsset(String imageKey, File file, boolean others) {
|
||||||
if (file == null)
|
if (file == null)
|
||||||
return null;
|
return null;
|
||||||
if (!others && Forge.enableUIMask.equals("Full") && isBorderless(imageKey))
|
/*if (!others && Forge.enableUIMask.equals("Full") && isBorderless(imageKey))
|
||||||
return Forge.getAssets().generatedCards().get(imageKey);
|
return Forge.getAssets().generatedCards().get(imageKey);*/
|
||||||
return Forge.getAssets().manager().get(file.getPath(), Texture.class, false);
|
return Forge.getAssets().manager().get(file.getPath(), Texture.class, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Texture loadAsset(String imageKey, File file, boolean others) {
|
static Texture loadAsset(String imageKey, File file, boolean others) {
|
||||||
if (file == null)
|
if (file == null)
|
||||||
return null;
|
return null;
|
||||||
@@ -309,17 +318,28 @@ public class ImageCache {
|
|||||||
} else {
|
} else {
|
||||||
Texture cardTexture = Forge.getAssets().manager().get(fileName, Texture.class, false);
|
Texture cardTexture = Forge.getAssets().manager().get(fileName, Texture.class, false);
|
||||||
//if full bordermasking is enabled, update the border color
|
//if full bordermasking is enabled, update the border color
|
||||||
if (cardTexture != null && Forge.enableUIMask.equals("Full")) {
|
if (cardTexture != null) {
|
||||||
boolean borderless = isBorderless(imageKey);
|
boolean borderless = isBorderless(imageKey);
|
||||||
updateBorders(cardTexture.toString(), borderless ? Pair.of(Color.valueOf("#171717").toString(), false): isCloserToWhite(getpixelColor(cardTexture)));
|
String setCode = imageKey.split("/")[0].trim().toUpperCase();
|
||||||
|
int radius;
|
||||||
|
if (setCode.equals("A") || setCode.equals("LEA") || setCode.equals("B") || setCode.equals("LEB"))
|
||||||
|
radius = 28;
|
||||||
|
else if (setCode.equals("MED") || setCode.equals("ME2") || setCode.equals("ME3") || setCode.equals("ME4") || setCode.equals("TD0") || setCode.equals("TD1"))
|
||||||
|
radius = 25;
|
||||||
|
else
|
||||||
|
radius = 22;
|
||||||
|
updateImageRecord(cardTexture.toString(),
|
||||||
|
borderless ? Color.valueOf("#171717").toString() : isCloserToWhite(getpixelColor(cardTexture)).getLeft(),
|
||||||
|
borderless ? false : isCloserToWhite(getpixelColor(cardTexture)).getRight(), radius);
|
||||||
//if borderless, generate new texture from the asset and store
|
//if borderless, generate new texture from the asset and store
|
||||||
if (borderless) {
|
/*if (borderless) {
|
||||||
Forge.getAssets().generatedCards().put(imageKey, generateTexture(new FileHandle(file), cardTexture, Forge.isTextureFilteringEnabled()));
|
Forge.getAssets().generatedCards().put(imageKey, generateTexture(new FileHandle(file), cardTexture, Forge.isTextureFilteringEnabled()));
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
return cardTexture;
|
return cardTexture;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void unloadCardTextures(boolean removeAll) {
|
public static void unloadCardTextures(boolean removeAll) {
|
||||||
if (removeAll) {
|
if (removeAll) {
|
||||||
try {
|
try {
|
||||||
@@ -359,6 +379,7 @@ public class ImageCache {
|
|||||||
//e.printstacktrace
|
//e.printstacktrace
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void preloadCache(Iterable<String> keys) {
|
public static void preloadCache(Iterable<String> keys) {
|
||||||
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DISABLE_CARD_IMAGES))
|
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DISABLE_CARD_IMAGES))
|
||||||
return;
|
return;
|
||||||
@@ -367,6 +388,7 @@ public class ImageCache {
|
|||||||
System.err.println("could not load card image:" + imageKey);
|
System.err.println("could not load card image:" + imageKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void preloadCache(Deck deck) {
|
public static void preloadCache(Deck deck) {
|
||||||
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DISABLE_CARD_IMAGES))
|
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_DISABLE_CARD_IMAGES))
|
||||||
return;
|
return;
|
||||||
@@ -379,6 +401,7 @@ public class ImageCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TextureRegion croppedBorderImage(Texture image) {
|
public static TextureRegion croppedBorderImage(Texture image) {
|
||||||
if (!image.toString().contains(".fullborder."))
|
if (!image.toString().contains(".fullborder."))
|
||||||
return new TextureRegion(image);
|
return new TextureRegion(image);
|
||||||
@@ -389,15 +412,17 @@ public class ImageCache {
|
|||||||
int ry = Math.round((image.getHeight() - rh) / 2f) - 2;
|
int ry = Math.round((image.getHeight() - rh) / 2f) - 2;
|
||||||
return new TextureRegion(image, rx, ry, rw, rh);
|
return new TextureRegion(image, rx, ry, rw, rh);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Color borderColor(Texture t) {
|
public static Color borderColor(Texture t) {
|
||||||
if (t == null)
|
if (t == null)
|
||||||
return Color.valueOf("#171717");
|
return Color.valueOf("#171717");
|
||||||
try {
|
try {
|
||||||
return Color.valueOf(imageBorder.get(t.toString()).getLeft());
|
return Color.valueOf(imageRecord.get(t.toString()).colorValue);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return Color.valueOf("#171717");
|
return Color.valueOf("#171717");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getFSkinBorders(CardView c) {
|
public static int getFSkinBorders(CardView c) {
|
||||||
if (c == null)
|
if (c == null)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -409,25 +434,44 @@ public class ImageCache {
|
|||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
public static boolean isBorderlessCardArt(Texture t) {
|
|
||||||
|
/*public static boolean isBorderlessCardArt(Texture t) {
|
||||||
return isBorderless(t);
|
return isBorderless(t);
|
||||||
|
}*/
|
||||||
|
public static void updateImageRecord(String textureString, String colorValue, Boolean isClosertoWhite, int radius) {
|
||||||
|
imageRecord.put(textureString, new ImageRecord(colorValue, isClosertoWhite, radius));
|
||||||
}
|
}
|
||||||
public static void updateBorders(String textureString, Pair<String, Boolean> colorPair){
|
|
||||||
imageBorder.put(textureString, colorPair);
|
public static int getRadius(Texture t) {
|
||||||
|
ImageRecord record = imageRecord.get(t.toString());
|
||||||
|
if (record == null)
|
||||||
|
return 20;
|
||||||
|
Integer i = record.cardRadius;
|
||||||
|
if (i == null)
|
||||||
|
return 20;
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FImage getBorder(String textureString) {
|
public static FImage getBorder(String textureString) {
|
||||||
if (imageBorder.get(textureString) == null)
|
ImageRecord record = imageRecord.get(textureString);
|
||||||
return BlackBorder;
|
if (record == null)
|
||||||
return imageBorder.get(textureString).getRight() ? WhiteBorder : BlackBorder;
|
return FSkinImage.IMG_BORDER_BLACK;
|
||||||
|
Boolean border = record.isCloserToWhite;
|
||||||
|
if (border == null)
|
||||||
|
return FSkinImage.IMG_BORDER_BLACK;
|
||||||
|
return border ? FSkinImage.IMG_BORDER_WHITE : FSkinImage.IMG_BORDER_BLACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FImage getBorderImage(String textureString, boolean canshow) {
|
public static FImage getBorderImage(String textureString, boolean canshow) {
|
||||||
if (!canshow)
|
if (!canshow)
|
||||||
return BlackBorder;
|
return FSkinImage.IMG_BORDER_BLACK;
|
||||||
return getBorder(textureString);
|
return getBorder(textureString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FImage getBorderImage(String textureString) {
|
public static FImage getBorderImage(String textureString) {
|
||||||
return getBorder(textureString);
|
return getBorder(textureString);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Color getTint(CardView c, Texture t) {
|
public static Color getTint(CardView c, Texture t) {
|
||||||
if (c == null)
|
if (c == null)
|
||||||
return borderColor(t);
|
return borderColor(t);
|
||||||
@@ -439,8 +483,7 @@ public class ImageCache {
|
|||||||
if (state.hasDevoid()) //devoid is colorless at all zones so return its corresponding border color...
|
if (state.hasDevoid()) //devoid is colorless at all zones so return its corresponding border color...
|
||||||
return borderColor(t);
|
return borderColor(t);
|
||||||
return Color.valueOf("#A0A6A4");
|
return Color.valueOf("#A0A6A4");
|
||||||
}
|
} else if (state.getColors().isMonoColor()) {
|
||||||
else if (state.getColors().isMonoColor()) {
|
|
||||||
if (state.getColors().hasBlack())
|
if (state.getColors().hasBlack())
|
||||||
return Color.valueOf("#48494a");
|
return Color.valueOf("#48494a");
|
||||||
else if (state.getColors().hasBlue())
|
else if (state.getColors().hasBlue())
|
||||||
@@ -451,12 +494,12 @@ public class ImageCache {
|
|||||||
return Color.valueOf("#66cb35");
|
return Color.valueOf("#66cb35");
|
||||||
else if (state.getColors().hasWhite())
|
else if (state.getColors().hasWhite())
|
||||||
return Color.valueOf("#EEEBE1");
|
return Color.valueOf("#EEEBE1");
|
||||||
}
|
} else if (state.getColors().isMulticolor())
|
||||||
else if (state.getColors().isMulticolor())
|
|
||||||
return Color.valueOf("#F9E084");
|
return Color.valueOf("#F9E084");
|
||||||
|
|
||||||
return borderColor(t);
|
return borderColor(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Texture generateTexture(FileHandle fh, Texture cardTexture, boolean textureFilter) {
|
public static Texture generateTexture(FileHandle fh, Texture cardTexture, boolean textureFilter) {
|
||||||
if (cardTexture == null || fh == null)
|
if (cardTexture == null || fh == null)
|
||||||
return cardTexture;
|
return cardTexture;
|
||||||
@@ -481,6 +524,7 @@ public class ImageCache {
|
|||||||
});
|
});
|
||||||
return placeholder[0];
|
return placeholder[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Pixmap createRoundedRectangle(int width, int height, int cornerRadius, Color color) {
|
public static Pixmap createRoundedRectangle(int width, int height, int cornerRadius, Color color) {
|
||||||
Pixmap pixmap = new Pixmap(width, height, Format.RGBA4444);
|
Pixmap pixmap = new Pixmap(width, height, Format.RGBA4444);
|
||||||
Pixmap ret = new Pixmap(width, height, Format.RGBA4444);
|
Pixmap ret = new Pixmap(width, height, Format.RGBA4444);
|
||||||
@@ -503,6 +547,7 @@ public class ImageCache {
|
|||||||
pixmap.dispose();
|
pixmap.dispose();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawPixelstoMask(Pixmap pixmap, Pixmap mask) {
|
public static void drawPixelstoMask(Pixmap pixmap, Pixmap mask) {
|
||||||
int pixmapWidth = mask.getWidth();
|
int pixmapWidth = mask.getWidth();
|
||||||
int pixmapHeight = mask.getHeight();
|
int pixmapHeight = mask.getHeight();
|
||||||
@@ -548,6 +593,7 @@ public class ImageCache {
|
|||||||
pixmap.dispose();
|
pixmap.dispose();
|
||||||
return color.toString();
|
return color.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Pair<String, Boolean> isCloserToWhite(String c) {
|
public static Pair<String, Boolean> isCloserToWhite(String c) {
|
||||||
if (c == null || c == "")
|
if (c == null || c == "")
|
||||||
return Pair.of(Color.valueOf("#171717").toString(), false);
|
return Pair.of(Color.valueOf("#171717").toString(), false);
|
||||||
@@ -557,4 +603,16 @@ public class ImageCache {
|
|||||||
int brightness = ((c_r * 299) + (c_g * 587) + (c_b * 114)) / 1000;
|
int brightness = ((c_r * 299) + (c_g * 587) + (c_b * 114)) / 1000;
|
||||||
return Pair.of(c, brightness > 155);
|
return Pair.of(c, brightness > 155);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class ImageRecord {
|
||||||
|
String colorValue;
|
||||||
|
Boolean isCloserToWhite;
|
||||||
|
Integer cardRadius;
|
||||||
|
|
||||||
|
ImageRecord(String colorString, Boolean closetoWhite, int radius) {
|
||||||
|
colorValue = colorString;
|
||||||
|
isCloserToWhite = closetoWhite;
|
||||||
|
cardRadius = radius;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,11 +46,10 @@ public class CardImage implements FImage {
|
|||||||
|
|
||||||
if (image == ImageCache.getDefaultImage() || Forge.enableUIMask.equals("Art")) {
|
if (image == ImageCache.getDefaultImage() || Forge.enableUIMask.equals("Art")) {
|
||||||
CardImageRenderer.drawCardImage(g, CardView.getCardForUi(card), false, x, y, w, h, CardStackPosition.Top, true, true);
|
CardImageRenderer.drawCardImage(g, CardView.getCardForUi(card), false, x, y, w, h, CardStackPosition.Top, true, true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (Forge.enableUIMask.equals("Full")) {
|
if (Forge.enableUIMask.equals("Full")) {
|
||||||
if (ImageCache.isBorderlessCardArt(image))
|
if (image.toString().contains(".fullborder."))
|
||||||
g.drawImage(image, x, y, w, h);
|
g.drawCardRoundRect(image, null, x, y, w, h, false, false);
|
||||||
else {
|
else {
|
||||||
float radius = (h - w) / 8;
|
float radius = (h - w) / 8;
|
||||||
g.drawborderImage(ImageCache.borderColor(image), x, y, w, h);
|
g.drawborderImage(ImageCache.borderColor(image), x, y, w, h);
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public class CardImageRenderer {
|
|||||||
public static void drawCardImage(Graphics g, CardView card, boolean altState, float x, float y, float w, float h, CardStackPosition pos, boolean useCardBGTexture, boolean showArtist) {
|
public static void drawCardImage(Graphics g, CardView card, boolean altState, float x, float y, float w, float h, CardStackPosition pos, boolean useCardBGTexture, boolean showArtist) {
|
||||||
drawCardImage(g, card, altState, x, y, w, h, pos, useCardBGTexture, false, false, showArtist);
|
drawCardImage(g, card, altState, x, y, w, h, pos, useCardBGTexture, false, false, showArtist);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawCardImage(Graphics g, CardView card, boolean altState, float x, float y, float w, float h, CardStackPosition pos, boolean useCardBGTexture, boolean noText, boolean isChoiceList, boolean showArtist) {
|
public static void drawCardImage(Graphics g, CardView card, boolean altState, float x, float y, float w, float h, CardStackPosition pos, boolean useCardBGTexture, boolean noText, boolean isChoiceList, boolean showArtist) {
|
||||||
updateStaticFields(w, h);
|
updateStaticFields(w, h);
|
||||||
|
|
||||||
@@ -134,7 +135,9 @@ public class CardImageRenderer {
|
|||||||
Color[] headerColors = FSkinColor.tintColors(Color.WHITE, colors, CardRenderer.NAME_BOX_TINT);
|
Color[] headerColors = FSkinColor.tintColors(Color.WHITE, colors, CardRenderer.NAME_BOX_TINT);
|
||||||
drawHeader(g, card, state, headerColors, x, y, w, headerHeight, isFaceDown && !altState, false);
|
drawHeader(g, card, state, headerColors, x, y, w, headerHeight, isFaceDown && !altState, false);
|
||||||
|
|
||||||
if (pos == CardStackPosition.BehindVert) { return; } //remaining rendering not needed if card is behind another card in a vertical stack
|
if (pos == CardStackPosition.BehindVert) {
|
||||||
|
return;
|
||||||
|
} //remaining rendering not needed if card is behind another card in a vertical stack
|
||||||
boolean onTop = (pos == CardStackPosition.Top);
|
boolean onTop = (pos == CardStackPosition.Top);
|
||||||
|
|
||||||
y += headerHeight;
|
y += headerHeight;
|
||||||
@@ -177,8 +180,7 @@ public class CardImageRenderer {
|
|||||||
drawArt(card, g, x + artInset, y, artWidth, artHeight + textBoxHeight, altState, isFaceDown);
|
drawArt(card, g, x + artInset, y, artWidth, artHeight + textBoxHeight, altState, isFaceDown);
|
||||||
y += textBoxHeight;
|
y += textBoxHeight;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
drawArt(card, g, x + artInset, y, artWidth, artHeight, altState, isFaceDown);
|
drawArt(card, g, x + artInset, y, artWidth, artHeight, altState, isFaceDown);
|
||||||
y += artHeight;
|
y += artHeight;
|
||||||
}
|
}
|
||||||
@@ -269,6 +271,7 @@ public class CardImageRenderer {
|
|||||||
|
|
||||||
public static final FBufferedImage forgeArt;
|
public static final FBufferedImage forgeArt;
|
||||||
private static final FBufferedImage stretchedArt;
|
private static final FBufferedImage stretchedArt;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
final float logoWidth = FSkinImage.LOGO.getWidth();
|
final float logoWidth = FSkinImage.LOGO.getWidth();
|
||||||
final float logoHeight = FSkinImage.LOGO.getHeight();
|
final float logoHeight = FSkinImage.LOGO.getHeight();
|
||||||
@@ -371,6 +374,7 @@ public class CardImageRenderer {
|
|||||||
}
|
}
|
||||||
g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
|
g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawSplitCard(CardView card, FImageComplex cardArt, Graphics g, float x, float y, float w, float h, boolean altState, boolean isFaceDown) {
|
private static void drawSplitCard(CardView card, FImageComplex cardArt, Graphics g, float x, float y, float w, float h, boolean altState, boolean isFaceDown) {
|
||||||
CardView alt = card.getBackup();
|
CardView alt = card.getBackup();
|
||||||
if (alt == null)
|
if (alt == null)
|
||||||
@@ -398,12 +402,14 @@ public class CardImageRenderer {
|
|||||||
g.drawLine(BORDER_THICKNESS, Color.BLACK, x, y + h / 2, x + w, y + h / 2);
|
g.drawLine(BORDER_THICKNESS, Color.BLACK, x, y + h / 2, x + w, y + h / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawFlipCard(FImageComplex cardArt, Graphics g, float x, float y, float w, float h, boolean altState) {
|
private static void drawFlipCard(FImageComplex cardArt, Graphics g, float x, float y, float w, float h, boolean altState) {
|
||||||
if (altState)
|
if (altState)
|
||||||
g.drawRotatedImage(cardArt.getTextureRegion(), x, y, w, h, x + w / 2, y + h / 2, 180);
|
g.drawRotatedImage(cardArt.getTextureRegion(), x, y, w, h, x + w / 2, y + h / 2, 180);
|
||||||
else
|
else
|
||||||
g.drawImage(cardArt, x, y, w, h);
|
g.drawImage(cardArt, x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawTypeLine(Graphics g, CardStateView state, boolean canShow, Color[] colors, float x, float y, float w, float h, boolean noText, boolean noRarity, boolean isAdventure) {
|
private static void drawTypeLine(Graphics g, CardStateView state, boolean canShow, Color[] colors, float x, float y, float w, float h, boolean noText, boolean noRarity, boolean isAdventure) {
|
||||||
float oldAlpha = g.getfloatAlphaComposite();
|
float oldAlpha = g.getfloatAlphaComposite();
|
||||||
if (isAdventure)
|
if (isAdventure)
|
||||||
@@ -465,6 +471,7 @@ public class CardImageRenderer {
|
|||||||
setTextBox(g, card, state, colors, x, y, w, h, onTop, useCardBGTexture, noText, 0f, 0f, false, altstate, isFacedown);
|
setTextBox(g, card, state, colors, x, y, w, h, onTop, useCardBGTexture, noText, 0f, 0f, false, altstate, isFacedown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setTextBox(Graphics g, CardView card, CardStateView state, Color[] colors, float x, float y, float w, float h, boolean onTop, boolean useCardBGTexture, boolean noText, float adventureHeaderHeight, float adventureTypeHeight, boolean drawAdventure, boolean altstate, boolean isFaceDown) {
|
private static void setTextBox(Graphics g, CardView card, CardStateView state, Color[] colors, float x, float y, float w, float h, boolean onTop, boolean useCardBGTexture, boolean noText, float adventureHeaderHeight, float adventureTypeHeight, boolean drawAdventure, boolean altstate, boolean isFaceDown) {
|
||||||
boolean fakeDuals = false;
|
boolean fakeDuals = false;
|
||||||
//update land bg colors
|
//update land bg colors
|
||||||
@@ -481,7 +488,8 @@ public class CardImageRenderer {
|
|||||||
modColors = DetailColors.BLACK;
|
modColors = DetailColors.BLACK;
|
||||||
else if (state.isPlains())
|
else if (state.isPlains())
|
||||||
modColors = DetailColors.LAND;
|
modColors = DetailColors.LAND;
|
||||||
} if (state.origCanProduceColoredMana() == 2) {
|
}
|
||||||
|
if (state.origCanProduceColoredMana() == 2) {
|
||||||
//dual colors
|
//dual colors
|
||||||
Color[] colorPairs = new Color[2];
|
Color[] colorPairs = new Color[2];
|
||||||
//init Color
|
//init Color
|
||||||
@@ -577,7 +585,9 @@ public class CardImageRenderer {
|
|||||||
}
|
}
|
||||||
g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
|
g.drawRect(BORDER_THICKNESS, Color.BLACK, x, y, w, h);
|
||||||
|
|
||||||
if (!onTop) { return; } //remaining rendering only needed if card on top
|
if (!onTop) {
|
||||||
|
return;
|
||||||
|
} //remaining rendering only needed if card on top
|
||||||
|
|
||||||
if (state.isBasicLand()) {
|
if (state.isBasicLand()) {
|
||||||
//draw watermark
|
//draw watermark
|
||||||
@@ -649,30 +659,31 @@ public class CardImageRenderer {
|
|||||||
cardTextRenderer.drawText(g, text, TEXT_FONT, Color.BLACK, x, y, w, h, y, h, true, Align.left, true);
|
cardTextRenderer.drawText(g, text, TEXT_FONT, Color.BLACK, x, y, w, h, y, h, true, Align.left, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawAlphaLines(Graphics g, float x, float y, float w, float h) {
|
private static void drawAlphaLines(Graphics g, float x, float y, float w, float h) {
|
||||||
if (FSkin.overlay_alpha != null) {
|
if (FSkin.overlay_alpha != null) {
|
||||||
g.drawImage(FSkin.overlay_alpha, x, y, w, h);
|
g.drawImage(FSkin.overlay_alpha, x, y, w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawPtBox(Graphics g, CardView card, CardStateView state, Color[] colors, float x, float y, float w, float h, boolean noText) {
|
private static void drawPtBox(Graphics g, CardView card, CardStateView state, Color[] colors, float x, float y, float w, float h, boolean noText) {
|
||||||
List<String> pieces = new ArrayList<>();
|
List<String> pieces = new ArrayList<>();
|
||||||
if (state.isCreature()) {
|
if (state.isCreature()) {
|
||||||
pieces.add(String.valueOf(state.getPower()));
|
pieces.add(String.valueOf(state.getPower()));
|
||||||
pieces.add("/");
|
pieces.add("/");
|
||||||
pieces.add(String.valueOf(state.getToughness()));
|
pieces.add(String.valueOf(state.getToughness()));
|
||||||
}
|
} else if (state.isPlaneswalker()) {
|
||||||
else if (state.isPlaneswalker()) {
|
|
||||||
pieces.add(String.valueOf(state.getLoyalty()));
|
pieces.add(String.valueOf(state.getLoyalty()));
|
||||||
}
|
} else if (state.getType().hasSubtype("Vehicle")) {
|
||||||
else if (state.getType().hasSubtype("Vehicle")) {
|
|
||||||
// TODO Invert color box for Vehicles?
|
// TODO Invert color box for Vehicles?
|
||||||
pieces.add("[");
|
pieces.add("[");
|
||||||
pieces.add(String.valueOf(state.getPower()));
|
pieces.add(String.valueOf(state.getPower()));
|
||||||
pieces.add("/");
|
pieces.add("/");
|
||||||
pieces.add(String.valueOf(state.getToughness()));
|
pieces.add(String.valueOf(state.getToughness()));
|
||||||
pieces.add("]");
|
pieces.add("]");
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else { return; }
|
|
||||||
|
|
||||||
float padding = Math.round(PT_FONT.getCapHeight() / 4);
|
float padding = Math.round(PT_FONT.getCapHeight() / 4);
|
||||||
float totalPieceWidth = -padding;
|
float totalPieceWidth = -padding;
|
||||||
@@ -746,8 +757,8 @@ public class CardImageRenderer {
|
|||||||
}
|
}
|
||||||
if (rotatePlane && (card.getCurrentState().isPhenomenon() || card.getCurrentState().isPlane())) {
|
if (rotatePlane && (card.getCurrentState().isPhenomenon() || card.getCurrentState().isPlane())) {
|
||||||
if (Forge.enableUIMask.equals("Full")) {
|
if (Forge.enableUIMask.equals("Full")) {
|
||||||
if (ImageCache.isBorderlessCardArt(image))
|
if (image.toString().contains(".fullborder."))
|
||||||
g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90);
|
g.drawCardRoundRect(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90);
|
||||||
else {
|
else {
|
||||||
g.drawRotatedImage(FSkin.getBorders().get(0), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90);
|
g.drawRotatedImage(FSkin.getBorders().get(0), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, -90);
|
||||||
g.drawRotatedImage(ImageCache.croppedBorderImage(image), new_x + radius / 2 - minusxy, new_y + radius / 2 - minusxy, new_w * croppedArea, new_h * croppedArea, (new_x + radius / 2 - minusxy) + (new_w * croppedArea) / 2, (new_y + radius / 2 - minusxy) + (new_h * croppedArea) / 2, -90);
|
g.drawRotatedImage(ImageCache.croppedBorderImage(image), new_x + radius / 2 - minusxy, new_y + radius / 2 - minusxy, new_w * croppedArea, new_h * croppedArea, (new_x + radius / 2 - minusxy) + (new_w * croppedArea) / 2, (new_y + radius / 2 - minusxy) + (new_h * croppedArea) / 2, -90);
|
||||||
@@ -759,8 +770,8 @@ public class CardImageRenderer {
|
|||||||
} else if (rotateSplit && isCurrentCard && card.isSplitCard() && canshow && !card.isFaceDown()) {
|
} else if (rotateSplit && isCurrentCard && card.isSplitCard() && canshow && !card.isFaceDown()) {
|
||||||
boolean isAftermath = card.getText().contains("Aftermath") || card.getAlternateState().getOracleText().contains("Aftermath");
|
boolean isAftermath = card.getText().contains("Aftermath") || card.getAlternateState().getOracleText().contains("Aftermath");
|
||||||
if (Forge.enableUIMask.equals("Full")) {
|
if (Forge.enableUIMask.equals("Full")) {
|
||||||
if (ImageCache.isBorderlessCardArt(image))
|
if (image.toString().contains(".fullborder."))
|
||||||
g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
g.drawCardRoundRect(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
||||||
else {
|
else {
|
||||||
g.drawRotatedImage(FSkin.getBorders().get(ImageCache.getFSkinBorders(card)), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
g.drawRotatedImage(FSkin.getBorders().get(ImageCache.getFSkinBorders(card)), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
||||||
g.drawRotatedImage(ImageCache.croppedBorderImage(image), new_x + radius / 2 - minusxy, new_y + radius / 2 - minusxy, new_w * croppedArea, new_h * croppedArea, (new_x + radius / 2 - minusxy) + (new_w * croppedArea) / 2, (new_y + radius / 2 - minusxy) + (new_h * croppedArea) / 2, isAftermath ? 90 : -90);
|
g.drawRotatedImage(ImageCache.croppedBorderImage(image), new_x + radius / 2 - minusxy, new_y + radius / 2 - minusxy, new_w * croppedArea, new_h * croppedArea, (new_x + radius / 2 - minusxy) + (new_w * croppedArea) / 2, (new_y + radius / 2 - minusxy) + (new_h * croppedArea) / 2, isAftermath ? 90 : -90);
|
||||||
@@ -775,8 +786,8 @@ public class CardImageRenderer {
|
|||||||
if (card.isSplitCard() && rotateSplit && isCurrentCard) {
|
if (card.isSplitCard() && rotateSplit && isCurrentCard) {
|
||||||
boolean isAftermath = card.getText().contains("Aftermath") || card.getAlternateState().getOracleText().contains("Aftermath");
|
boolean isAftermath = card.getText().contains("Aftermath") || card.getAlternateState().getOracleText().contains("Aftermath");
|
||||||
if (Forge.enableUIMask.equals("Full")) {
|
if (Forge.enableUIMask.equals("Full")) {
|
||||||
if (ImageCache.isBorderlessCardArt(image))
|
if (image.toString().contains(".fullborder."))
|
||||||
g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
g.drawCardRoundRect(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
||||||
else {
|
else {
|
||||||
g.drawRotatedImage(FSkin.getBorders().get(ImageCache.getFSkinBorders(card)), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
g.drawRotatedImage(FSkin.getBorders().get(ImageCache.getFSkinBorders(card)), new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
||||||
g.drawRotatedImage(ImageCache.croppedBorderImage(image), new_x + radius / 2 - minusxy, new_y + radius / 2 - minusxy, new_w * croppedArea, new_h * croppedArea, (new_x + radius / 2 - minusxy) + (new_w * croppedArea) / 2, (new_y + radius / 2 - minusxy) + (new_h * croppedArea) / 2, isAftermath ? 90 : -90);
|
g.drawRotatedImage(ImageCache.croppedBorderImage(image), new_x + radius / 2 - minusxy, new_y + radius / 2 - minusxy, new_w * croppedArea, new_h * croppedArea, (new_x + radius / 2 - minusxy) + (new_w * croppedArea) / 2, (new_y + radius / 2 - minusxy) + (new_h * croppedArea) / 2, isAftermath ? 90 : -90);
|
||||||
@@ -787,8 +798,8 @@ public class CardImageRenderer {
|
|||||||
g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
g.drawRotatedImage(image, new_x, new_y, new_w, new_h, new_x + new_w / 2, new_y + new_h / 2, isAftermath ? 90 : -90);
|
||||||
} else {
|
} else {
|
||||||
if (Forge.enableUIMask.equals("Full")) {
|
if (Forge.enableUIMask.equals("Full")) {
|
||||||
if (ImageCache.isBorderlessCardArt(image))
|
if (image.toString().contains(".fullborder."))
|
||||||
g.drawImage(image, x, y, w, h);
|
g.drawCardRoundRect(image, null, x, y, w, h, false, false);
|
||||||
else {
|
else {
|
||||||
g.drawImage(ImageCache.getBorderImage(image.toString()), ImageCache.borderColor(image), x, y, w, h);
|
g.drawImage(ImageCache.getBorderImage(image.toString()), ImageCache.borderColor(image), x, y, w, h);
|
||||||
g.drawImage(ImageCache.croppedBorderImage(image), x + radius / 2.4f - minusxy, y + radius / 2 - minusxy, w * croppedArea, h * croppedArea);
|
g.drawImage(ImageCache.croppedBorderImage(image), x + radius / 2.4f - minusxy, y + radius / 2 - minusxy, w * croppedArea, h * croppedArea);
|
||||||
@@ -804,8 +815,8 @@ public class CardImageRenderer {
|
|||||||
g.drawImage(sleeves, x, y, w, h);
|
g.drawImage(sleeves, x, y, w, h);
|
||||||
}
|
}
|
||||||
} else if (Forge.enableUIMask.equals("Full") && canshow) {
|
} else if (Forge.enableUIMask.equals("Full") && canshow) {
|
||||||
if (ImageCache.isBorderlessCardArt(image))
|
if (image.toString().contains(".fullborder."))
|
||||||
g.drawImage(image, x, y, w, h);
|
g.drawCardRoundRect(image, null, x, y, w, h, false, false);
|
||||||
else {
|
else {
|
||||||
g.drawImage(ImageCache.getBorderImage(image.toString()), ImageCache.borderColor(image), x, y, w, h);
|
g.drawImage(ImageCache.getBorderImage(image.toString()), ImageCache.borderColor(image), x, y, w, h);
|
||||||
g.drawImage(ImageCache.croppedBorderImage(image), x + radius / 2.4f - minusxy, y + radius / 2 - minusxy, w * croppedArea, h * croppedArea);
|
g.drawImage(ImageCache.croppedBorderImage(image), x + radius / 2.4f - minusxy, y + radius / 2 - minusxy, w * croppedArea, h * croppedArea);
|
||||||
@@ -841,8 +852,7 @@ public class CardImageRenderer {
|
|||||||
final boolean isFaceDown = card.isFaceDown();
|
final boolean isFaceDown = card.isFaceDown();
|
||||||
if (isFaceDown) {
|
if (isFaceDown) {
|
||||||
borderColors = ImmutableList.of(DetailColors.FACE_DOWN);
|
borderColors = ImmutableList.of(DetailColors.FACE_DOWN);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
borderColors = CardDetailUtil.getBorderColors(state, canShow);
|
borderColors = CardDetailUtil.getBorderColors(state, canShow);
|
||||||
}
|
}
|
||||||
Color[] colors = fillColorBackground(g, borderColors, x, y, w, h);
|
Color[] colors = fillColorBackground(g, borderColors, x, y, w, h);
|
||||||
@@ -881,6 +891,7 @@ public class CardImageRenderer {
|
|||||||
fillColorBackground(g, colors, x, y, w, h);
|
fillColorBackground(g, colors, x, y, w, h);
|
||||||
return colors;
|
return colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Color[] drawCardBackgroundTexture(CardStateView state, Graphics g, List<DetailColors> backColors, float x, float y, float w, float h) {
|
public static Color[] drawCardBackgroundTexture(CardStateView state, Graphics g, List<DetailColors> backColors, float x, float y, float w, float h) {
|
||||||
boolean isHybrid = state.getManaCost().hasHybrid();
|
boolean isHybrid = state.getManaCost().hasHybrid();
|
||||||
boolean isPW = state.isPlaneswalker();
|
boolean isPW = state.isPlaneswalker();
|
||||||
@@ -970,6 +981,7 @@ public class CardImageRenderer {
|
|||||||
}
|
}
|
||||||
return colors;
|
return colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void fillColorBackground(Graphics g, Color[] colors, float x, float y, float w, float h) {
|
public static void fillColorBackground(Graphics g, Color[] colors, float x, float y, float w, float h) {
|
||||||
switch (colors.length) {
|
switch (colors.length) {
|
||||||
case 1:
|
case 1:
|
||||||
@@ -1059,7 +1071,9 @@ public class CardImageRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String ptText = CardDetailUtil.formatPowerToughness(state, canShow);
|
String ptText = CardDetailUtil.formatPowerToughness(state, canShow);
|
||||||
if (StringUtils.isEmpty(ptText)) { return; }
|
if (StringUtils.isEmpty(ptText)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
float padding = PT_FONT.getCapHeight() / 2;
|
float padding = PT_FONT.getCapHeight() / 2;
|
||||||
float boxWidth = Math.min(PT_FONT.getBounds(ptText).width + 2 * padding,
|
float boxWidth = Math.min(PT_FONT.getBounds(ptText).width + 2 * padding,
|
||||||
|
|||||||
@@ -225,8 +225,7 @@ public class CardRenderer {
|
|||||||
if (image != null) {
|
if (image != null) {
|
||||||
if (image == ImageCache.getDefaultImage()) {
|
if (image == ImageCache.getDefaultImage()) {
|
||||||
cardArt = CardImageRenderer.forgeArt;
|
cardArt = CardImageRenderer.forgeArt;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
float x, y;
|
float x, y;
|
||||||
float w = image.getWidth();
|
float w = image.getWidth();
|
||||||
float h = image.getHeight();
|
float h = image.getHeight();
|
||||||
@@ -434,8 +433,7 @@ public class CardRenderer {
|
|||||||
drawCardListItem(g, font, foreColor, getCardArt(card), card, state.getSetCode(),
|
drawCardListItem(g, font, foreColor, getCardArt(card), card, state.getSetCode(),
|
||||||
state.getRarity(), state.getPower(), state.getToughness(),
|
state.getRarity(), state.getPower(), state.getToughness(),
|
||||||
state.getLoyalty(), count, suffix, x, y, w, h, compactMode);
|
state.getLoyalty(), count, suffix, x, y, w, h, compactMode);
|
||||||
}
|
} else { //if fake card, just draw card name centered
|
||||||
else { //if fake card, just draw card name centered
|
|
||||||
String name = CardTranslation.getTranslatedName(state.getName());
|
String name = CardTranslation.getTranslatedName(state.getName());
|
||||||
if (count > 0) { //preface name with count if applicable
|
if (count > 0) { //preface name with count if applicable
|
||||||
name = count + " " + name;
|
name = count + " " + name;
|
||||||
@@ -471,13 +469,11 @@ public class CardRenderer {
|
|||||||
srcY += dh / 2;
|
srcY += dh / 2;
|
||||||
g.drawRotatedImage(cardArt.getTexture(), artX, artY, cardArtHeight, cardArtWidth / 2, artX + cardArtWidth / 2, artY + cardArtWidth / 2, cardArt.getRegionX(), (int) srcY, (int) cardArt.getWidth(), (int) srcHeight, -90);
|
g.drawRotatedImage(cardArt.getTexture(), artX, artY, cardArtHeight, cardArtWidth / 2, artX + cardArtWidth / 2, artY + cardArtWidth / 2, cardArt.getRegionX(), (int) srcY, (int) cardArt.getWidth(), (int) srcHeight, -90);
|
||||||
g.drawRotatedImage(cardArt.getTexture(), artX, artY + cardArtWidth / 2, cardArtHeight, cardArtWidth / 2, artX + cardArtWidth / 2, artY + cardArtWidth / 2, cardArt.getRegionX(), (int) cardArt.getHeight() - (int) (srcY + srcHeight), (int) cardArt.getWidth(), (int) srcHeight, -90);
|
g.drawRotatedImage(cardArt.getTexture(), artX, artY + cardArtWidth / 2, cardArtHeight, cardArtWidth / 2, artX + cardArtWidth / 2, artY + cardArtWidth / 2, cardArt.getRegionX(), (int) cardArt.getHeight() - (int) (srcY + srcHeight), (int) cardArt.getWidth(), (int) srcHeight, -90);
|
||||||
}
|
} else if (card.getText().contains("Aftermath")) {
|
||||||
else if (card.getText().contains("Aftermath")) {
|
|
||||||
FImageComplex secondArt = CardRenderer.getAftermathSecondCardArt(card.getCurrentState().getImageKey());
|
FImageComplex secondArt = CardRenderer.getAftermathSecondCardArt(card.getCurrentState().getImageKey());
|
||||||
g.drawRotatedImage(cardArt.getTexture(), artX, artY, cardArtWidth, cardArtHeight / 2, artX + cardArtWidth, artY + cardArtHeight / 2, cardArt.getRegionX(), cardArt.getRegionY(), (int) cardArt.getWidth(), (int) cardArt.getHeight() / 2, 0);
|
g.drawRotatedImage(cardArt.getTexture(), artX, artY, cardArtWidth, cardArtHeight / 2, artX + cardArtWidth, artY + cardArtHeight / 2, cardArt.getRegionX(), cardArt.getRegionY(), (int) cardArt.getWidth(), (int) cardArt.getHeight() / 2, 0);
|
||||||
g.drawRotatedImage(secondArt.getTexture(), artX - cardArtHeight / 2, artY + cardArtHeight / 2, cardArtHeight / 2, cardArtWidth, artX, artY + cardArtHeight / 2, secondArt.getRegionX(), secondArt.getRegionY(), (int) secondArt.getWidth(), (int) secondArt.getHeight(), 90);
|
g.drawRotatedImage(secondArt.getTexture(), artX - cardArtHeight / 2, artY + cardArtHeight / 2, cardArtHeight / 2, cardArtWidth, artX, artY + cardArtHeight / 2, secondArt.getRegionX(), secondArt.getRegionY(), (int) secondArt.getWidth(), (int) secondArt.getHeight(), 90);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
g.drawImage(cardArt, artX, artY, cardArtWidth, cardArtHeight);
|
g.drawImage(cardArt, artX, artY, cardArtWidth, cardArtHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -526,11 +522,9 @@ public class CardRenderer {
|
|||||||
String type = CardDetailUtil.formatCardType(card.getCurrentState(), true);
|
String type = CardDetailUtil.formatCardType(card.getCurrentState(), true);
|
||||||
if (card.getCurrentState().isCreature()) { //include P/T or Loyalty at end of type
|
if (card.getCurrentState().isCreature()) { //include P/T or Loyalty at end of type
|
||||||
type += " (" + power + " / " + toughness + ")";
|
type += " (" + power + " / " + toughness + ")";
|
||||||
}
|
} else if (card.getCurrentState().isPlaneswalker()) {
|
||||||
else if (card.getCurrentState().isPlaneswalker()) {
|
|
||||||
type += " (" + loyalty + ")";
|
type += " (" + loyalty + ")";
|
||||||
}
|
} else if (card.getCurrentState().getType().hasSubtype("Vehicle")) {
|
||||||
else if (card.getCurrentState().getType().hasSubtype("Vehicle")) {
|
|
||||||
type += String.format(" [%s / %s]", power, toughness);
|
type += String.format(" [%s / %s]", power, toughness);
|
||||||
}
|
}
|
||||||
g.drawText(type, typeFont, foreColor, x, y, availableTypeWidth, lineHeight, false, Align.left, true);
|
g.drawText(type, typeFont, foreColor, x, y, availableTypeWidth, lineHeight, false, Align.left, true);
|
||||||
@@ -579,8 +573,8 @@ public class CardRenderer {
|
|||||||
CardImageRenderer.drawCardImage(g, CardView.getCardForUi(pc), false, x, y, w, h, pos, true, true);
|
CardImageRenderer.drawCardImage(g, CardView.getCardForUi(pc), false, x, y, w, h, pos, true, true);
|
||||||
} else {
|
} else {
|
||||||
if (Forge.enableUIMask.equals("Full")) {
|
if (Forge.enableUIMask.equals("Full")) {
|
||||||
if (ImageCache.isBorderlessCardArt(image))
|
if (image.toString().contains(".fullborder."))
|
||||||
g.drawImage(image, x, y, w, h);
|
g.drawCardRoundRect(image, null, x, y, w, h, false, false);
|
||||||
else {
|
else {
|
||||||
//tint the border
|
//tint the border
|
||||||
g.drawImage(ImageCache.getBorderImage(image.toString()), ImageCache.borderColor(image), x, y, w, h);
|
g.drawImage(ImageCache.getBorderImage(image.toString()), ImageCache.borderColor(image), x, y, w, h);
|
||||||
@@ -603,9 +597,11 @@ public class CardRenderer {
|
|||||||
CardImageRenderer.drawCardImage(g, CardView.getCardForUi(pc), false, x, y, w, h, pos, Forge.enableUIMask.equals("Art"), true);
|
CardImageRenderer.drawCardImage(g, CardView.getCardForUi(pc), false, x, y, w, h, pos, Forge.enableUIMask.equals("Art"), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawCard(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos, boolean rotate) {
|
public static void drawCard(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos, boolean rotate) {
|
||||||
drawCard(g, card, x, y, w, h, pos, rotate, false, false, false);
|
drawCard(g, card, x, y, w, h, pos, rotate, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawCard(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos, boolean rotate, boolean showAltState, boolean isChoiceList, boolean magnify) {
|
public static void drawCard(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos, boolean rotate, boolean showAltState, boolean isChoiceList, boolean magnify) {
|
||||||
boolean canshow = MatchController.instance.mayView(card);
|
boolean canshow = MatchController.instance.mayView(card);
|
||||||
boolean showsleeves = card.isFaceDown() && card.isInZone(EnumSet.of(ZoneType.Exile)); //fix facedown card image ie gonti lord of luxury
|
boolean showsleeves = card.isFaceDown() && card.isInZone(EnumSet.of(ZoneType.Exile)); //fix facedown card image ie gonti lord of luxury
|
||||||
@@ -634,8 +630,8 @@ public class CardRenderer {
|
|||||||
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ROTATE_PLANE_OR_PHENOMENON)
|
if (FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ROTATE_PLANE_OR_PHENOMENON)
|
||||||
&& (card.getCurrentState().isPhenomenon() || card.getCurrentState().isPlane()) && rotate) {
|
&& (card.getCurrentState().isPhenomenon() || card.getCurrentState().isPlane()) && rotate) {
|
||||||
if (Forge.enableUIMask.equals("Full")) {
|
if (Forge.enableUIMask.equals("Full")) {
|
||||||
if (ImageCache.isBorderlessCardArt(image))
|
if (image.toString().contains(".fullborder."))
|
||||||
g.drawRotatedImage(image, x, y, w, h, x + w / 2, y + h / 2, -90);
|
g.drawCardRoundRect(image, x, y, w, h, x + w / 2, y + h / 2, -90);
|
||||||
else {
|
else {
|
||||||
g.drawRotatedImage(FSkin.getBorders().get(0), x, y, w, h, x + w / 2, y + h / 2, -90);
|
g.drawRotatedImage(FSkin.getBorders().get(0), x, y, w, h, x + w / 2, y + h / 2, -90);
|
||||||
g.drawRotatedImage(ImageCache.croppedBorderImage(image), x + radius / 2.3f - minusxy, y + radius / 2 - minusxy, w * croppedArea, h * croppedArea, (x + radius / 2.3f - minusxy) + (w * croppedArea) / 2, (y + radius / 2 - minusxy) + (h * croppedArea) / 2, -90);
|
g.drawRotatedImage(ImageCache.croppedBorderImage(image), x + radius / 2.3f - minusxy, y + radius / 2 - minusxy, w * croppedArea, h * croppedArea, (x + radius / 2.3f - minusxy) + (w * croppedArea) / 2, (y + radius / 2 - minusxy) + (h * croppedArea) / 2, -90);
|
||||||
@@ -646,8 +642,8 @@ public class CardRenderer {
|
|||||||
g.drawRotatedImage(image, x, y, w, h, x + w / 2, y + h / 2, -90);
|
g.drawRotatedImage(image, x, y, w, h, x + w / 2, y + h / 2, -90);
|
||||||
} else {
|
} else {
|
||||||
if (Forge.enableUIMask.equals("Full") && canshow) {
|
if (Forge.enableUIMask.equals("Full") && canshow) {
|
||||||
if (ImageCache.isBorderlessCardArt(image))
|
if (image.toString().contains(".fullborder."))
|
||||||
g.drawCardImage(image, crack_overlay, x, y, w, h, card.wasDestroyed(), magnify ? false : card.getDamage() > 0);
|
g.drawCardRoundRect(image, crack_overlay, x, y, w, h, card.wasDestroyed(), magnify ? false : card.getDamage() > 0);
|
||||||
else {
|
else {
|
||||||
boolean t = (card.getCurrentState().getOriginalColors() != card.getCurrentState().getColors()) || card.getCurrentState().hasChangeColors();
|
boolean t = (card.getCurrentState().getOriginalColors() != card.getCurrentState().getColors()) || card.getCurrentState().hasChangeColors();
|
||||||
g.drawBorderImage(ImageCache.getBorderImage(image.toString(), canshow), ImageCache.borderColor(image), ImageCache.getTint(card, image), x, y, w, h, t); //tint check for changed colors
|
g.drawBorderImage(ImageCache.getBorderImage(image.toString(), canshow), ImageCache.borderColor(image), ImageCache.getTint(card, image), x, y, w, h, t); //tint check for changed colors
|
||||||
@@ -674,13 +670,18 @@ public class CardRenderer {
|
|||||||
public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos) {
|
public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos) {
|
||||||
drawCardWithOverlays(g, card, x, y, w, h, pos, false, false, false);
|
drawCardWithOverlays(g, card, x, y, w, h, pos, false, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float markersHeight = 0f;
|
static float markersHeight = 0f;
|
||||||
|
|
||||||
public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos, boolean stackview, boolean showAltState, boolean isChoiceList) {
|
public static void drawCardWithOverlays(Graphics g, CardView card, float x, float y, float w, float h, CardStackPosition pos, boolean stackview, boolean showAltState, boolean isChoiceList) {
|
||||||
boolean canShow = MatchController.instance.mayView(card);
|
boolean canShow = MatchController.instance.mayView(card);
|
||||||
float oldAlpha = g.getfloatAlphaComposite();
|
float oldAlpha = g.getfloatAlphaComposite();
|
||||||
boolean unselectable = !MatchController.instance.isSelectable(card) && MatchController.instance.isSelecting();
|
boolean unselectable = !MatchController.instance.isSelectable(card) && MatchController.instance.isSelecting();
|
||||||
float cx, cy, cw, ch;
|
float cx, cy, cw, ch;
|
||||||
cx = x; cy = y; cw = w; ch = h;
|
cx = x;
|
||||||
|
cy = y;
|
||||||
|
cw = w;
|
||||||
|
ch = h;
|
||||||
drawCard(g, card, x, y, w, h, pos, false, showAltState, isChoiceList, false);
|
drawCard(g, card, x, y, w, h, pos, false, showAltState, isChoiceList, false);
|
||||||
|
|
||||||
float padding = w * PADDING_MULTIPLIER; //adjust for card border
|
float padding = w * PADDING_MULTIPLIER; //adjust for card border
|
||||||
@@ -700,7 +701,9 @@ public class CardRenderer {
|
|||||||
|
|
||||||
if (stackview)
|
if (stackview)
|
||||||
return; //override
|
return; //override
|
||||||
if (pos == CardStackPosition.BehindVert) { return; } //remaining rendering not needed if card is behind another card in a vertical stack
|
if (pos == CardStackPosition.BehindVert) {
|
||||||
|
return;
|
||||||
|
} //remaining rendering not needed if card is behind another card in a vertical stack
|
||||||
boolean onTop = (pos == CardStackPosition.Top);
|
boolean onTop = (pos == CardStackPosition.Top);
|
||||||
|
|
||||||
if (canShow && showCardIdOverlay(card)) {
|
if (canShow && showCardIdOverlay(card)) {
|
||||||
@@ -747,8 +750,7 @@ public class CardRenderer {
|
|||||||
|
|
||||||
if (card.isAttacking()) {
|
if (card.isAttacking()) {
|
||||||
CardFaceSymbols.drawSymbol("attack", g, combatXSymbols, ySymbols, otherSymbolsSize, otherSymbolsSize);
|
CardFaceSymbols.drawSymbol("attack", g, combatXSymbols, ySymbols, otherSymbolsSize, otherSymbolsSize);
|
||||||
}
|
} else if (card.isBlocking()) {
|
||||||
else if (card.isBlocking()) {
|
|
||||||
CardFaceSymbols.drawSymbol("defend", g, combatXSymbols, ySymbols, otherSymbolsSize, otherSymbolsSize);
|
CardFaceSymbols.drawSymbol("defend", g, combatXSymbols, ySymbols, otherSymbolsSize, otherSymbolsSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -782,7 +784,9 @@ public class CardRenderer {
|
|||||||
}
|
}
|
||||||
//Ability Icons
|
//Ability Icons
|
||||||
boolean onbattlefield = ZoneType.Battlefield.equals(card.getZone());
|
boolean onbattlefield = ZoneType.Battlefield.equals(card.getZone());
|
||||||
if (unselectable){ g.setAlphaComposite(0.6f); }
|
if (unselectable) {
|
||||||
|
g.setAlphaComposite(0.6f);
|
||||||
|
}
|
||||||
if (onbattlefield && onTop && showAbilityIcons(card)) {
|
if (onbattlefield && onTop && showAbilityIcons(card)) {
|
||||||
drawAbilityIcons(g, card, cx, cy, cw, cx + ((cw * 2) / 2.3f), cy, cw / 5.5f, cw / 5.7f);
|
drawAbilityIcons(g, card, cx, cy, cw, cx + ((cw * 2) / 2.3f), cy, cw / 5.5f, cw / 5.7f);
|
||||||
} else if (canShow && !onbattlefield && showAbilityIcons(card)) {
|
} else if (canShow && !onbattlefield && showAbilityIcons(card)) {
|
||||||
@@ -829,8 +833,7 @@ public class CardRenderer {
|
|||||||
drawManaCost(g, card.getCurrentState().getManaCost(), x - padding, y, w + 2 * padding, h, manaSymbolSize);
|
drawManaCost(g, card.getCurrentState().getManaCost(), x - padding, y, w + 2 * padding, h, manaSymbolSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
drawManaCost(g, showAltState ? card.getAlternateState().getManaCost() : card.getCurrentState().getManaCost(), x - padding, y, w + 2 * padding, h, manaSymbolSize);
|
drawManaCost(g, showAltState ? card.getAlternateState().getManaCost() : card.getCurrentState().getManaCost(), x - padding, y, w + 2 * padding, h, manaSymbolSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -865,50 +868,70 @@ public class CardRenderer {
|
|||||||
CardFaceSymbols.drawSymbol("doublestrike", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("doublestrike", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().hasFirstStrike()) {
|
||||||
else if (card.getCurrentState().hasFirstStrike()) {
|
|
||||||
CardFaceSymbols.drawSymbol("firststrike", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("firststrike", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasDeathtouch()) {
|
if (card.getCurrentState().hasDeathtouch()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
CardFaceSymbols.drawSymbol("deathtouch", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("deathtouch", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasIndestructible()) {
|
if (card.getCurrentState().hasIndestructible()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
CardFaceSymbols.drawSymbol("indestructible", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("indestructible", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasMenace()) {
|
if (card.getCurrentState().hasMenace()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
CardFaceSymbols.drawSymbol("menace", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("menace", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasFear()) {
|
if (card.getCurrentState().hasFear()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
CardFaceSymbols.drawSymbol("fear", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("fear", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasIntimidate()) {
|
if (card.getCurrentState().hasIntimidate()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
CardFaceSymbols.drawSymbol("intimidate", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("intimidate", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasShadow()) {
|
if (card.getCurrentState().hasShadow()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
CardFaceSymbols.drawSymbol("shadow", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("shadow", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasHorsemanship()) {
|
if (card.getCurrentState().hasHorsemanship()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
CardFaceSymbols.drawSymbol("horsemanship", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("horsemanship", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
@@ -919,7 +942,10 @@ public class CardRenderer {
|
|||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasHexproof()) {
|
if (card.getCurrentState().hasHexproof()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
if (!card.getCurrentState().getHexproofKey().isEmpty()) {
|
if (!card.getCurrentState().getHexproofKey().isEmpty()) {
|
||||||
String[] splitK = card.getCurrentState().getHexproofKey().split(":");
|
String[] splitK = card.getCurrentState().getHexproofKey().split(":");
|
||||||
List<String> listHK = Arrays.asList(splitK);
|
List<String> listHK = Arrays.asList(splitK);
|
||||||
@@ -963,138 +989,142 @@ public class CardRenderer {
|
|||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
|
} else if (card.getCurrentState().hasShroud()) {
|
||||||
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
}
|
}
|
||||||
else if (card.getCurrentState().hasShroud()) {
|
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
|
||||||
CardFaceSymbols.drawSymbol("shroud", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("shroud", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasVigilance()) {
|
if (card.getCurrentState().hasVigilance()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
CardFaceSymbols.drawSymbol("vigilance", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("vigilance", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasTrample()) {
|
if (card.getCurrentState().hasTrample()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
CardFaceSymbols.drawSymbol("trample", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("trample", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasReach()) {
|
if (card.getCurrentState().hasReach()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
CardFaceSymbols.drawSymbol("reach", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("reach", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasLifelink()) {
|
if (card.getCurrentState().hasLifelink()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
CardFaceSymbols.drawSymbol("lifelink", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("lifelink", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
if (card.getCurrentState().hasDefender()) {
|
if (card.getCurrentState().hasDefender()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
CardFaceSymbols.drawSymbol("defender", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("defender", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
//Protection Icons
|
//Protection Icons
|
||||||
if (!card.getCurrentState().getProtectionKey().isEmpty()) {
|
if (!card.getCurrentState().getProtectionKey().isEmpty()) {
|
||||||
if (abiCount > 5 ) { abiY = cy + (abiSpace * (abiCount - 6)); abiX = cx + ((cw*2)/1.92f); }
|
if (abiCount > 5) {
|
||||||
|
abiY = cy + (abiSpace * (abiCount - 6));
|
||||||
|
abiX = cx + ((cw * 2) / 1.92f);
|
||||||
|
}
|
||||||
if (card.getCurrentState().getProtectionKey().contains("everything") || card.getCurrentState().getProtectionKey().contains("allcolors")) {
|
if (card.getCurrentState().getProtectionKey().contains("everything") || card.getCurrentState().getProtectionKey().contains("allcolors")) {
|
||||||
CardFaceSymbols.drawSymbol("protectAll", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectAll", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().contains("coloredspells")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().contains("coloredspells")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectColoredSpells", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectColoredSpells", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("R")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("R")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectR", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectR", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("G")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("G")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectG", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectG", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("B")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("B")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectB", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectB", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("U")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("U")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectU", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectU", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("W")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("W")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectW", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectW", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("RG") || card.getCurrentState().getProtectionKey().equals("GR")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("RG")||card.getCurrentState().getProtectionKey().equals("GR")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectRG", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectRG", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("RB") || card.getCurrentState().getProtectionKey().equals("BR")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("RB")||card.getCurrentState().getProtectionKey().equals("BR")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectRB", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectRB", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("RU") || card.getCurrentState().getProtectionKey().equals("UR")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("RU")||card.getCurrentState().getProtectionKey().equals("UR")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectRU", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectRU", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("RW") || card.getCurrentState().getProtectionKey().equals("WR")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("RW")||card.getCurrentState().getProtectionKey().equals("WR")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectRW", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectRW", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("GB") || card.getCurrentState().getProtectionKey().equals("BG")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("GB")||card.getCurrentState().getProtectionKey().equals("BG")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectGB", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectGB", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("GU") || card.getCurrentState().getProtectionKey().equals("UG")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("GU")||card.getCurrentState().getProtectionKey().equals("UG")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectGU", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectGU", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("GW") || card.getCurrentState().getProtectionKey().equals("WG")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("GW")||card.getCurrentState().getProtectionKey().equals("WG")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectGW", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectGW", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("BU") || card.getCurrentState().getProtectionKey().equals("UB")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("BU")||card.getCurrentState().getProtectionKey().equals("UB")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectBU", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectBU", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("BW") || card.getCurrentState().getProtectionKey().equals("WB")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("BW")||card.getCurrentState().getProtectionKey().equals("WB")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectBW", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectBW", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().equals("UW") || card.getCurrentState().getProtectionKey().equals("WU")) {
|
||||||
else if (card.getCurrentState().getProtectionKey().equals("UW")||card.getCurrentState().getProtectionKey().equals("WU")) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectUW", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectUW", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
} else if (card.getCurrentState().getProtectionKey().contains("generic") || card.getCurrentState().getProtectionKey().length() > 2) {
|
||||||
else if (card.getCurrentState().getProtectionKey().contains("generic") || card.getCurrentState().getProtectionKey().length() > 2) {
|
|
||||||
CardFaceSymbols.drawSymbol("protectGeneric", g, abiX, abiY, abiScale, abiScale);
|
CardFaceSymbols.drawSymbol("protectGeneric", g, abiX, abiY, abiScale, abiScale);
|
||||||
abiY += abiSpace;
|
abiY += abiSpace;
|
||||||
abiCount += 1;
|
abiCount += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void drawCounterTabs(final CardView card, final Graphics g, final float x, final float y, final float w, final float h) {
|
private static void drawCounterTabs(final CardView card, final Graphics g, final float x, final float y, final float w, final float h) {
|
||||||
|
|
||||||
int fontSize = Math.max(11, Math.min(22, (int) (h * 0.08)));
|
int fontSize = Math.max(11, Math.min(22, (int) (h * 0.08)));
|
||||||
@@ -1199,14 +1229,11 @@ public class CardRenderer {
|
|||||||
|
|
||||||
if (counters == 1) {
|
if (counters == 1) {
|
||||||
CardFaceSymbols.drawSymbol("counters1", g, xCounters, yCounters, countersSize, countersSize);
|
CardFaceSymbols.drawSymbol("counters1", g, xCounters, yCounters, countersSize, countersSize);
|
||||||
}
|
} else if (counters == 2) {
|
||||||
else if (counters == 2) {
|
|
||||||
CardFaceSymbols.drawSymbol("counters2", g, xCounters, yCounters, countersSize, countersSize);
|
CardFaceSymbols.drawSymbol("counters2", g, xCounters, yCounters, countersSize, countersSize);
|
||||||
}
|
} else if (counters == 3) {
|
||||||
else if (counters == 3) {
|
|
||||||
CardFaceSymbols.drawSymbol("counters3", g, xCounters, yCounters, countersSize, countersSize);
|
CardFaceSymbols.drawSymbol("counters3", g, xCounters, yCounters, countersSize, countersSize);
|
||||||
}
|
} else if (counters > 3) {
|
||||||
else if (counters > 3) {
|
|
||||||
CardFaceSymbols.drawSymbol("countersMulti", g, xCounters, yCounters, countersSize, countersSize);
|
CardFaceSymbols.drawSymbol("countersMulti", g, xCounters, yCounters, countersSize, countersSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1254,8 +1281,7 @@ public class CardRenderer {
|
|||||||
pieces.add(String.valueOf(details.getPower()));
|
pieces.add(String.valueOf(details.getPower()));
|
||||||
pieces.add("/");
|
pieces.add("/");
|
||||||
pieces.add(String.valueOf(details.getToughness()));
|
pieces.add(String.valueOf(details.getToughness()));
|
||||||
}
|
} else if (details.getType().hasSubtype("Vehicle")) {
|
||||||
else if (details.getType().hasSubtype("Vehicle")) {
|
|
||||||
pieces.add("[");
|
pieces.add("[");
|
||||||
pieces.add(String.valueOf(details.getPower()));
|
pieces.add(String.valueOf(details.getPower()));
|
||||||
pieces.add("/");
|
pieces.add("/");
|
||||||
@@ -1265,13 +1291,14 @@ public class CardRenderer {
|
|||||||
if (details.isPlaneswalker()) {
|
if (details.isPlaneswalker()) {
|
||||||
if (pieces.isEmpty()) {
|
if (pieces.isEmpty()) {
|
||||||
pieces.add(String.valueOf(details.getLoyalty()));
|
pieces.add(String.valueOf(details.getLoyalty()));
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
pieces.add("(" + details.getLoyalty() + ")");
|
pieces.add("(" + details.getLoyalty() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pieces.isEmpty()) { return; }
|
if (pieces.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FSkinFont font = FSkinFont.forHeight(h * 0.15f);
|
FSkinFont font = FSkinFont.forHeight(h * 0.15f);
|
||||||
float padding = Math.round(font.getCapHeight() / 4);
|
float padding = Math.round(font.getCapHeight() / 4);
|
||||||
@@ -1314,7 +1341,11 @@ public class CardRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void drawFoilEffect(Graphics g, CardView card, float x, float y, float w, float h, boolean inZoomer) {
|
public static void drawFoilEffect(Graphics g, CardView card, float x, float y, float w, float h, boolean inZoomer) {
|
||||||
float new_x = x; float new_y = y; float new_w = w; float new_h = h; float radius = (h - w)/8;
|
float new_x = x;
|
||||||
|
float new_y = y;
|
||||||
|
float new_w = w;
|
||||||
|
float new_h = h;
|
||||||
|
float radius = (h - w) / 8;
|
||||||
float croppedArea = isModernFrame(card) ? CROP_MULTIPLIER : 0.97f;
|
float croppedArea = isModernFrame(card) ? CROP_MULTIPLIER : 0.97f;
|
||||||
float minusxy = isModernFrame(card) ? 0.0f : 0.13f * radius;
|
float minusxy = isModernFrame(card) ? 0.0f : 0.13f * radius;
|
||||||
if (card.getCurrentState().getSetCode().equals("LEA") || card.getCurrentState().getSetCode().equals("LEB")) {
|
if (card.getCurrentState().getSetCode().equals("LEA") || card.getCurrentState().getSetCode().equals("LEB")) {
|
||||||
@@ -1322,7 +1353,10 @@ public class CardRenderer {
|
|||||||
minusxy = 0.135f * radius;
|
minusxy = 0.135f * radius;
|
||||||
}
|
}
|
||||||
if (Forge.enableUIMask.equals("Full")) {
|
if (Forge.enableUIMask.equals("Full")) {
|
||||||
new_x += radius/2.4f-minusxy; new_y += radius/2-minusxy; new_w = w * croppedArea; new_h = h * croppedArea;
|
new_x += radius / 2.4f - minusxy;
|
||||||
|
new_y += radius / 2 - minusxy;
|
||||||
|
new_w = w * croppedArea;
|
||||||
|
new_h = h * croppedArea;
|
||||||
}
|
}
|
||||||
if (isPreferenceEnabled(FPref.UI_OVERLAY_FOIL_EFFECT) && MatchController.instance.mayView(card)) {
|
if (isPreferenceEnabled(FPref.UI_OVERLAY_FOIL_EFFECT) && MatchController.instance.mayView(card)) {
|
||||||
boolean rotateSplit = isPreferenceEnabled(FPref.UI_ROTATE_SPLIT_CARDS) && card.isSplitCard() && inZoomer;
|
boolean rotateSplit = isPreferenceEnabled(FPref.UI_ROTATE_SPLIT_CARDS) && card.isSplitCard() && inZoomer;
|
||||||
@@ -1367,7 +1401,9 @@ public class CardRenderer {
|
|||||||
|
|
||||||
FileHandle ttfFile = Gdx.files.absolute(ForgeConstants.COMMON_FONTS_DIR).child("Roboto-Bold.ttf");
|
FileHandle ttfFile = Gdx.files.absolute(ForgeConstants.COMMON_FONTS_DIR).child("Roboto-Bold.ttf");
|
||||||
|
|
||||||
if (!ttfFile.exists()) { return; }
|
if (!ttfFile.exists()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final FreeTypeFontGenerator generator = new FreeTypeFontGenerator(ttfFile);
|
final FreeTypeFontGenerator generator = new FreeTypeFontGenerator(ttfFile);
|
||||||
|
|
||||||
|
|||||||
@@ -53,15 +53,18 @@ public class CardZoom extends FOverlay {
|
|||||||
public static void show(Object item) {
|
public static void show(Object item) {
|
||||||
show(item, false);
|
show(item, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void show(Object item, boolean showbackside) {
|
public static void show(Object item, boolean showbackside) {
|
||||||
List<Object> items0 = new ArrayList<>();
|
List<Object> items0 = new ArrayList<>();
|
||||||
items0.add(item);
|
items0.add(item);
|
||||||
showBackSide = showbackside; //reverse the displayed zoomed card for the choice list
|
showBackSide = showbackside; //reverse the displayed zoomed card for the choice list
|
||||||
show(items0, 0, null);
|
show(items0, 0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void show(FCollectionView<?> items0, int currentIndex0, ActivateHandler activateHandler0) {
|
public static void show(FCollectionView<?> items0, int currentIndex0, ActivateHandler activateHandler0) {
|
||||||
show((List<?>) items0, currentIndex0, activateHandler0);
|
show((List<?>) items0, currentIndex0, activateHandler0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void show(final List<?> items0, int currentIndex0, ActivateHandler activateHandler0) {
|
public static void show(final List<?> items0, int currentIndex0, ActivateHandler activateHandler0) {
|
||||||
items = items0;
|
items = items0;
|
||||||
activateHandler = activateHandler0;
|
activateHandler = activateHandler0;
|
||||||
@@ -89,7 +92,9 @@ public class CardZoom extends FOverlay {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVisible(boolean visible0) {
|
public void setVisible(boolean visible0) {
|
||||||
if (this.isVisible() == visible0) { return; }
|
if (this.isVisible() == visible0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
super.setVisible(visible0);
|
super.setVisible(visible0);
|
||||||
|
|
||||||
@@ -101,7 +106,9 @@ public class CardZoom extends FOverlay {
|
|||||||
|
|
||||||
private static void incrementCard(int dir) {
|
private static void incrementCard(int dir) {
|
||||||
if (dir > 0) {
|
if (dir > 0) {
|
||||||
if (currentIndex == items.size() - 1) { return; }
|
if (currentIndex == items.size() - 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
currentIndex++;
|
currentIndex++;
|
||||||
|
|
||||||
prevCard = currentCard;
|
prevCard = currentCard;
|
||||||
@@ -226,7 +233,9 @@ public class CardZoom extends FOverlay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setOneCardView(boolean oneCardView0) {
|
private void setOneCardView(boolean oneCardView0) {
|
||||||
if (oneCardView == oneCardView0 || Forge.isLandscapeMode()) { return; } //don't allow changing this when in landscape mode
|
if (oneCardView == oneCardView0 || Forge.isLandscapeMode()) {
|
||||||
|
return;
|
||||||
|
} //don't allow changing this when in landscape mode
|
||||||
|
|
||||||
oneCardView = oneCardView0;
|
oneCardView = oneCardView0;
|
||||||
prefs.setPref(FPref.UI_SINGLE_CARD_ZOOM, oneCardView0);
|
prefs.setPref(FPref.UI_SINGLE_CARD_ZOOM, oneCardView0);
|
||||||
@@ -240,8 +249,7 @@ public class CardZoom extends FOverlay {
|
|||||||
if (totalZoomAmount >= REQ_AMOUNT) {
|
if (totalZoomAmount >= REQ_AMOUNT) {
|
||||||
setOneCardView(true);
|
setOneCardView(true);
|
||||||
totalZoomAmount = 0;
|
totalZoomAmount = 0;
|
||||||
}
|
} else if (totalZoomAmount <= -REQ_AMOUNT) {
|
||||||
else if (totalZoomAmount <= -REQ_AMOUNT) {
|
|
||||||
setOneCardView(false);
|
setOneCardView(false);
|
||||||
totalZoomAmount = 0;
|
totalZoomAmount = 0;
|
||||||
}
|
}
|
||||||
@@ -288,14 +296,12 @@ public class CardZoom extends FOverlay {
|
|||||||
boolean rotateSplit = FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ROTATE_SPLIT_CARDS);
|
boolean rotateSplit = FModel.getPreferences().getPrefBoolean(ForgePreferences.FPref.UI_ROTATE_SPLIT_CARDS);
|
||||||
if (currentCard != null && currentCard.isSplitCard() && rotateSplit) {
|
if (currentCard != null && currentCard.isSplitCard() && rotateSplit) {
|
||||||
// card will be rotated. Make sure that the height does not exceed the width of the view
|
// card will be rotated. Make sure that the height does not exceed the width of the view
|
||||||
if (cardHeight > Gdx.graphics.getWidth())
|
if (cardHeight > Gdx.graphics.getWidth()) {
|
||||||
{
|
|
||||||
cardHeight = Gdx.graphics.getWidth();
|
cardHeight = Gdx.graphics.getWidth();
|
||||||
cardWidth = cardHeight / FCardPanel.ASPECT_RATIO;
|
cardWidth = cardHeight / FCardPanel.ASPECT_RATIO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
cardWidth = w * 0.5f;
|
cardWidth = w * 0.5f;
|
||||||
cardHeight = FCardPanel.ASPECT_RATIO * cardWidth;
|
cardHeight = FCardPanel.ASPECT_RATIO * cardWidth;
|
||||||
@@ -370,7 +376,9 @@ public class CardZoom extends FOverlay {
|
|||||||
|
|
||||||
public interface ActivateHandler {
|
public interface ActivateHandler {
|
||||||
String getActivateAction(int index);
|
String getActivateAction(int index);
|
||||||
|
|
||||||
void setSelectedIndex(int index);
|
void setSelectedIndex(int index);
|
||||||
|
|
||||||
void activate(int index);
|
void activate(int index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,8 +411,7 @@ public class CardZoom extends FOverlay {
|
|||||||
if (flipIconBounds != null) {
|
if (flipIconBounds != null) {
|
||||||
tap(flipIconBounds.x, flipIconBounds.y, 1);
|
tap(flipIconBounds.x, flipIconBounds.y, 1);
|
||||||
}
|
}
|
||||||
}
|
} else if (keyCode == Input.Keys.BUTTON_Y)
|
||||||
else if (keyCode == Input.Keys.BUTTON_Y)
|
|
||||||
fling(0, 300f);
|
fling(0, 300f);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,14 +40,17 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
private static final float PADDING = Utils.scale(5);
|
private static final float PADDING = Utils.scale(5);
|
||||||
private static final float PILE_SPACING_Y = 0.1f;
|
private static final float PILE_SPACING_Y = 0.1f;
|
||||||
private static final FSkinFont LABEL_FONT = FSkinFont.get(12);
|
private static final FSkinFont LABEL_FONT = FSkinFont.get(12);
|
||||||
|
|
||||||
private static FSkinColor getGroupHeaderForeColor() {
|
private static FSkinColor getGroupHeaderForeColor() {
|
||||||
if (Forge.isMobileAdventureMode)
|
if (Forge.isMobileAdventureMode)
|
||||||
return FSkinColor.get(Colors.ADV_CLR_TEXT);
|
return FSkinColor.get(Colors.ADV_CLR_TEXT);
|
||||||
return FSkinColor.get(Colors.CLR_TEXT);
|
return FSkinColor.get(Colors.CLR_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FSkinColor getGroupHeaderLineColor() {
|
private static FSkinColor getGroupHeaderLineColor() {
|
||||||
return getGroupHeaderForeColor().alphaColor(0.5f);
|
return getGroupHeaderForeColor().alphaColor(0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final FSkinFont GROUP_HEADER_FONT = LABEL_FONT;
|
private static final FSkinFont GROUP_HEADER_FONT = LABEL_FONT;
|
||||||
private static final float GROUP_HEADER_HEIGHT = Utils.scale(19);
|
private static final float GROUP_HEADER_HEIGHT = Utils.scale(19);
|
||||||
private static final float GROUP_HEADER_GLYPH_WIDTH = Utils.scale(6);
|
private static final float GROUP_HEADER_GLYPH_WIDTH = Utils.scale(6);
|
||||||
@@ -73,7 +76,9 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
private ExpandCollapseButton() {
|
private ExpandCollapseButton() {
|
||||||
super(new FLabel.ButtonBuilder());
|
super(new FLabel.ButtonBuilder());
|
||||||
setCommand(e -> {
|
setCommand(e -> {
|
||||||
if (groupBy == null || model.getItems().isEmpty()) { return; }
|
if (groupBy == null || model.getItems().isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean collapsed = !isAllCollapsed;
|
boolean collapsed = !isAllCollapsed;
|
||||||
for (Group group : groups) {
|
for (Group group : groups) {
|
||||||
@@ -109,8 +114,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
float y = Math.round((h - squareSize) / 2 - offset);
|
float y = Math.round((h - squareSize) / 2 - offset);
|
||||||
if (pressed) {
|
if (pressed) {
|
||||||
y += lineThickness;
|
y += lineThickness;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
x -= lineThickness;
|
x -= lineThickness;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,6 +136,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ExpandCollapseButton btnExpandCollapseAll = new ExpandCollapseButton();
|
private final ExpandCollapseButton btnExpandCollapseAll = new ExpandCollapseButton();
|
||||||
private final FComboBox<Object> cbGroupByOptions = new FComboBox<>(Forge.getLocalizer().getMessage("lblGroups") + " ");
|
private final FComboBox<Object> cbGroupByOptions = new FComboBox<>(Forge.getLocalizer().getMessage("lblGroups") + " ");
|
||||||
private final FComboBox<Object> cbPileByOptions = new FComboBox<>(Forge.getLocalizer().getMessage("lblPiles") + " ");
|
private final FComboBox<Object> cbPileByOptions = new FComboBox<>(Forge.getLocalizer().getMessage("lblPiles") + " ");
|
||||||
@@ -144,16 +149,14 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
cbGroupByOptions.setChangedHandler(e -> {
|
cbGroupByOptions.setChangedHandler(e -> {
|
||||||
if (cbGroupByOptions.getSelectedIndex() > 0) {
|
if (cbGroupByOptions.getSelectedIndex() > 0) {
|
||||||
setGroupBy((GroupDef) cbGroupByOptions.getSelectedItem());
|
setGroupBy((GroupDef) cbGroupByOptions.getSelectedItem());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setGroupBy(null);
|
setGroupBy(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cbPileByOptions.setChangedHandler(e -> {
|
cbPileByOptions.setChangedHandler(e -> {
|
||||||
if (cbPileByOptions.getSelectedIndex() > 0) {
|
if (cbPileByOptions.getSelectedIndex() > 0) {
|
||||||
setPileBy((ColumnDef) cbPileByOptions.getSelectedItem());
|
setPileBy((ColumnDef) cbPileByOptions.getSelectedItem());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
setPileBy(null);
|
setPileBy(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -179,17 +182,20 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
public GroupDef getGroupBy() {
|
public GroupDef getGroupBy() {
|
||||||
return groupBy;
|
return groupBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGroupBy(GroupDef groupBy0) {
|
public void setGroupBy(GroupDef groupBy0) {
|
||||||
setGroupBy(groupBy0, false);
|
setGroupBy(groupBy0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setGroupBy(GroupDef groupBy0, boolean forSetup) {
|
private void setGroupBy(GroupDef groupBy0, boolean forSetup) {
|
||||||
if (groupBy == groupBy0) { return; }
|
if (groupBy == groupBy0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
groupBy = groupBy0;
|
groupBy = groupBy0;
|
||||||
|
|
||||||
if (groupBy == null) {
|
if (groupBy == null) {
|
||||||
cbGroupByOptions.setSelectedIndex(0);
|
cbGroupByOptions.setSelectedIndex(0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
cbGroupByOptions.setSelectedItem(groupBy);
|
cbGroupByOptions.setSelectedItem(groupBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,8 +204,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
if (groupBy == null) {
|
if (groupBy == null) {
|
||||||
groups.add(new Group(""));
|
groups.add(new Group(""));
|
||||||
btnExpandCollapseAll.updateIsAllCollapsed();
|
btnExpandCollapseAll.updateIsAllCollapsed();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
for (String groupName : groupBy.getGroups()) {
|
for (String groupName : groupBy.getGroups()) {
|
||||||
groups.add(new Group(groupName));
|
groups.add(new Group(groupName));
|
||||||
}
|
}
|
||||||
@@ -228,17 +233,20 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
public ColumnDef getPileBy() {
|
public ColumnDef getPileBy() {
|
||||||
return pileBy;
|
return pileBy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPileBy(ColumnDef pileBy0) {
|
public void setPileBy(ColumnDef pileBy0) {
|
||||||
setPileBy(pileBy0, false);
|
setPileBy(pileBy0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setPileBy(ColumnDef pileBy0, boolean forSetup) {
|
private void setPileBy(ColumnDef pileBy0, boolean forSetup) {
|
||||||
if (pileBy == pileBy0) { return; }
|
if (pileBy == pileBy0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
pileBy = pileBy0;
|
pileBy = pileBy0;
|
||||||
|
|
||||||
if (pileBy == null) {
|
if (pileBy == null) {
|
||||||
cbPileByOptions.setSelectedIndex(0);
|
cbPileByOptions.setSelectedIndex(0);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
cbPileByOptions.setSelectedItem(pileBy);
|
cbPileByOptions.setSelectedItem(pileBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,14 +271,16 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
public void setColumnCount(int columnCount0) {
|
public void setColumnCount(int columnCount0) {
|
||||||
setColumnCount(columnCount0, false);
|
setColumnCount(columnCount0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setColumnCount(int columnCount0, boolean forSetup) {
|
private void setColumnCount(int columnCount0, boolean forSetup) {
|
||||||
if (columnCount0 < MIN_COLUMN_COUNT) {
|
if (columnCount0 < MIN_COLUMN_COUNT) {
|
||||||
columnCount0 = MIN_COLUMN_COUNT;
|
columnCount0 = MIN_COLUMN_COUNT;
|
||||||
}
|
} else if (columnCount0 > MAX_COLUMN_COUNT) {
|
||||||
else if (columnCount0 > MAX_COLUMN_COUNT) {
|
|
||||||
columnCount0 = MAX_COLUMN_COUNT;
|
columnCount0 = MAX_COLUMN_COUNT;
|
||||||
}
|
}
|
||||||
if (columnCount == columnCount0) { return; }
|
if (columnCount == columnCount0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
columnCount = columnCount0;
|
columnCount = columnCount0;
|
||||||
|
|
||||||
if (!forSetup) {
|
if (!forSetup) {
|
||||||
@@ -342,14 +352,12 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
Group group;
|
Group group;
|
||||||
if (groupIndex >= 0) {
|
if (groupIndex >= 0) {
|
||||||
group = groups.get(groupIndex);
|
group = groups.get(groupIndex);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (otherItems == null) {
|
if (otherItems == null) {
|
||||||
//reuse existing Other group if possible
|
//reuse existing Other group if possible
|
||||||
if (groups.size() > groupBy.getGroups().length) {
|
if (groups.size() > groupBy.getGroups().length) {
|
||||||
otherItems = groups.get(groups.size() - 1);
|
otherItems = groups.get(groups.size() - 1);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
otherItems = new Group(Forge.getLocalizer().getMessage("lblOther"));
|
otherItems = new Group(Forge.getLocalizer().getMessage("lblOther"));
|
||||||
otherItems.isCollapsed = btnExpandCollapseAll.isAllCollapsed;
|
otherItems.isCollapsed = btnExpandCollapseAll.isAllCollapsed;
|
||||||
groups.add(otherItems);
|
groups.add(otherItems);
|
||||||
@@ -389,7 +397,9 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateLayout(boolean forRefresh) {
|
private void updateLayout(boolean forRefresh) {
|
||||||
if (updatingLayout) { return; } //prevent infinite loop
|
if (updatingLayout) {
|
||||||
|
return;
|
||||||
|
} //prevent infinite loop
|
||||||
updatingLayout = true;
|
updatingLayout = true;
|
||||||
|
|
||||||
focalItem = null; //clear cached focalItem when layout changes
|
focalItem = null; //clear cached focalItem when layout changes
|
||||||
@@ -471,8 +481,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
}
|
}
|
||||||
y += itemHeight;
|
y += itemHeight;
|
||||||
group.scrollWidth = groupWidth;
|
group.scrollWidth = groupWidth;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
x = 0;
|
x = 0;
|
||||||
pileY = y;
|
pileY = y;
|
||||||
maxPileHeight = 0;
|
maxPileHeight = 0;
|
||||||
@@ -505,7 +514,9 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
orderedItems.clear();
|
orderedItems.clear();
|
||||||
for (Group group : groups) {
|
for (Group group : groups) {
|
||||||
if (group.isCollapsed || group.items.isEmpty()) { continue; }
|
if (group.isCollapsed || group.items.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (Pile pile : group.piles) {
|
for (Pile pile : group.piles) {
|
||||||
for (ItemInfo itemInfo : pile.items) {
|
for (ItemInfo itemInfo : pile.items) {
|
||||||
@@ -736,9 +747,13 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scrollSelectionIntoView() {
|
public void scrollSelectionIntoView() {
|
||||||
if (selectedIndices.isEmpty()) { return; }
|
if (selectedIndices.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int index = selectedIndices.get(0);
|
int index = selectedIndices.get(0);
|
||||||
if(index<0||orderedItems.size()<=index) { return ; }
|
if (index < 0 || orderedItems.size() <= index) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ItemInfo itemInfo = orderedItems.get(index);
|
ItemInfo itemInfo = orderedItems.get(index);
|
||||||
getScroller().scrollIntoView(itemInfo);
|
getScroller().scrollIntoView(itemInfo);
|
||||||
@@ -746,10 +761,14 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Rectangle getSelectionBounds() {
|
public Rectangle getSelectionBounds() {
|
||||||
if (selectedIndices.isEmpty()) { return new Rectangle(); }
|
if (selectedIndices.isEmpty()) {
|
||||||
|
return new Rectangle();
|
||||||
|
}
|
||||||
|
|
||||||
int index = selectedIndices.get(0);
|
int index = selectedIndices.get(0);
|
||||||
if(index<0||orderedItems.size()<=index) { return new Rectangle(); }
|
if (index < 0 || orderedItems.size() <= index) {
|
||||||
|
return new Rectangle();
|
||||||
|
}
|
||||||
ItemInfo itemInfo = orderedItems.get(index);
|
ItemInfo itemInfo = orderedItems.get(index);
|
||||||
Vector2 relPos = itemInfo.group.getChildRelativePosition(itemInfo);
|
Vector2 relPos = itemInfo.group.getChildRelativePosition(itemInfo);
|
||||||
return new Rectangle(itemInfo.group.screenPos.x + relPos.x - SEL_BORDER_SIZE + itemInfo.group.getLeft(),
|
return new Rectangle(itemInfo.group.screenPos.x + relPos.x - SEL_BORDER_SIZE + itemInfo.group.getLeft(),
|
||||||
@@ -759,9 +778,13 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void zoomSelected() {
|
public void zoomSelected() {
|
||||||
if (selectedIndices.isEmpty()) { return; }
|
if (selectedIndices.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int index = selectedIndices.get(0);
|
int index = selectedIndices.get(0);
|
||||||
if(index<0||orderedItems.size()<=index) { return ; }
|
if (index < 0 || orderedItems.size() <= index) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ItemInfo itemInfo = orderedItems.get(index);
|
ItemInfo itemInfo = orderedItems.get(index);
|
||||||
if (itemInfo != null) {
|
if (itemInfo != null) {
|
||||||
@@ -795,7 +818,9 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics g) {
|
public void draw(Graphics g) {
|
||||||
if (items.isEmpty()) { return; }
|
if (items.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (groupBy != null) {
|
if (groupBy != null) {
|
||||||
//draw group name and horizontal line
|
//draw group name and horizontal line
|
||||||
@@ -816,15 +841,16 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
x, y - offset,
|
x, y - offset,
|
||||||
x + offset, y,
|
x + offset, y,
|
||||||
x, y + offset);
|
x, y + offset);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
g.fillTriangle(getGroupHeaderLineColor(),
|
g.fillTriangle(getGroupHeaderLineColor(),
|
||||||
x - offset + 2, y + offset - 1,
|
x - offset + 2, y + offset - 1,
|
||||||
x + offset, y + offset - 1,
|
x + offset, y + offset - 1,
|
||||||
x + offset, y - offset + 1);
|
x + offset, y - offset + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCollapsed) { return; }
|
if (isCollapsed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
float visibleLeft = getScrollLeft();
|
float visibleLeft = getScrollLeft();
|
||||||
float visibleRight = visibleLeft + getWidth();
|
float visibleRight = visibleLeft + getWidth();
|
||||||
@@ -906,6 +932,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
return new Vector2(child.getLeft() - getScrollLeft() + offsetX - getLeft(), child.getTop() - getScrollValue() + offsetY - getTop());
|
return new Vector2(child.getLeft() - getScrollLeft() + offsetX - getLeft(), child.getTop() - getScrollValue() + offsetY - getTop());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Pile extends FDisplayObject {
|
private class Pile extends FDisplayObject {
|
||||||
private final List<ItemInfo> items = new ArrayList<>();
|
private final List<ItemInfo> items = new ArrayList<>();
|
||||||
|
|
||||||
@@ -924,8 +951,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
}
|
}
|
||||||
if (itemInfo.selected) {
|
if (itemInfo.selected) {
|
||||||
skippedItem = itemInfo;
|
skippedItem = itemInfo;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
itemInfo.draw(g);
|
itemInfo.draw(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -937,6 +963,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ItemInfo extends FDisplayObject implements Entry<InventoryItem, Integer> {
|
private class ItemInfo extends FDisplayObject implements Entry<InventoryItem, Integer> {
|
||||||
private final T item;
|
private final T item;
|
||||||
private final Group group;
|
private final Group group;
|
||||||
@@ -990,8 +1017,7 @@ public class ImageView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
g.fillRoundRect(Color.GREEN, x - SEL_BORDER_SIZE, y - SEL_BORDER_SIZE, w + 2 * SEL_BORDER_SIZE, h + 2 * SEL_BORDER_SIZE, (h - w) / 10);
|
g.fillRoundRect(Color.GREEN, x - SEL_BORDER_SIZE, y - SEL_BORDER_SIZE, w + 2 * SEL_BORDER_SIZE, h + 2 * SEL_BORDER_SIZE, (h - w) / 10);
|
||||||
//drawroundrect has GL_SMOOTH to `smoothen/faux` the aliased corner
|
//drawroundrect has GL_SMOOTH to `smoothen/faux` the aliased corner
|
||||||
g.drawRoundRect(1f, Color.GREEN, x - SEL_BORDER_SIZE, y - SEL_BORDER_SIZE, w + 1.5f * SEL_BORDER_SIZE, h + 1.5f * SEL_BORDER_SIZE, (h - w) / 10);
|
g.drawRoundRect(1f, Color.GREEN, x - SEL_BORDER_SIZE, y - SEL_BORDER_SIZE, w + 1.5f * SEL_BORDER_SIZE, h + 1.5f * SEL_BORDER_SIZE, (h - w) / 10);
|
||||||
}
|
} else //default rectangle highlight
|
||||||
else //default rectangle highlight
|
|
||||||
g.fillRect(Color.GREEN, x - SEL_BORDER_SIZE, y - SEL_BORDER_SIZE, w + 2 * SEL_BORDER_SIZE, h + 2 * SEL_BORDER_SIZE);
|
g.fillRect(Color.GREEN, x - SEL_BORDER_SIZE, y - SEL_BORDER_SIZE, w + 2 * SEL_BORDER_SIZE, h + 2 * SEL_BORDER_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
public FCardPanel() {
|
public FCardPanel() {
|
||||||
this(null);
|
this(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FCardPanel(CardView card0) {
|
public FCardPanel(CardView card0) {
|
||||||
card = card0;
|
card = card0;
|
||||||
tapAnimation = new CardTapAnimation();
|
tapAnimation = new CardTapAnimation();
|
||||||
@@ -43,6 +44,7 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
public CardView getCard() {
|
public CardView getCard() {
|
||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCard(CardView card0) {
|
public void setCard(CardView card0) {
|
||||||
card = card0;
|
card = card0;
|
||||||
}
|
}
|
||||||
@@ -50,6 +52,7 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
public boolean isHighlighted() {
|
public boolean isHighlighted() {
|
||||||
return highlighted;
|
return highlighted;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHighlighted(boolean highlighted0) {
|
public void setHighlighted(boolean highlighted0) {
|
||||||
highlighted = highlighted0;
|
highlighted = highlighted0;
|
||||||
}
|
}
|
||||||
@@ -57,6 +60,7 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
public boolean isTapped() {
|
public boolean isTapped() {
|
||||||
return tapped;
|
return tapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTapped(final boolean tapped0) {
|
public void setTapped(final boolean tapped0) {
|
||||||
tapped = tapped0;
|
tapped = tapped0;
|
||||||
}
|
}
|
||||||
@@ -95,7 +99,9 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Graphics g) {
|
public void draw(Graphics g) {
|
||||||
if (card == null) { return; }
|
if (card == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
boolean animate = Forge.animatedCardTapUntap;
|
boolean animate = Forge.animatedCardTapUntap;
|
||||||
float mod = (isHighlighted() || isHovered()) && !Forge.hasGamepad() ? getWidth() / 16f : 0f;
|
float mod = (isHighlighted() || isHovered()) && !Forge.hasGamepad() ? getWidth() / 16f : 0f;
|
||||||
float padding = getPadding();
|
float padding = getPadding();
|
||||||
@@ -152,6 +158,7 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void rotateTransform(Graphics g, float x, float y, float w, float h, float edgeOffset, boolean animate) {
|
private void rotateTransform(Graphics g, float x, float y, float w, float h, float edgeOffset, boolean animate) {
|
||||||
if (tapped) {
|
if (tapped) {
|
||||||
g.startRotateTransform(x + edgeOffset, y + h - edgeOffset, getTappedAngle());
|
g.startRotateTransform(x + edgeOffset, y + h - edgeOffset, getTappedAngle());
|
||||||
@@ -168,10 +175,12 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
g.endTransform();
|
g.endTransform();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CardDestroyedAnimation extends ForgeAnimation {
|
private class CardDestroyedAnimation extends ForgeAnimation {
|
||||||
private static final float DURATION = 0.6f;
|
private static final float DURATION = 0.6f;
|
||||||
private float progress = 0;
|
private float progress = 0;
|
||||||
private Texture splatter = FSkin.splatter;
|
private Texture splatter = FSkin.splatter;
|
||||||
|
|
||||||
private void drawCard(Graphics g, CardView card, float x, float y, float w, float h, float edgeOffset) {
|
private void drawCard(Graphics g, CardView card, float x, float y, float w, float h, float edgeOffset) {
|
||||||
float percentage = progress / DURATION;
|
float percentage = progress / DURATION;
|
||||||
if (percentage < 0) {
|
if (percentage < 0) {
|
||||||
@@ -195,15 +204,18 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
g.endTransform();
|
g.endTransform();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean advance(float dt) {
|
protected boolean advance(float dt) {
|
||||||
progress += dt;
|
progress += dt;
|
||||||
return progress < DURATION;
|
return progress < DURATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEnd(boolean endingAll) {
|
protected void onEnd(boolean endingAll) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CardTransformAnimation extends ForgeAnimation {
|
private class CardTransformAnimation extends ForgeAnimation {
|
||||||
private float DURATION = 0.18f;
|
private float DURATION = 0.18f;
|
||||||
private float progress = 0;
|
private float progress = 0;
|
||||||
@@ -246,19 +258,23 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean advance(float dt) {
|
protected boolean advance(float dt) {
|
||||||
progress += dt;
|
progress += dt;
|
||||||
return progress < DURATION;
|
return progress < DURATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEnd(boolean endingAll) {
|
protected void onEnd(boolean endingAll) {
|
||||||
card.updateNeedsTransformAnimation(false);
|
card.updateNeedsTransformAnimation(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CardUnTapAnimation extends ForgeAnimation {
|
private class CardUnTapAnimation extends ForgeAnimation {
|
||||||
private static final float DURATION = 0.18f;
|
private static final float DURATION = 0.18f;
|
||||||
private float progress = 0;
|
private float progress = 0;
|
||||||
|
|
||||||
private void drawCard(Graphics g, CardView card, float x, float y, float w, float h, float edgeOffset) {
|
private void drawCard(Graphics g, CardView card, float x, float y, float w, float h, float edgeOffset) {
|
||||||
float percentage = progress / DURATION;
|
float percentage = progress / DURATION;
|
||||||
if (percentage < 0) {
|
if (percentage < 0) {
|
||||||
@@ -272,19 +288,23 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
CardRenderer.drawCardWithOverlays(g, card, x, y, w, h, getStackPosition());
|
CardRenderer.drawCardWithOverlays(g, card, x, y, w, h, getStackPosition());
|
||||||
g.endTransform();
|
g.endTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean advance(float dt) {
|
protected boolean advance(float dt) {
|
||||||
progress += dt;
|
progress += dt;
|
||||||
return progress < DURATION;
|
return progress < DURATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEnd(boolean endingAll) {
|
protected void onEnd(boolean endingAll) {
|
||||||
card.updateNeedsUntapAnimation(false);
|
card.updateNeedsUntapAnimation(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CardTapAnimation extends ForgeAnimation {
|
private class CardTapAnimation extends ForgeAnimation {
|
||||||
private static final float DURATION = 0.18f;
|
private static final float DURATION = 0.18f;
|
||||||
private float progress = 0;
|
private float progress = 0;
|
||||||
|
|
||||||
private void drawCard(Graphics g, CardView card, float x, float y, float w, float h, float edgeOffset, float angle) {
|
private void drawCard(Graphics g, CardView card, float x, float y, float w, float h, float edgeOffset, float angle) {
|
||||||
float percentage = progress / DURATION;
|
float percentage = progress / DURATION;
|
||||||
if (percentage < 0) {
|
if (percentage < 0) {
|
||||||
@@ -297,16 +317,19 @@ public class FCardPanel extends FDisplayObject {
|
|||||||
CardRenderer.drawCardWithOverlays(g, card, x, y, w, h, getStackPosition());
|
CardRenderer.drawCardWithOverlays(g, card, x, y, w, h, getStackPosition());
|
||||||
g.endTransform();
|
g.endTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean advance(float dt) {
|
protected boolean advance(float dt) {
|
||||||
progress += dt;
|
progress += dt;
|
||||||
return progress < DURATION;
|
return progress < DURATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onEnd(boolean endingAll) {
|
protected void onEnd(boolean endingAll) {
|
||||||
card.updateNeedsTapAnimation(false);
|
card.updateNeedsTapAnimation(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return card == null ? "" : card.toString();
|
return card == null ? "" : card.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user