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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 ();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user