Class UnitImageAnimation
- java.lang.Object
-
- net.sf.freecol.client.gui.animation.Animation
-
- net.sf.freecol.client.gui.animation.UnitImageAnimation
-
public final class UnitImageAnimation extends Animation
Class for in-place animation of units.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Map<Direction,java.util.List<Direction>>alternativesAlternate directions to check when a directional animation is not found.private SimpleZippedAnimationanimationThe animation image series.private static java.util.logging.Loggerloggerprivate booleanmirrorReflect the images?
-
Constructor Summary
Constructors Constructor Description UnitImageAnimation(Unit unit, Tile tile, SimpleZippedAnimation animation)Build a new image animation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UnitImageAnimationbuild(Unit unit, Tile tile, Direction dirn, java.lang.String base, float scale)Static quasi-constructor that can fail harmlessly.voidexecuteWithLabel(javax.swing.JLabel unitLabel, Animations.Procedure paintCallback)The code to be executed when a unit is out for animation.voidsetMirrored(boolean mirror)Set the mirror state.private static java.util.List<Direction>trialDirections(Direction direction)Get a list of directions to try when looking for a direction-keyed animation given a preferred direction which has failed.
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
alternatives
public static final java.util.Map<Direction,java.util.List<Direction>> alternatives
Alternate directions to check when a directional animation is not found.
-
animation
private final SimpleZippedAnimation animation
The animation image series.
-
mirror
private boolean mirror
Reflect the images?
-
-
Constructor Detail
-
UnitImageAnimation
public UnitImageAnimation(Unit unit, Tile tile, SimpleZippedAnimation animation)
Build a new image animation.- Parameters:
unit- TheUnitto be animated.tile- TheTilewhere the animation occurs.animation- TheSimpleZippedAnimationto show.
-
-
Method Detail
-
setMirrored
public void setMirrored(boolean mirror)
Set the mirror state.- Parameters:
mirror- The new mirror state.
-
trialDirections
private static java.util.List<Direction> trialDirections(Direction direction)
Get a list of directions to try when looking for a direction-keyed animation given a preferred direction which has failed.- Parameters:
direction- The preferredDirection.- Returns:
- A list of
Directions.
-
build
public static UnitImageAnimation build(Unit unit, Tile tile, Direction dirn, java.lang.String base, float scale)
Static quasi-constructor that can fail harmlessly.- Parameters:
unit- TheUnitto be animated.tile- TheTilewhere the animation occurs.dirn- TheDirectionof the attack.base- The base prefix for the animation resource.scale- The gui scale.- Returns:
- The animation found or null if none present.
-
executeWithLabel
public void executeWithLabel(javax.swing.JLabel unitLabel, Animations.Procedure paintCallback)The code to be executed when a unit is out for animation.- Specified by:
executeWithLabelin classAnimation- Parameters:
unitLabel- AJLabelwith an image of the unit to animate.paintCallback- A callback to request that the animation area be repainted.
-
-