diff --git a/src/java/com/threerings/crowd/util/CrowdContext.java b/src/java/com/threerings/crowd/util/CrowdContext.java index a365d048f..aed41c275 100644 --- a/src/java/com/threerings/crowd/util/CrowdContext.java +++ b/src/java/com/threerings/crowd/util/CrowdContext.java @@ -1,5 +1,5 @@ // -// $Id: CrowdContext.java,v 1.9 2004/08/27 02:12:34 mdb Exp $ +// $Id$ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -26,6 +26,8 @@ import com.threerings.crowd.client.LocationDirector; import com.threerings.crowd.client.OccupantDirector; import com.threerings.crowd.client.PlaceView; +import com.threerings.crowd.chat.client.ChatDirector; + /** * The crowd context provides access to the various managers, etc. that * are needed by the crowd client code. @@ -42,6 +44,11 @@ public interface CrowdContext extends PresentsContext */ public OccupantDirector getOccupantDirector (); + /** + * Provides access to the chat director. + */ + public ChatDirector getChatDirector (); + /** * When the client enters a new place, the location director creates a * place controller which then creates a place view to visualize the diff --git a/src/java/com/threerings/micasa/client/MiCasaClient.java b/src/java/com/threerings/micasa/client/MiCasaClient.java index 2c6664642..e14950d55 100644 --- a/src/java/com/threerings/micasa/client/MiCasaClient.java +++ b/src/java/com/threerings/micasa/client/MiCasaClient.java @@ -1,5 +1,5 @@ // -// $Id: MiCasaClient.java,v 1.19 2004/08/27 02:12:49 mdb Exp $ +// $Id$ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -37,6 +37,8 @@ import com.threerings.crowd.client.LocationDirector; import com.threerings.crowd.client.OccupantDirector; import com.threerings.crowd.client.PlaceView; +import com.threerings.crowd.chat.client.ChatDirector; + import com.threerings.parlor.client.ParlorDirector; import com.threerings.micasa.util.MiCasaContext; @@ -123,6 +125,7 @@ public class MiCasaClient _occdir = new OccupantDirector(_ctx); _pardtr = new ParlorDirector(_ctx); _msgmgr = new MessageManager(MESSAGE_MANAGER_PREFIX); + _chatdir = new ChatDirector(_ctx, _msgmgr, null); } // documentation inherited @@ -173,6 +176,11 @@ public class MiCasaClient return _occdir; } + public ChatDirector getChatDirector () + { + return _chatdir; + } + public ParlorDirector getParlorDirector () { return _pardtr; @@ -207,6 +215,7 @@ public class MiCasaClient protected Client _client; protected LocationDirector _locdir; protected OccupantDirector _occdir; + protected ChatDirector _chatdir; protected ParlorDirector _pardtr; protected MessageManager _msgmgr; diff --git a/src/java/com/threerings/micasa/simulator/client/SimpleClient.java b/src/java/com/threerings/micasa/simulator/client/SimpleClient.java index be5b0fc9c..a3161a823 100644 --- a/src/java/com/threerings/micasa/simulator/client/SimpleClient.java +++ b/src/java/com/threerings/micasa/simulator/client/SimpleClient.java @@ -1,5 +1,5 @@ // -// $Id: SimpleClient.java,v 1.12 2004/08/27 02:12:52 mdb Exp $ +// $Id$ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -39,6 +39,8 @@ import com.threerings.crowd.client.LocationDirector; import com.threerings.crowd.client.OccupantDirector; import com.threerings.crowd.client.PlaceView; +import com.threerings.crowd.chat.client.ChatDirector; + import com.threerings.parlor.client.ParlorDirector; import com.threerings.parlor.util.ParlorContext; @@ -62,6 +64,7 @@ public class SimpleClient _locdir = new LocationDirector(_ctx); _occdir = new OccupantDirector(_ctx); _pardtr = new ParlorDirector(_ctx); + _chatdir = new ChatDirector(_ctx, _msgmgr, null); // keep this for later _frame = frame; @@ -146,6 +149,11 @@ public class SimpleClient return _pardtr; } + public ChatDirector getChatDirector () + { + return _chatdir; + } + public void setPlaceView (PlaceView view) { // stick the place view into our frame @@ -177,5 +185,6 @@ public class SimpleClient protected LocationDirector _locdir; protected OccupantDirector _occdir; protected ParlorDirector _pardtr; + protected ChatDirector _chatdir; } diff --git a/src/java/com/threerings/parlor/game/GameCodes.java b/src/java/com/threerings/parlor/game/GameCodes.java index da5159c25..40dd0ebaa 100644 --- a/src/java/com/threerings/parlor/game/GameCodes.java +++ b/src/java/com/threerings/parlor/game/GameCodes.java @@ -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"; } diff --git a/src/java/com/threerings/parlor/game/GameController.java b/src/java/com/threerings/parlor/game/GameController.java index c0d249bbe..dd971d1ac 100644 --- a/src/java/com/threerings/parlor/game/GameController.java +++ b/src/java/com/threerings/parlor/game/GameController.java @@ -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) { diff --git a/src/java/com/threerings/parlor/game/GameObject.dobj b/src/java/com/threerings/parlor/game/GameObject.dobj index 32ecfdc1d..234f72f0d 100644 --- a/src/java/com/threerings/parlor/game/GameObject.dobj +++ b/src/java/com/threerings/parlor/game/GameObject.dobj @@ -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 diff --git a/src/java/com/threerings/puzzle/client/PuzzleController.java b/src/java/com/threerings/puzzle/client/PuzzleController.java index d5f80fea8..566cada13 100644 --- a/src/java/com/threerings/puzzle/client/PuzzleController.java +++ b/src/java/com/threerings/puzzle/client/PuzzleController.java @@ -1,5 +1,5 @@ // -// $Id: PuzzleController.java,v 1.20 2004/11/12 20:03:35 ray Exp $ +// $Id$ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -258,9 +258,6 @@ public abstract class PuzzleController extends GameController { super.willEnterPlace(plobj); - // register the puzzle object's chat - _pctx.getChatDirector().addAuxiliarySource(plobj, PUZZLE_CHAT_TYPE); - // get a casted reference to our puzzle object _puzobj = (PuzzleObject)plobj; _puzobj.addListener(_kolist); @@ -298,9 +295,6 @@ public abstract class PuzzleController extends GameController // clean up and clear out clearAction(); - // unregister the puzzle object's chat - _pctx.getChatDirector().removeAuxiliarySource(plobj); - // stop listening to key events.. _pctx.getKeyDispatcher().removeGlobalKeyListener(_globalKeyListener); @@ -334,14 +328,6 @@ public abstract class PuzzleController extends GameController return true; } - /** - * A way for controllers to display a puzzle-related system message. - */ - public void systemMessage (String bundle, String msg) - { - _pctx.getChatDirector().displayInfo(bundle, msg, PUZZLE_CHAT_TYPE); - } - // documentation inherited public void attributeChanged (AttributeChangedEvent event) { diff --git a/src/java/com/threerings/puzzle/data/PuzzleCodes.java b/src/java/com/threerings/puzzle/data/PuzzleCodes.java index 54fd97dc0..1b0628c2e 100644 --- a/src/java/com/threerings/puzzle/data/PuzzleCodes.java +++ b/src/java/com/threerings/puzzle/data/PuzzleCodes.java @@ -1,5 +1,5 @@ // -// $Id: PuzzleCodes.java,v 1.6 2004/10/28 19:20:27 mdb Exp $ +// $Id$ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -31,9 +31,6 @@ public interface PuzzleCodes extends InvocationCodes /** The message bundle identifier for general puzzle messages. */ public static final String PUZZLE_MESSAGE_BUNDLE = "puzzle.general"; - /** The ID for puzzle chat. */ - public static final String PUZZLE_CHAT_TYPE = "puzzleChat"; - /** The default puzzle difficulty level. */ public static final int DEFAULT_DIFFICULTY = 2; diff --git a/src/java/com/threerings/puzzle/util/PuzzleContext.java b/src/java/com/threerings/puzzle/util/PuzzleContext.java index 7e2f83369..b8c1cb4c5 100644 --- a/src/java/com/threerings/puzzle/util/PuzzleContext.java +++ b/src/java/com/threerings/puzzle/util/PuzzleContext.java @@ -1,5 +1,5 @@ // -// $Id: PuzzleContext.java,v 1.5 2004/08/27 02:20:33 mdb Exp $ +// $Id$ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -29,7 +29,6 @@ import com.threerings.util.Name; import com.threerings.media.FrameManager; import com.threerings.media.sound.SoundManager; -import com.threerings.crowd.chat.client.ChatDirector; import com.threerings.parlor.util.ParlorContext; /** @@ -66,9 +65,4 @@ public interface PuzzleContext extends ParlorContext * Provides access to the sound manager. */ public SoundManager getSoundManager (); - - /** - * Provides access to the chat director. - */ - public ChatDirector getChatDirector (); }