update CardImageRenderer, VAvatar

This commit is contained in:
Anthony Calosa
2022-12-14 23:43:47 +08:00
parent a1824386fc
commit ad01c9076d
3 changed files with 53 additions and 29 deletions

View File

@@ -753,10 +753,24 @@ public class Graphics {
fillRoundRect(borderColor, x + 1, y + 1, w - 1.5f, h - 1.5f, (h - w) / 10);//used by zoom let some edges show...
}
public void drawAvatarImage(FImage image, float x, float y, float w, float h, boolean drawGrayscale) {
public void drawAvatarImage(FImage image, float x, float y, float w, float h, boolean drawGrayscale, float amount) {
if (image == null)
return;
if (!drawGrayscale) {
if (amount > 0) {
batch.end();
shaderWarp.bind();
shaderWarp.setUniformf("u_amount", 0.2f);
shaderWarp.setUniformf("u_speed", 0.2f);
shaderWarp.setUniformf("u_time", amount);
batch.setShader(shaderWarp);
batch.begin();
//draw
image.draw(this, x, y, w, h);
//reset
batch.end();
batch.setShader(null);
batch.begin();
} else if (!drawGrayscale) {
image.draw(this, x, y, w, h);
} else {
batch.end();

View File

@@ -915,49 +915,64 @@ public class CardImageRenderer {
} else if (backColors.get(0) == DetailColors.LAND) {
g.drawImage(isPW ? FSkinTexture.PWBG_C : FSkinTexture.CARDBG_L, x, y, w, h);
} else if (backColors.get(0) == DetailColors.MULTICOLOR) {
if (isNyx)
if (state.isVehicle())
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
else if (isNyx)
g.drawImage(FSkinTexture.NYX_M, x, y, w, h);
else
g.drawImage(isPW ? FSkinTexture.PWBG_M : FSkinTexture.CARDBG_M, x, y, w, h);
} else if (backColors.get(0) == DetailColors.COLORLESS) {
if (isPW)
g.drawImage(FSkinTexture.PWBG_C, x, y, w, h);
else if (state.isVehicle())
if (state.isVehicle())
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
else if (isPW)
g.drawImage(FSkinTexture.PWBG_C, x, y, w, h);
else if (state.isArtifact())
g.drawImage(FSkinTexture.CARDBG_A, x, y, w, h);
else if (isNyx)
g.drawImage(FSkinTexture.NYX_C, x, y, w, h);
else
g.drawImage(FSkinTexture.CARDBG_C, x, y, w, h);
//todo add NYX for colorless?
} else if (backColors.get(0) == DetailColors.GREEN) {
if (isNyx)
if (state.isVehicle())
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
else if (isNyx)
g.drawImage(FSkinTexture.NYX_G, x, y, w, h);
else
g.drawImage(isPW ? FSkinTexture.PWBG_G : FSkinTexture.CARDBG_G, x, y, w, h);
} else if (backColors.get(0) == DetailColors.RED) {
if (isNyx)
if (state.isVehicle())
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
else if (isNyx)
g.drawImage(FSkinTexture.NYX_R, x, y, w, h);
else
g.drawImage(isPW ? FSkinTexture.PWBG_R : FSkinTexture.CARDBG_R, x, y, w, h);
} else if (backColors.get(0) == DetailColors.BLACK) {
if (isNyx)
if (state.isVehicle())
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
else if (isNyx)
g.drawImage(FSkinTexture.NYX_B, x, y, w, h);
else
g.drawImage(isPW ? FSkinTexture.PWBG_B : FSkinTexture.CARDBG_B, x, y, w, h);
} else if (backColors.get(0) == DetailColors.BLUE) {
if (isNyx)
if (state.isVehicle())
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
else if (isNyx)
g.drawImage(FSkinTexture.NYX_U, x, y, w, h);
else
g.drawImage(isPW ? FSkinTexture.PWBG_U : FSkinTexture.CARDBG_U, x, y, w, h);
} else if (backColors.get(0) == DetailColors.WHITE) {
if (isNyx)
if (state.isVehicle())
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
else if (isNyx)
g.drawImage(FSkinTexture.NYX_W, x, y, w, h);
else
g.drawImage(isPW ? FSkinTexture.PWBG_W : FSkinTexture.CARDBG_W, x, y, w, h);
}
break;
case 2:
if (isNyx)
if (state.isVehicle())
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
else if (isNyx)
g.drawImage(FSkinTexture.NYX_M, x, y, w, h);
else {
if (!isHybrid) {
@@ -986,13 +1001,17 @@ public class CardImageRenderer {
}
break;
case 3:
if (isNyx)
if (state.isVehicle())
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
else if (isNyx)
g.drawImage(FSkinTexture.NYX_M, x, y, w, h);
else
g.drawImage(isPW ? FSkinTexture.PWBG_M : FSkinTexture.CARDBG_M, x, y, w, h);
break;
default:
if (isNyx)
if (state.isVehicle())
g.drawImage(FSkinTexture.CARDBG_V, x, y, w, h);
else if (isNyx)
g.drawImage(FSkinTexture.NYX_C, x, y, w, h);
else
g.drawImage(isPW ? FSkinTexture.PWBG_C : FSkinTexture.CARDBG_C, x, y, w, h);

View File

@@ -44,7 +44,7 @@ public class VAvatar extends FDisplayObject {
avatarAnimation = new AvatarAnimation();
}
private class AvatarAnimation extends ForgeAnimation {
private static final float DURATION = 1.2f;
private static final float DURATION = 0.8f;
private float progress = 0;
Texture splatter = FSkin.splatter;
@@ -60,23 +60,14 @@ public class VAvatar extends FDisplayObject {
float oldAlpha = g.getfloatAlphaComposite();
float fade = 1-(percentage*1);
if (amount > 0) {
g.drawAvatarImage(image, x, y, w, h, player.getHasLost());
g.drawAvatarImage(image, x, y, w, h, player.getHasLost(), 0);
drawPlayerIndicator(g, w, h, percentage);
g.setAlphaComposite(fade);
g.drawRect(w / 12f, Color.WHITE, 0, 0, w, h);
g.drawOutlinedText("+"+amount, Forge.altZoneTabs ? LIFE_FONT_ALT : LIFE_FONT, Color.WHITE, Color.SKY, 0, (getHeight()/2)*fade, getWidth(), getHeight(), false, Align.center, true);
g.setAlphaComposite(oldAlpha);
} else if (amount < 0) {
if (splatter == null) {
g.setColorRGBA(1, percentage, percentage, oldAlpha);
g.drawAvatarImage(image, x, y, w, h, player.getHasLost());
g.resetColorRGBA(oldAlpha);
} else {
g.drawAvatarImage(image, x, y, w, h, player.getHasLost());
g.setAlphaComposite(fade);
g.drawImage(splatter, x-mod/2, y-mod/2, w+mod, h+mod);
g.setAlphaComposite(oldAlpha);
}
g.drawAvatarImage(image, x, y, w, h, player.getHasLost(), 1-percentage);
drawPlayerIndicator(g, w, h, percentage);
g.setAlphaComposite(fade);
g.drawOutlinedText(String.valueOf(amount), Forge.altZoneTabs ? LIFE_FONT_ALT : LIFE_FONT, Color.RED, Color.ORANGE, 0, (getHeight()/2)*fade, getWidth(), getHeight(), false, Align.center, true);
@@ -120,11 +111,11 @@ public class VAvatar extends FDisplayObject {
avatarAnimation.start();
avatarAnimation.drawAvatar(g, image, 0, 0, w, h);
} else {
g.drawAvatarImage(image, 0, 0, w, h, player.getHasLost());
g.drawAvatarImage(image, 0, 0, w, h, player.getHasLost(), 0);
drawPlayerIndicator(g, w, h, 1);
}
} else {
g.drawAvatarImage(image, 0, 0, w, h, player.getHasLost());
g.drawAvatarImage(image, 0, 0, w, h, player.getHasLost(), 0);
}
if (Forge.altPlayerLayout && !Forge.altZoneTabs && Forge.isLandscapeMode())