From 04c13820ef66e091bf18d0b54704365dacd91ffb Mon Sep 17 00:00:00 2001 From: Mike Thomas Date: Thu, 8 Dec 2005 19:41:12 +0000 Subject: [PATCH] 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 --- .../parlor/card/client/CardPanel.java | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/java/com/threerings/parlor/card/client/CardPanel.java b/src/java/com/threerings/parlor/card/client/CardPanel.java index 200725be4..aa4403c69 100644 --- a/src/java/com/threerings/parlor/card/client/CardPanel.java +++ b/src/java/com/threerings/parlor/card/client/CardPanel.java @@ -315,7 +315,9 @@ public abstract class CardPanel extends VirtualMediaPanel } // sort them - QuickSort.sort(_handSprites); + if (shouldSortHand()) { + QuickSort.sort(_handSprites); + } // fade them in at proper locations and layers long cardDuration = fadeDuration / size; @@ -357,7 +359,9 @@ public abstract class CardPanel extends VirtualMediaPanel public void showHand (Hand hand) { // sort the hand - QuickSort.sort(hand); + if (shouldSortHand()) { + QuickSort.sort(hand); + } // set the sprites int len = Math.min(_handSprites.size(), hand.size()); @@ -659,6 +663,15 @@ public abstract class CardPanel extends VirtualMediaPanel 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 * space left by removed cards. Skips unmanaged sprites. Clears out @@ -674,7 +687,9 @@ public abstract class CardPanel extends VirtualMediaPanel clearHandSelection(); // Sort the hand - QuickSort.sort(_handSprites); + if (shouldSortHand()) { + QuickSort.sort(_handSprites); + } // Move each card to its proper position (and, optionally, layer) int size = _handSprites.size();