Added support for an additional drop step to better show cards received from other players.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3490 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -442,16 +442,19 @@ public abstract class CardPanel extends VirtualMediaPanel
|
||||
|
||||
/**
|
||||
* Flies a set of cards from the ether into the hand. Clears any selected
|
||||
* cards.
|
||||
* cards. If the drop duration is nonzero, the cards will first fly to
|
||||
* the selected card offset and then drop slowly into the hand.
|
||||
*
|
||||
* @param cards the cards to add to the hand
|
||||
* @param src the point to fly the cards from
|
||||
* @param flightDuration the duration of the cards' flight
|
||||
* @param dropDuration the duration of the cards' drop into the
|
||||
* hand
|
||||
* @param fadePortion the amount of time to spend fading in
|
||||
* as a proportion of the flight duration
|
||||
*/
|
||||
public void flyIntoHand (Card[] cards, Point src, long flightDuration,
|
||||
float fadePortion)
|
||||
long dropDuration, float fadePortion)
|
||||
{
|
||||
// first create the sprites and add them to the list
|
||||
CardSprite[] sprites = new CardSprite[cards.length];
|
||||
@@ -471,9 +474,23 @@ public abstract class CardPanel extends VirtualMediaPanel
|
||||
sprites[i].setRenderOrder(idx);
|
||||
sprites[i].addSpriteObserver(_handSpriteObserver);
|
||||
addSprite(sprites[i]);
|
||||
LinePath flight = new LinePath(new Point(getHandX(size, idx),
|
||||
_handLocation.y), flightDuration);
|
||||
sprites[i].moveAndFadeIn(flight, flightDuration, fadePortion);
|
||||
|
||||
// if dropping, create a path sequence combining flight and drop
|
||||
Path path;
|
||||
long pathDuration;
|
||||
Point hp = new Point(getHandX(size, idx), _handLocation.y);
|
||||
if (dropDuration > 0) {
|
||||
LinePath flight = new LinePath(new Point(hp.x, hp.y -
|
||||
_selectedCardOffset), flightDuration),
|
||||
drop = new LinePath(hp, dropDuration);
|
||||
path = new PathSequence(flight, drop);
|
||||
pathDuration = flightDuration + dropDuration;
|
||||
|
||||
} else {
|
||||
path = new LinePath(hp, flightDuration);
|
||||
pathDuration = flightDuration;
|
||||
}
|
||||
sprites[i].moveAndFadeIn(path, pathDuration, fadePortion);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user