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>>
alternatives
Alternate directions to check when a directional animation is not found.private SimpleZippedAnimation
animation
The animation image series.private static java.util.logging.Logger
logger
private boolean
mirror
Reflect 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 UnitImageAnimation
build(Unit unit, Tile tile, Direction dirn, java.lang.String base, float scale)
Static quasi-constructor that can fail harmlessly.void
executeWithLabel(javax.swing.JLabel unitLabel, Animations.Procedure paintCallback)
The code to be executed when a unit is out for animation.void
setMirrored(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
- TheUnit
to be animated.tile
- TheTile
where the animation occurs.animation
- TheSimpleZippedAnimation
to 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
Direction
s.
-
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
- TheUnit
to be animated.tile
- TheTile
where the animation occurs.dirn
- TheDirection
of 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:
executeWithLabel
in classAnimation
- Parameters:
unitLabel
- AJLabel
with an image of the unit to animate.paintCallback
- A callback to request that the animation area be repainted.
-
-