Created a PartyGameConfig interface and rejiggered party game support a
bit to incorporate it. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2261 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: GameConfig.java,v 1.13 2002/10/06 00:53:15 mdb Exp $
|
||||
// $Id: GameConfig.java,v 1.14 2003/02/12 05:34:53 mdb Exp $
|
||||
|
||||
package com.threerings.parlor.game;
|
||||
|
||||
@@ -40,15 +40,6 @@ public abstract class GameConfig extends PlaceConfig
|
||||
*/
|
||||
public abstract Class getConfiguratorClass ();
|
||||
|
||||
/**
|
||||
* Returns whether this game is a party game. The default
|
||||
* implementation returns false.
|
||||
*/
|
||||
public boolean isPartyGame ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this game config object is equal to the supplied
|
||||
* object (meaning it is also a game config object and its
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: GameController.java,v 1.20 2002/09/20 04:53:42 mdb Exp $
|
||||
// $Id: GameController.java,v 1.21 2003/02/12 05:34:53 mdb Exp $
|
||||
|
||||
package com.threerings.parlor.game;
|
||||
|
||||
@@ -236,6 +236,15 @@ public abstract class GameController extends PlaceController
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine if this game is a party game.
|
||||
*/
|
||||
protected boolean isPartyGame ()
|
||||
{
|
||||
return ((_config instanceof PartyGameConfig) &&
|
||||
((PartyGameConfig)_config).isPartyGame());
|
||||
}
|
||||
|
||||
/** A reference to the active parlor context. */
|
||||
protected ParlorContext _ctx;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: GameManager.java,v 1.59 2003/01/03 02:47:33 shaper Exp $
|
||||
// $Id: GameManager.java,v 1.60 2003/02/12 05:34:53 mdb Exp $
|
||||
|
||||
package com.threerings.parlor.game;
|
||||
|
||||
@@ -414,7 +414,7 @@ public class GameManager extends PlaceManager
|
||||
*/
|
||||
protected boolean needsNoShowTimer ()
|
||||
{
|
||||
return !_gameconfig.isPartyGame();
|
||||
return !isPartyGame();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
@@ -474,7 +474,7 @@ public class GameManager extends PlaceManager
|
||||
{
|
||||
// start up the game if we're not a party game and if we haven't
|
||||
// already done so
|
||||
if (!_gameconfig.isPartyGame() &&
|
||||
if (!isPartyGame() &&
|
||||
_gameobj.state == GameObject.AWAITING_PLAYERS) {
|
||||
startGame();
|
||||
}
|
||||
@@ -773,7 +773,7 @@ public class GameManager extends PlaceManager
|
||||
// perfectly normal to receive a player ready notification
|
||||
// from a user entering a party game in which they're not yet
|
||||
// a participant
|
||||
if (!_gameconfig.isPartyGame()) {
|
||||
if (!isPartyGame()) {
|
||||
Log.warning("Received playerReady() from non-player? " +
|
||||
"[caller=" + caller + "].");
|
||||
}
|
||||
@@ -820,7 +820,7 @@ public class GameManager extends PlaceManager
|
||||
public void startPartyGame (ClientObject caller)
|
||||
{
|
||||
// make sure this is a party game
|
||||
if (!_gameconfig.isPartyGame()) {
|
||||
if (!isPartyGame()) {
|
||||
Log.warning("Attempt to player-start a non-party game " +
|
||||
"[game=" + _gameobj.which() +
|
||||
", caller=" + caller + "].");
|
||||
@@ -928,6 +928,15 @@ public class GameManager extends PlaceManager
|
||||
protected byte _level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to determine if this game is a party game.
|
||||
*/
|
||||
protected boolean isPartyGame ()
|
||||
{
|
||||
return ((_gameconfig instanceof PartyGameConfig) &&
|
||||
((PartyGameConfig)_gameconfig).isPartyGame());
|
||||
}
|
||||
|
||||
/** A reference to our game config. */
|
||||
protected GameConfig _gameconfig;
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// $Id: PartyGameConfig.java,v 1.1 2003/02/12 05:34:53 mdb Exp $
|
||||
|
||||
package com.threerings.parlor.game;
|
||||
|
||||
import com.threerings.parlor.data.TableConfig;
|
||||
|
||||
/**
|
||||
* Provides additional information for party games.
|
||||
*/
|
||||
public interface PartyGameConfig extends TableConfig
|
||||
{
|
||||
/**
|
||||
* Returns true if this party game is being played in party game mode,
|
||||
* false if it is not.
|
||||
*/
|
||||
public boolean isPartyGame ();
|
||||
|
||||
/**
|
||||
* Configures this game config as a party game or not.
|
||||
*/
|
||||
public void setPartyGame (boolean isPartyGame);
|
||||
|
||||
/**
|
||||
* Returns an array of strings that describe the configuration of this
|
||||
* party game. This should eventually be rolled into a more general
|
||||
* purpose mechanism for generating descriptions of game
|
||||
* configurations as well as editors for game configurations (which
|
||||
* already exists in rudimentary form).
|
||||
*/
|
||||
public String[] getPartyDescription ();
|
||||
}
|
||||
Reference in New Issue
Block a user