Added ability to override hand-sorting on the card panel.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3778 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -315,7 +315,9 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sort them
|
// sort them
|
||||||
QuickSort.sort(_handSprites);
|
if (shouldSortHand()) {
|
||||||
|
QuickSort.sort(_handSprites);
|
||||||
|
}
|
||||||
|
|
||||||
// fade them in at proper locations and layers
|
// fade them in at proper locations and layers
|
||||||
long cardDuration = fadeDuration / size;
|
long cardDuration = fadeDuration / size;
|
||||||
@@ -357,7 +359,9 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
public void showHand (Hand hand)
|
public void showHand (Hand hand)
|
||||||
{
|
{
|
||||||
// sort the hand
|
// sort the hand
|
||||||
QuickSort.sort(hand);
|
if (shouldSortHand()) {
|
||||||
|
QuickSort.sort(hand);
|
||||||
|
}
|
||||||
|
|
||||||
// set the sprites
|
// set the sprites
|
||||||
int len = Math.min(_handSprites.size(), hand.size());
|
int len = Math.min(_handSprites.size(), hand.size());
|
||||||
@@ -659,6 +663,15 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns whether the user's hand should be sorted when displayed. By
|
||||||
|
* default, hands are sorted.
|
||||||
|
*/
|
||||||
|
protected boolean shouldSortHand ()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expands or collapses the hand to accommodate new cards or cover the
|
* Expands or collapses the hand to accommodate new cards or cover the
|
||||||
* space left by removed cards. Skips unmanaged sprites. Clears out
|
* space left by removed cards. Skips unmanaged sprites. Clears out
|
||||||
@@ -674,7 +687,9 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
clearHandSelection();
|
clearHandSelection();
|
||||||
|
|
||||||
// Sort the hand
|
// Sort the hand
|
||||||
QuickSort.sort(_handSprites);
|
if (shouldSortHand()) {
|
||||||
|
QuickSort.sort(_handSprites);
|
||||||
|
}
|
||||||
|
|
||||||
// Move each card to its proper position (and, optionally, layer)
|
// Move each card to its proper position (and, optionally, layer)
|
||||||
int size = _handSprites.size();
|
int size = _handSprites.size();
|
||||||
|
|||||||
Reference in New Issue
Block a user