Oh the humanity. Modified the turn game services to be a "mix-in" using
the bastard Java technique of delegates and interfaces. I feel like I'm doing OOP with one hand tied behind my back. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@989 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,41 +1,31 @@
|
||||
//
|
||||
// $Id: TurnGameObject.java,v 1.1 2002/02/08 23:55:25 mdb Exp $
|
||||
// $Id: TurnGameObject.java,v 1.2 2002/02/12 06:57:30 mdb Exp $
|
||||
|
||||
package com.threerings.parlor.turn;
|
||||
|
||||
import com.threerings.parlor.game.GameObject;
|
||||
|
||||
/**
|
||||
* Extends the basic game object with support for turn-based games.
|
||||
* Games that wish to support turn-based play must implement this
|
||||
* interface with their {@link GameObject}.
|
||||
*/
|
||||
public class TurnGameObject extends GameObject
|
||||
public interface TurnGameObject
|
||||
{
|
||||
/** The field name of the <code>turnHolder</code> field. */
|
||||
public static final String TURN_HOLDER = "turnHolder";
|
||||
/**
|
||||
* Returns the distributed object field name of the
|
||||
* <code>turnHolder</code> field in the object that implements this
|
||||
* interface.
|
||||
*/
|
||||
public String getTurnHolderFieldName ();
|
||||
|
||||
/** The username of the player who is currently taking their turn in
|
||||
* this turn-based game or null if no user currently holds the
|
||||
* turn. */
|
||||
public String turnHolder;
|
||||
/**
|
||||
* Returns the username of the player who is currently taking their
|
||||
* turn in this turn-based game or null if no user currently holds the
|
||||
* turn.
|
||||
*/
|
||||
public String getTurnHolder ();
|
||||
|
||||
/**
|
||||
* Requests that the <code>turnHolder</code> field be set to the specified
|
||||
* value.
|
||||
*/
|
||||
public void setTurnHolder (String turnHolder)
|
||||
{
|
||||
requestAttributeChange(TURN_HOLDER, turnHolder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>turnHolder</code> field be set to the
|
||||
* specified value and immediately updates the state of the object
|
||||
* to reflect the change. This should <em>only</em> be called on the
|
||||
* server and only then if you know what you're doing.
|
||||
*/
|
||||
public void setTurnHolderImmediate (String turnHolder)
|
||||
{
|
||||
this.turnHolder = turnHolder;
|
||||
requestAttributeChange(TURN_HOLDER, turnHolder);
|
||||
}
|
||||
public void setTurnHolder (String turnHolder);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user