Added card transform in UI. For now for all cards.

This commit is contained in:
magenoxx 2011-09-08 22:23:35 +04:00
parent d3dfb67ffc
commit 903dc0c5ef
9 changed files with 777 additions and 658 deletions

View file

@ -517,4 +517,8 @@ public class Card extends MagePermanent implements MouseMotionListener, MouseLis
@Override
public float getAlpha() {return 0;}
@Override
public void toggleTransformed() {
}
}

View file

@ -61,12 +61,12 @@ public class ChatPanel extends javax.swing.JPanel {
/**
* Chat message color for opponents.
*/
private static final Color OPPONENT_COLOR = Color.RED;
private static final Color OPPONENT_COLOR = new Color(0, 230, 64);
/**
* Chat message color for client player.
*/
private static final Color MY_COLOR = Color.GREEN;
private static final Color MY_COLOR = new Color(0, 230, 64);
/**
* Chat message color for timestamps.

View file

@ -130,6 +130,39 @@ abstract public class Animation {
};
}
public static void transformCard (final CardPanel panel, final MagePermanent parent, final boolean transformed) {
new Animation(1200) {
boolean state = false;
protected void start () {
parent.onBeginAnimation();
}
protected void update (float percentage) {
double p = percentage * 2;
if (percentage > 0.5) {
if (!state) {
parent.toggleTransformed();
}
state = true;
p = (p - 0.5) * 2;
}
if (!state) {
panel.transformAngle = Math.max(0.01, 1 - p);
} else {
panel.transformAngle = Math.max(0.01, p - 1);
}
panel.repaint();
}
protected void end () {
parent.onEndAnimation();
parent.repaint();
}
};
}
// static public void moveCardToPlay (Component source, final CardPanel dest, final CardPanel animationPanel) {
static public void moveCardToPlay (final int startX, final int startY, final int startWidth, final int endX, final int endY,
final int endWidth, final CardPanel animationPanel, final CardPanel placeholder, final JLayeredPane layeredPane,

File diff suppressed because it is too large Load diff

View file

@ -4,4 +4,6 @@ import java.awt.*;
public interface ImageManager {
public Image getSicknessImage();
public Image getDayImage();
public Image getNightImage();
}

View file

@ -34,6 +34,24 @@ public class ImageManagerImpl implements ImageManager {
return imageSickness;
}
@Override
public BufferedImage getDayImage() {
if (imageDay == null) {
Image image = getImageFromResourceTransparent("/card/day.png", Color.WHITE, new Rectangle(20, 20));
imageDay = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
}
return imageDay;
}
@Override
public BufferedImage getNightImage() {
if (imageNight == null) {
Image image = getImageFromResourceTransparent("/card/night.png", Color.WHITE, new Rectangle(20, 20));
imageNight = BufferedImageBuilder.bufferImage(image, BufferedImage.TYPE_INT_ARGB);
}
return imageNight;
}
protected static Image getImageFromResourceTransparent(String path, Color mask, Rectangle rec) {
BufferedImage image = null;
Image imageCardTransparent = null;
@ -54,4 +72,6 @@ public class ImageManagerImpl implements ImageManager {
}
private static BufferedImage imageSickness = null;
private static BufferedImage imageDay = null;
private static BufferedImage imageNight = null;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -27,4 +27,5 @@ public abstract class MageCard extends JPanel {
abstract public void setZone(String zone);
abstract public String getZone();
abstract public void updateCallback(ActionCallback callback, UUID gameId);
abstract public void toggleTransformed();
}