Moved standard puzzle chat up to the game level, so that all games
can broadcast chat messages on their object.. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3237 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -31,4 +31,7 @@ public interface GameCodes extends InvocationCodes
|
||||
/** The name of the message event to a placeObject that reports
|
||||
* the winners and losers of a game. */
|
||||
public static final String WINNERS_AND_LOSERS = "winnersAndLosers";
|
||||
|
||||
/** A chat type for chatting on the game object. */
|
||||
public static final String GAME_CHAT_TYPE = "gameChat";
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: GameController.java,v 1.25 2004/08/27 02:20:14 mdb Exp $
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
@@ -82,6 +82,9 @@ public abstract class GameController extends PlaceController
|
||||
// obtain a casted reference
|
||||
_gobj = (GameObject)plobj;
|
||||
|
||||
_ctx.getChatDirector().addAuxiliarySource(
|
||||
_gobj, GameCodes.GAME_CHAT_TYPE);
|
||||
|
||||
// and add ourselves as a listener
|
||||
_gobj.addListener(this);
|
||||
|
||||
@@ -107,6 +110,8 @@ public abstract class GameController extends PlaceController
|
||||
{
|
||||
super.didLeavePlace(plobj);
|
||||
|
||||
_ctx.getChatDirector().removeAuxiliarySource(_gobj);
|
||||
|
||||
// unlisten to the game object
|
||||
_gobj.removeListener(this);
|
||||
_gobj = null;
|
||||
@@ -168,6 +173,15 @@ public abstract class GameController extends PlaceController
|
||||
return super.handleAction(action);
|
||||
}
|
||||
|
||||
/**
|
||||
* A way for controllers to display a game-related system message.
|
||||
*/
|
||||
public void systemMessage (String bundle, String msg)
|
||||
{
|
||||
_ctx.getChatDirector().displayInfo(
|
||||
bundle, msg, GameCodes.GAME_CHAT_TYPE);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void attributeChanged (AttributeChangedEvent event)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: GameObject.dobj,v 1.23 2004/09/13 16:11:10 mdb Exp $
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
|
||||
|
||||
Reference in New Issue
Block a user