Files
narya/src/java/com/threerings/parlor/game/GameDispatcher.java
T
Walter Korman dbdfd1bad0 Initial support for creating, joining and starting party games that are
created by a particular player; may be subsequently joined by other
players; and started when any game-specific prerequisites are satisfied by
the creating player submitting a GameService.startPartyGame() request.
We'll likely be adding a bit more soon to allow watching players to join a
party game that hasn't yet started.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1667 542714f4-19e9-0310-aa3c-eee0fc999fb1
2002-09-06 22:52:27 +00:00

61 lines
1.6 KiB
Java

//
// $Id: GameDispatcher.java,v 1.3 2002/09/06 22:52:27 shaper Exp $
package com.threerings.parlor.game;
import com.threerings.parlor.game.GameMarshaller;
import com.threerings.parlor.game.GameService;
import com.threerings.presents.client.Client;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.server.InvocationDispatcher;
import com.threerings.presents.server.InvocationException;
/**
* Dispatches requests to the {@link GameProvider}.
*/
public class GameDispatcher extends InvocationDispatcher
{
/**
* Creates a dispatcher that may be registered to dispatch invocation
* service requests for the specified provider.
*/
public GameDispatcher (GameProvider provider)
{
this.provider = provider;
}
// documentation inherited
public InvocationMarshaller createMarshaller ()
{
return new GameMarshaller();
}
// documentation inherited
public void dispatchRequest (
ClientObject source, int methodId, Object[] args)
throws InvocationException
{
switch (methodId) {
case GameMarshaller.PLAYER_READY:
((GameProvider)provider).playerReady(
source
);
return;
case GameMarshaller.START_PARTY_GAME:
((GameProvider)provider).startPartyGame(
source
);
return;
default:
super.dispatchRequest(source, methodId, args);
}
}
// Generated on 12:49:14 09/06/02.
}