Various easy changes suggested by Ray.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3220 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: ButtonSprite.java,v 1.4 2004/11/09 03:24:50 andrzej Exp $
|
// $Id$
|
||||||
//
|
//
|
||||||
// Narya library - tools for developing networked games
|
// Narya library - tools for developing networked games
|
||||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||||
@@ -276,52 +276,72 @@ public class ButtonSprite extends Sprite
|
|||||||
|
|
||||||
switch (_style) {
|
switch (_style) {
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
gfx.setColor(_enabled ? _backgroundColor : _backgroundColor.darker());
|
gfx.setColor(_enabled ? _backgroundColor :
|
||||||
|
_backgroundColor.darker());
|
||||||
gfx.fill3DRect(_bounds.x, _bounds.y, _bounds.width,
|
gfx.fill3DRect(_bounds.x, _bounds.y, _bounds.width,
|
||||||
_bounds.height, !_pressed);
|
_bounds.height, !_pressed);
|
||||||
_label.render(gfx, _bounds.x + (_pressed ? PADDING : PADDING - 1),
|
_label.render(gfx, _bounds.x + (_pressed ? PADDING :
|
||||||
_bounds.y + (_pressed ? PADDING : PADDING - 1));
|
PADDING - 1), _bounds.y + (_pressed ? PADDING :
|
||||||
|
PADDING - 1));
|
||||||
break;
|
break;
|
||||||
case ROUNDED:
|
case ROUNDED:
|
||||||
Object aaState = SwingUtil.activateAntiAliasing(gfx);
|
Object aaState = SwingUtil.activateAntiAliasing(gfx);
|
||||||
// draw outline
|
// draw outline
|
||||||
gfx.setColor(_alternateColor);
|
gfx.setColor(_alternateColor);
|
||||||
gfx.fillRoundRect(_bounds.x, _bounds.y, _bounds.width, _bounds.height,
|
gfx.fillRoundRect(_bounds.x, _bounds.y, _bounds.width,
|
||||||
_arcWidth, _arcHeight);
|
_bounds.height, _arcWidth, _arcHeight);
|
||||||
// draw foreground
|
// draw foreground
|
||||||
gfx.setColor(_enabled ? _backgroundColor : _backgroundColor.darker());
|
gfx.setColor(_enabled ? _backgroundColor :
|
||||||
|
_backgroundColor.darker());
|
||||||
int innerBoundsX = _bounds.x+1, innerBoundsY = _bounds.y+1,
|
int innerBoundsX = _bounds.x+1, innerBoundsY = _bounds.y+1,
|
||||||
innerBoundsWidth = _bounds.width-2, innerBoundsHeight = _bounds.height-2,
|
innerBoundsWidth = _bounds.width-2,
|
||||||
innerBoundsArcWidth = _arcWidth-2, innerBoundsArcHeight = _arcHeight-2;
|
innerBoundsHeight = _bounds.height-2,
|
||||||
gfx.fillRoundRect(innerBoundsX, innerBoundsY, innerBoundsWidth, innerBoundsHeight,
|
innerBoundsArcWidth = _arcWidth-2,
|
||||||
|
innerBoundsArcHeight = _arcHeight-2;
|
||||||
|
gfx.fillRoundRect(innerBoundsX, innerBoundsY,
|
||||||
|
innerBoundsWidth, innerBoundsHeight,
|
||||||
innerBoundsArcWidth, innerBoundsArcHeight);
|
innerBoundsArcWidth, innerBoundsArcHeight);
|
||||||
Color brighter = _enabled ? _backgroundColor.brighter() : _backgroundColor,
|
Color brighter = _enabled ? _backgroundColor.brighter() :
|
||||||
darker = _enabled ? _backgroundColor.darker() : _backgroundColor.darker().darker();
|
_backgroundColor, darker = _enabled ?
|
||||||
|
_backgroundColor.darker() :
|
||||||
|
_backgroundColor.darker().darker();
|
||||||
// draw the upper left/lower right corners (always dark)
|
// draw the upper left/lower right corners (always dark)
|
||||||
gfx.setColor(darker);
|
gfx.setColor(darker);
|
||||||
gfx.drawArc(innerBoundsX, innerBoundsY, innerBoundsArcWidth, innerBoundsArcHeight, 90, 90);
|
gfx.drawArc(innerBoundsX, innerBoundsY, innerBoundsArcWidth,
|
||||||
gfx.drawArc(innerBoundsX + innerBoundsWidth - innerBoundsArcWidth - 1,
|
innerBoundsArcHeight, 90, 90);
|
||||||
innerBoundsY + innerBoundsHeight - innerBoundsArcHeight - 1,
|
gfx.drawArc(innerBoundsX + innerBoundsWidth -
|
||||||
|
innerBoundsArcWidth - 1,
|
||||||
|
innerBoundsY + innerBoundsHeight -
|
||||||
|
innerBoundsArcHeight - 1,
|
||||||
innerBoundsArcWidth, innerBoundsArcHeight, 270, 90);
|
innerBoundsArcWidth, innerBoundsArcHeight, 270, 90);
|
||||||
// draw the upper right (dark when pressed)
|
// draw the upper right (dark when pressed)
|
||||||
gfx.setColor(_pressed ? darker : brighter);
|
gfx.setColor(_pressed ? darker : brighter);
|
||||||
gfx.drawLine(innerBoundsX + innerBoundsArcWidth/2, innerBoundsY,
|
gfx.drawLine(innerBoundsX + innerBoundsArcWidth/2,
|
||||||
innerBoundsX + innerBoundsWidth - innerBoundsArcWidth/2, innerBoundsY);
|
innerBoundsY, innerBoundsX + innerBoundsWidth -
|
||||||
gfx.drawArc(innerBoundsX + innerBoundsWidth - innerBoundsArcWidth - 1, innerBoundsY,
|
innerBoundsArcWidth/2, innerBoundsY);
|
||||||
|
gfx.drawArc(innerBoundsX + innerBoundsWidth -
|
||||||
|
innerBoundsArcWidth - 1, innerBoundsY,
|
||||||
innerBoundsArcWidth, innerBoundsArcHeight, 0, 90);
|
innerBoundsArcWidth, innerBoundsArcHeight, 0, 90);
|
||||||
gfx.drawLine(innerBoundsX + innerBoundsWidth - 1, innerBoundsY + innerBoundsArcHeight/2,
|
gfx.drawLine(innerBoundsX + innerBoundsWidth - 1,
|
||||||
innerBoundsX + innerBoundsWidth - 1, innerBoundsY + innerBoundsHeight - innerBoundsArcHeight/2);
|
innerBoundsY + innerBoundsArcHeight/2,
|
||||||
|
innerBoundsX + innerBoundsWidth - 1, innerBoundsY +
|
||||||
|
innerBoundsHeight - innerBoundsArcHeight/2);
|
||||||
// draw the lower left (light when pressed)
|
// draw the lower left (light when pressed)
|
||||||
gfx.setColor(_pressed ? brighter : darker);
|
gfx.setColor(_pressed ? brighter : darker);
|
||||||
gfx.drawLine(innerBoundsX, innerBoundsY + innerBoundsArcHeight/2, innerBoundsX,
|
gfx.drawLine(innerBoundsX, innerBoundsY +
|
||||||
innerBoundsY + innerBoundsHeight - innerBoundsArcHeight/2);
|
innerBoundsArcHeight/2, innerBoundsX,
|
||||||
gfx.drawArc(innerBoundsX, innerBoundsY + innerBoundsHeight - innerBoundsArcHeight - 1,
|
innerBoundsY + innerBoundsHeight -
|
||||||
|
innerBoundsArcHeight/2);
|
||||||
|
gfx.drawArc(innerBoundsX, innerBoundsY + innerBoundsHeight -
|
||||||
|
innerBoundsArcHeight - 1,
|
||||||
innerBoundsArcWidth, innerBoundsArcHeight, 180, 90);
|
innerBoundsArcWidth, innerBoundsArcHeight, 180, 90);
|
||||||
gfx.drawLine(innerBoundsX + innerBoundsArcWidth/2, innerBoundsY + innerBoundsHeight - 1,
|
gfx.drawLine(innerBoundsX + innerBoundsArcWidth/2,
|
||||||
|
innerBoundsY + innerBoundsHeight - 1,
|
||||||
innerBoundsX + innerBoundsWidth - innerBoundsArcWidth/2,
|
innerBoundsX + innerBoundsWidth - innerBoundsArcWidth/2,
|
||||||
innerBoundsY + innerBoundsHeight - 1);
|
innerBoundsY + innerBoundsHeight - 1);
|
||||||
SwingUtil.restoreAntiAliasing(gfx, aaState);
|
SwingUtil.restoreAntiAliasing(gfx, aaState);
|
||||||
_label.render(gfx, _bounds.x + PADDING + _arcWidth/2 - (_pressed ? 2 : 1),
|
_label.render(gfx, _bounds.x + PADDING + _arcWidth/2 -
|
||||||
|
(_pressed ? 2 : 1),
|
||||||
_bounds.y + PADDING + (_pressed ? 1 : 0));
|
_bounds.y + PADDING + (_pressed ? 1 : 0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
//
|
|
||||||
// $Id: ButtonSpriteObserver.java,v 1.1 2004/10/29 00:41:50 andrzej Exp $
|
|
||||||
//
|
|
||||||
// Narya library - tools for developing networked games
|
|
||||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
|
||||||
// http://www.threerings.net/code/narya/
|
|
||||||
//
|
|
||||||
// This library is free software; you can redistribute it and/or modify it
|
|
||||||
// under the terms of the GNU Lesser General Public License as published
|
|
||||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This library is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
// Lesser General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU Lesser General Public
|
|
||||||
// License along with this library; if not, write to the Free Software
|
|
||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
package com.threerings.parlor.card.client;
|
|
||||||
|
|
||||||
import com.samskivert.swing.event.CommandEvent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Observer interface for button sprites.
|
|
||||||
*/
|
|
||||||
public interface ButtonSpriteObserver
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Notifies the observer that the user clicked a button sprite.
|
|
||||||
*
|
|
||||||
* @param sprite the clicked sprite
|
|
||||||
* @param ce the command event associated with the click
|
|
||||||
*/
|
|
||||||
public void buttonSpriteClicked (ButtonSprite sprite, CommandEvent ce);
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: CardPanel.java,v 1.8 2004/11/04 02:03:47 andrzej Exp $
|
// $Id$
|
||||||
//
|
//
|
||||||
// Narya library - tools for developing networked games
|
// Narya library - tools for developing networked games
|
||||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||||
@@ -55,7 +55,8 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
implements CardCodes
|
implements CardCodes
|
||||||
{
|
{
|
||||||
/** Calls CardSpriteObserver.cardSpriteClicked. */
|
/** Calls CardSpriteObserver.cardSpriteClicked. */
|
||||||
protected static class CardSpriteClickedOp implements ObserverList.ObserverOp
|
protected static class CardSpriteClickedOp implements
|
||||||
|
ObserverList.ObserverOp
|
||||||
{
|
{
|
||||||
public CardSpriteClickedOp (CardSprite sprite, MouseEvent me)
|
public CardSpriteClickedOp (CardSprite sprite, MouseEvent me)
|
||||||
{
|
{
|
||||||
@@ -65,7 +66,8 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
|
|
||||||
public boolean apply (Object observer)
|
public boolean apply (Object observer)
|
||||||
{
|
{
|
||||||
((CardSpriteObserver)observer).cardSpriteClicked(_sprite, _me);
|
((CardSpriteObserver)observer).cardSpriteClicked(_sprite,
|
||||||
|
_me);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +76,8 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Calls CardSpriteObserver.cardSpriteEntered. */
|
/** Calls CardSpriteObserver.cardSpriteEntered. */
|
||||||
protected static class CardSpriteEnteredOp implements ObserverList.ObserverOp
|
protected static class CardSpriteEnteredOp implements
|
||||||
|
ObserverList.ObserverOp
|
||||||
{
|
{
|
||||||
public CardSpriteEnteredOp (CardSprite sprite, MouseEvent me)
|
public CardSpriteEnteredOp (CardSprite sprite, MouseEvent me)
|
||||||
{
|
{
|
||||||
@@ -93,7 +96,8 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Calls CardSpriteObserver.cardSpriteExited. */
|
/** Calls CardSpriteObserver.cardSpriteExited. */
|
||||||
protected static class CardSpriteExitedOp implements ObserverList.ObserverOp
|
protected static class CardSpriteExitedOp implements
|
||||||
|
ObserverList.ObserverOp
|
||||||
{
|
{
|
||||||
public CardSpriteExitedOp (CardSprite sprite, MouseEvent me)
|
public CardSpriteExitedOp (CardSprite sprite, MouseEvent me)
|
||||||
{
|
{
|
||||||
@@ -112,7 +116,8 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Calls CardSpriteObserver.cardSpriteDragged. */
|
/** Calls CardSpriteObserver.cardSpriteDragged. */
|
||||||
protected static class CardSpriteDraggedOp implements ObserverList.ObserverOp
|
protected static class CardSpriteDraggedOp implements
|
||||||
|
ObserverList.ObserverOp
|
||||||
{
|
{
|
||||||
public CardSpriteDraggedOp (CardSprite sprite, MouseEvent me)
|
public CardSpriteDraggedOp (CardSprite sprite, MouseEvent me)
|
||||||
{
|
{
|
||||||
@@ -130,25 +135,6 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
protected MouseEvent _me;
|
protected MouseEvent _me;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Calls ButtonSpriteObserver.buttonSpriteClicked. */
|
|
||||||
protected static class ButtonSpriteClickedOp implements ObserverList.ObserverOp
|
|
||||||
{
|
|
||||||
public ButtonSpriteClickedOp (ButtonSprite sprite, CommandEvent ce)
|
|
||||||
{
|
|
||||||
_sprite = sprite;
|
|
||||||
_ce = ce;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean apply (Object observer)
|
|
||||||
{
|
|
||||||
((ButtonSpriteObserver)observer).buttonSpriteClicked(_sprite, _ce);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ButtonSprite _sprite;
|
|
||||||
protected CommandEvent _ce;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
@@ -177,17 +163,17 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
public void mouseReleased (MouseEvent me) {
|
public void mouseReleased (MouseEvent me) {
|
||||||
if (_activeSprite != null && !isManaged(_activeSprite)) {
|
if (_activeSprite != null && !isManaged(_activeSprite)) {
|
||||||
_activeSprite = null;
|
_activeSprite = null;
|
||||||
} else if (_activeSprite instanceof CardSprite && _hasBeenDragged) {
|
} else if (_activeSprite instanceof CardSprite &&
|
||||||
|
_hasBeenDragged) {
|
||||||
_activeSprite.queueNotification(
|
_activeSprite.queueNotification(
|
||||||
new CardSpriteDraggedOp((CardSprite)_activeSprite, me)
|
new CardSpriteDraggedOp((CardSprite)_activeSprite, me)
|
||||||
);
|
);
|
||||||
} else if (_activeSprite instanceof ButtonSprite) {
|
} else if (_activeSprite instanceof ButtonSprite) {
|
||||||
ButtonSprite bs = (ButtonSprite)_activeSprite;
|
ButtonSprite bs = (ButtonSprite)_activeSprite;
|
||||||
if (bs.isPressed()) {
|
if (bs.isPressed()) {
|
||||||
CommandEvent ce = new CommandEvent(CardPanel.this, bs.getActionCommand(),
|
CommandEvent ce = new CommandEvent(CardPanel.this,
|
||||||
bs.getCommandArgument(), me.getWhen(), me.getModifiers());
|
bs.getActionCommand(), bs.getCommandArgument(),
|
||||||
bs.queueNotification(
|
me.getWhen(), me.getModifiers());
|
||||||
new ButtonSpriteClickedOp(bs, ce));
|
|
||||||
Controller.postAction(ce);
|
Controller.postAction(ce);
|
||||||
bs.setPressed(false);
|
bs.setPressed(false);
|
||||||
}
|
}
|
||||||
@@ -236,7 +222,8 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
if (_activeSprite instanceof CardSprite &&
|
if (_activeSprite instanceof CardSprite &&
|
||||||
isManaged(_activeSprite)) {
|
isManaged(_activeSprite)) {
|
||||||
_activeSprite.queueNotification(
|
_activeSprite.queueNotification(
|
||||||
new CardSpriteExitedOp((CardSprite)_activeSprite, me)
|
new CardSpriteExitedOp((CardSprite)_activeSprite,
|
||||||
|
me)
|
||||||
);
|
);
|
||||||
} else if (_activeSprite instanceof ButtonSprite &&
|
} else if (_activeSprite instanceof ButtonSprite &&
|
||||||
isManaged(_activeSprite)) {
|
isManaged(_activeSprite)) {
|
||||||
@@ -244,7 +231,8 @@ public abstract class CardPanel extends VirtualMediaPanel
|
|||||||
}
|
}
|
||||||
if (newActiveSprite instanceof CardSprite) {
|
if (newActiveSprite instanceof CardSprite) {
|
||||||
newActiveSprite.queueNotification(
|
newActiveSprite.queueNotification(
|
||||||
new CardSpriteEnteredOp((CardSprite)newActiveSprite, me)
|
new CardSpriteEnteredOp(
|
||||||
|
(CardSprite)newActiveSprite, me)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
_activeSprite = newActiveSprite;
|
_activeSprite = newActiveSprite;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: CardSprite.java,v 1.2 2004/10/15 00:14:23 andrzej Exp $
|
// $Id$
|
||||||
//
|
//
|
||||||
// Narya library - tools for developing networked games
|
// Narya library - tools for developing networked games
|
||||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||||
@@ -132,10 +132,10 @@ public class CardSprite extends OrientableImageSprite
|
|||||||
*/
|
*/
|
||||||
private void updateMirage ()
|
private void updateMirage ()
|
||||||
{
|
{
|
||||||
setMirage(_facingUp ? _panel.getCardImage(_card) : _panel.getCardBackImage());
|
setMirage(_facingUp ? _panel.getCardImage(_card) :
|
||||||
|
_panel.getCardBackImage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** The panel responsible for the sprite. */
|
/** The panel responsible for the sprite. */
|
||||||
protected CardPanel _panel;
|
protected CardPanel _panel;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: Card.java,v 1.7 2004/11/01 22:10:21 andrzej Exp $
|
// $Id$
|
||||||
//
|
//
|
||||||
// Narya library - tools for developing networked games
|
// Narya library - tools for developing networked games
|
||||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||||
@@ -108,8 +108,8 @@ public class Card implements DSet.Entry, Comparable, CardCodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether or not this card is valid. The no-arg public constructor
|
* Checks whether or not this card is valid. The no-arg public
|
||||||
* for deserialization creates an invalid card.
|
* constructor for deserialization creates an invalid card.
|
||||||
*
|
*
|
||||||
* @return true if this card is valid, false if not
|
* @return true if this card is valid, false if not
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: Deck.java,v 1.6 2004/11/01 22:10:21 andrzej Exp $
|
// $Id$
|
||||||
//
|
//
|
||||||
// Narya library - tools for developing networked games
|
// Narya library - tools for developing networked games
|
||||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||||
@@ -107,9 +107,9 @@ public class Deck implements CardCodes,
|
|||||||
else {
|
else {
|
||||||
Hand hand = new Hand();
|
Hand hand = new Hand();
|
||||||
|
|
||||||
|
int cardsLeft = cards.size();
|
||||||
for (int i=0;i<size;i++) {
|
for (int i=0;i<size;i++) {
|
||||||
hand.cards.add(cards.get(cards.size()-1));
|
hand.cards.add(cards.remove(--cardsLeft));
|
||||||
cards.remove(cards.size()-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return hand;
|
return hand;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: CardGameManager.java,v 1.5 2004/10/15 18:20:28 andrzej Exp $
|
// $Id$
|
||||||
//
|
//
|
||||||
// Narya library - tools for developing networked games
|
// Narya library - tools for developing networked games
|
||||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||||
@@ -32,8 +32,8 @@ import com.threerings.parlor.game.GameManager;
|
|||||||
import com.threerings.presents.dobj.MessageEvent;
|
import com.threerings.presents.dobj.MessageEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A manager class for card games. Handles common functions like dealing hands
|
* A manager class for card games. Handles common functions like dealing
|
||||||
* of cards to all players.
|
* hands of cards to all players.
|
||||||
*/
|
*/
|
||||||
public class CardGameManager extends GameManager
|
public class CardGameManager extends GameManager
|
||||||
implements CardCodes
|
implements CardCodes
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: TrickCardGameControllerDelegate.java,v 1.4 2004/10/15 18:20:28 andrzej Exp $
|
// $Id$
|
||||||
//
|
//
|
||||||
// Narya library - tools for developing networked games
|
// Narya library - tools for developing networked games
|
||||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||||
@@ -29,14 +29,16 @@ import com.threerings.presents.dobj.AttributeChangedEvent;
|
|||||||
* A card game controller delegate for trick-based card games, such as
|
* A card game controller delegate for trick-based card games, such as
|
||||||
* Spades and Hearts.
|
* Spades and Hearts.
|
||||||
*/
|
*/
|
||||||
public class TrickCardGameControllerDelegate extends TurnGameControllerDelegate
|
public class TrickCardGameControllerDelegate
|
||||||
|
extends TurnGameControllerDelegate
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param controller the game controller
|
* @param controller the game controller
|
||||||
*/
|
*/
|
||||||
public TrickCardGameControllerDelegate (TrickCardGameController controller)
|
public TrickCardGameControllerDelegate (TrickCardGameController
|
||||||
|
controller)
|
||||||
{
|
{
|
||||||
super(controller);
|
super(controller);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: TrickCardGameManagerDelegate.java,v 1.4 2004/10/15 18:20:28 andrzej Exp $
|
// $Id$
|
||||||
//
|
//
|
||||||
// Narya library - tools for developing networked games
|
// Narya library - tools for developing networked games
|
||||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||||
@@ -48,7 +48,8 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate
|
|||||||
// Documentation inherited.
|
// Documentation inherited.
|
||||||
public void setFirstTurnHolder ()
|
public void setFirstTurnHolder ()
|
||||||
{
|
{
|
||||||
if (_trickCardGame.getPlayingHand() && _trickCardGame.getPlayingTrick()) {
|
if (_trickCardGame.getPlayingHand() &&
|
||||||
|
_trickCardGame.getPlayingTrick()) {
|
||||||
super.setFirstTurnHolder();
|
super.setFirstTurnHolder();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -59,7 +60,8 @@ public class TrickCardGameManagerDelegate extends TurnGameManagerDelegate
|
|||||||
// Documentation inherited.
|
// Documentation inherited.
|
||||||
public void setNextTurnHolder ()
|
public void setNextTurnHolder ()
|
||||||
{
|
{
|
||||||
if (_trickCardGame.getPlayingHand() && _trickCardGame.getPlayingTrick()) {
|
if (_trickCardGame.getPlayingHand() &&
|
||||||
|
_trickCardGame.getPlayingTrick()) {
|
||||||
super.setNextTurnHolder();
|
super.setNextTurnHolder();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user