java.lang.Objectcom.realtime.crossfire.jxclient.map.CfMapAnimations
public class CfMapAnimations
Manages a set of animated map squares.
| Field Summary | |
|---|---|
private AnimationMap |
animations
The animations in the visible map area. |
private java.util.Map<AnimationState,java.lang.Void> |
animationStates
All AnimationState instances referenced by animations. |
private CrossfireTickListener |
crossfireTickListener
The listener for receiving "tick" commands. |
private int |
height
The height of the visible map area. |
private CfMapUpdater |
mapUpdater
The CfMapUpdater instance to update. |
private java.util.Collection<AnimationState> |
pendingTickUpdates
The AnimationState instances that have been added but not yet
received a "tick" value. |
private java.util.Random |
random
The random number generator for Map2.ANIM_RANDOM type
animations. |
private java.lang.Object |
sync
Synchronization object. |
private java.util.Map<java.lang.Integer,AnimationState> |
syncAnimationStates
All AnimationState for Map2.ANIM_SYNC animations. |
private int |
width
The width of the visible map area. |
| Constructor Summary | |
|---|---|
CfMapAnimations(CfMapUpdater mapUpdater)
Creates a new instance. |
|
CfMapAnimations(CrossfireServerConnection crossfireServerConnection,
CfMapUpdater mapUpdater)
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
add(Location location,
Animation animation,
int type)
Adds a visible animation. |
void |
clear()
Forgets all animations. |
void |
remove(int x,
int y)
Removes all visible animations for a tile. |
void |
remove(Location location)
Removes a visible animation. |
void |
scroll(int dx,
int dy)
Scrolls the animations. |
void |
setMapSize(int width,
int height)
Updates the map size. |
void |
tick(int tickNo)
Processes a tick command. |
void |
updateSpeed(Location location,
int speed)
Updates the animation speed value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
@NotNull private final AnimationMap animations
@NotNull private final java.util.Map<AnimationState,java.lang.Void> animationStates
AnimationState instances referenced by animations.
@NotNull private final CrossfireTickListener crossfireTickListener
private int height
@NotNull private final CfMapUpdater mapUpdater
CfMapUpdater instance to update.
@NotNull private final java.util.Collection<AnimationState> pendingTickUpdates
AnimationState instances that have been added but not yet
received a "tick" value.
@NotNull private final java.util.Random random
Map2.ANIM_RANDOM type
animations.
@NotNull private final java.lang.Object sync
@NotNull private final java.util.Map<java.lang.Integer,AnimationState> syncAnimationStates
AnimationState for Map2.ANIM_SYNC animations.
private int width
| Constructor Detail |
|---|
public CfMapAnimations(@NotNull
CfMapUpdater mapUpdater)
mapUpdater - the instance to update
public CfMapAnimations(@NotNull
CrossfireServerConnection crossfireServerConnection,
@NotNull
CfMapUpdater mapUpdater)
crossfireServerConnection - the connection to watchmapUpdater - the instance to update| Method Detail |
|---|
public void add(@NotNull
Location location,
@NotNull
Animation animation,
int type)
location - the location to animateanimation - the animation to displaytype - the animation typepublic void clear()
public void remove(int x,
int y)
x - the x-coordinate to un-animatey - the y-coordinate to un-animate
public void remove(@NotNull
Location location)
location - the location to un-animate
public void scroll(int dx,
int dy)
dx - the x-distance to scrolldy - the y-distance to scroll
public void setMapSize(int width,
int height)
width - the map widthheight - the map heightpublic void tick(int tickNo)
tickNo - the current tick number
public void updateSpeed(@NotNull
Location location,
int speed)
location - the location to updatespeed - the new animation speed