A simple extensible tournament management framework
git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@194 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Vilya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2006 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/vilya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.parlor.tourney.data;
|
||||
|
||||
import com.samskivert.util.ResultListener;
|
||||
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
/**
|
||||
* Extensible entry fee class that specifies entry requirements for a tourney.
|
||||
*/
|
||||
public abstract class EntryFee extends SimpleStreamableObject
|
||||
{
|
||||
/**
|
||||
* Returns a description of the entry fee.
|
||||
*/
|
||||
public abstract String getDescription ();
|
||||
|
||||
/**
|
||||
* Checks if the user has the required entry fee.
|
||||
*/
|
||||
public abstract boolean hasFee (BodyObject body);
|
||||
|
||||
/**
|
||||
* Attempts to reserve the entry fee.
|
||||
*/
|
||||
public abstract void reserveFee (BodyObject body, ResultListener listener);
|
||||
|
||||
/**
|
||||
* Returns the entry fee.
|
||||
*/
|
||||
public abstract void returnFee (BodyObject body);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Vilya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2006 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/vilya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.parlor.tourney.data;
|
||||
|
||||
import java.lang.Comparable;
|
||||
|
||||
import com.threerings.util.Name;
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
import com.threerings.presents.dobj.DSet;
|
||||
|
||||
/**
|
||||
* Contains information on a particular tourney participant.
|
||||
*/
|
||||
public class Participant extends SimpleStreamableObject
|
||||
implements DSet.Entry, Comparable
|
||||
{
|
||||
/** The username of the participant. */
|
||||
public Name username;
|
||||
|
||||
// documentation inherited from interface DSet.Entry
|
||||
public Comparable getKey ()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Comparable
|
||||
public int compareTo (Object o)
|
||||
{
|
||||
Participant op = (Participant)o;
|
||||
return username.compareTo(op.username);
|
||||
}
|
||||
|
||||
// documentation inherited from interface Comparable
|
||||
public boolean equals (Object other)
|
||||
{
|
||||
if (other instanceof Participant) {
|
||||
return ((Participant) other).username.equals(username);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public String toString ()
|
||||
{
|
||||
return username.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Vilya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2006 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/vilya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.parlor.tourney.data;
|
||||
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
/**
|
||||
* Extensible class that specifies the prize for a tourney.
|
||||
*/
|
||||
public abstract class Prize extends SimpleStreamableObject
|
||||
{
|
||||
/**
|
||||
* Returns a description of the prize.
|
||||
*/
|
||||
public abstract String getDescription ();
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Vilya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2006 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/vilya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.parlor.tourney.data;
|
||||
|
||||
import com.threerings.presents.data.InvocationCodes;
|
||||
|
||||
/**
|
||||
* Constants and codes relating to the tourney services.
|
||||
*/
|
||||
public interface TourneyCodes extends InvocationCodes
|
||||
{
|
||||
/** Too late to join a tourney. */
|
||||
public static final String TOO_LATE = "m.too_late";
|
||||
|
||||
/** User already in a tourney. */
|
||||
public static final String ALREADY_IN_TOURNEY = "m.already_in_tourney";
|
||||
|
||||
/** User failed to meet the entry fee requirements. */
|
||||
public static final String FAILED_ENTRY_FEE = "m.failed_entry_fee";
|
||||
|
||||
/** It's too late to leave the tourney. */
|
||||
public static final String TOO_LATE_LEAVE = "m.too_late_leave";
|
||||
|
||||
/** User is not in the tourney. */
|
||||
public static final String NOT_IN_TOURNEY = "m.not_in_tourney";
|
||||
|
||||
/** The tourney is already in progress. */
|
||||
public static final String ALREADY_IN_PROGRESS = "m.already_in_progress";
|
||||
|
||||
/** This tourney has participating players. */
|
||||
public static final String HAS_PLAYERS = "m.has_players";
|
||||
|
||||
/** The tournament was canceled. */
|
||||
public static final String CANCELLED = "m.cancelled";
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Vilya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2006 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/vilya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.parlor.tourney.data;
|
||||
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
import com.threerings.presents.dobj.DSet;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
/**
|
||||
* Stores tournament configuration data.
|
||||
*/
|
||||
public class TourneyConfig extends SimpleStreamableObject
|
||||
{
|
||||
/** Our unique tourney id. */
|
||||
public int tourneyId;
|
||||
|
||||
/** The prize for this tourney. */
|
||||
public Prize prize;
|
||||
|
||||
/** The fee to join the tourney. */
|
||||
public EntryFee entryFee;
|
||||
|
||||
/** The tourney creator. */
|
||||
public Name creator;
|
||||
|
||||
/** The minimum number of players needed for the tourney to start. */
|
||||
public int minPlayers;
|
||||
|
||||
/** The number of minutes to wait for entrants before starting. */
|
||||
public int startsIn;
|
||||
|
||||
/** The tournament logic runtime persistent data. */
|
||||
public TourneyLogicData logic;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Vilya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2006 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/vilya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.parlor.tourney.data;
|
||||
|
||||
import com.threerings.io.SimpleStreamableObject;
|
||||
|
||||
/**
|
||||
* Contains TourneyLogic runtime data that should be persisted.
|
||||
*/
|
||||
public class TourneyLogicData extends SimpleStreamableObject
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Vilya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2006 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/vilya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.parlor.tourney.data;
|
||||
|
||||
import com.threerings.parlor.tourney.client.TourneyService;
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
import com.threerings.presents.dobj.InvocationResponseEvent;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the {@link TourneyService} interface
|
||||
* that marshalls the arguments and delivers the request to the provider
|
||||
* on the server. Also provides an implementation of the response listener
|
||||
* interfaces that marshall the response arguments and deliver them back
|
||||
* to the requesting client.
|
||||
*/
|
||||
public class TourneyMarshaller extends InvocationMarshaller
|
||||
implements TourneyService
|
||||
{
|
||||
/** The method id used to dispatch {@link #cancel} requests. */
|
||||
public static final int CANCEL = 1;
|
||||
|
||||
// from interface TourneyService
|
||||
public void cancel (Client arg1, InvocationService.ConfirmListener arg2)
|
||||
{
|
||||
InvocationMarshaller.ConfirmMarshaller listener2 = new InvocationMarshaller.ConfirmMarshaller();
|
||||
listener2.listener = arg2;
|
||||
sendRequest(arg1, CANCEL, new Object[] {
|
||||
listener2
|
||||
});
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #join} requests. */
|
||||
public static final int JOIN = 2;
|
||||
|
||||
// from interface TourneyService
|
||||
public void join (Client arg1, InvocationService.ConfirmListener arg2)
|
||||
{
|
||||
InvocationMarshaller.ConfirmMarshaller listener2 = new InvocationMarshaller.ConfirmMarshaller();
|
||||
listener2.listener = arg2;
|
||||
sendRequest(arg1, JOIN, new Object[] {
|
||||
listener2
|
||||
});
|
||||
}
|
||||
|
||||
/** The method id used to dispatch {@link #leave} requests. */
|
||||
public static final int LEAVE = 3;
|
||||
|
||||
// from interface TourneyService
|
||||
public void leave (Client arg1, InvocationService.ConfirmListener arg2)
|
||||
{
|
||||
InvocationMarshaller.ConfirmMarshaller listener2 = new InvocationMarshaller.ConfirmMarshaller();
|
||||
listener2.listener = arg2;
|
||||
sendRequest(arg1, LEAVE, new Object[] {
|
||||
listener2
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Vilya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2006 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/vilya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.parlor.tourney.data;
|
||||
|
||||
import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.dobj.DSet;
|
||||
|
||||
/**
|
||||
* Provides information on a specific tourney.
|
||||
*/
|
||||
public class TourneyObject extends DObject
|
||||
{
|
||||
// AUTO-GENERATED: FIELDS START
|
||||
/** The field name of the <code>state</code> field. */
|
||||
public static final String STATE = "state";
|
||||
|
||||
/** The field name of the <code>config</code> field. */
|
||||
public static final String CONFIG = "config";
|
||||
|
||||
/** The field name of the <code>startsIn</code> field. */
|
||||
public static final String STARTS_IN = "startsIn";
|
||||
|
||||
/** The field name of the <code>tourneyService</code> field. */
|
||||
public static final String TOURNEY_SERVICE = "tourneyService";
|
||||
|
||||
/** The field name of the <code>participants</code> field. */
|
||||
public static final String PARTICIPANTS = "participants";
|
||||
// AUTO-GENERATED: FIELDS END
|
||||
|
||||
/** Tourney is pending and accepting participants. */
|
||||
public static final int PENDING = 0;
|
||||
|
||||
/** Tourney is currently running. */
|
||||
public static final int RUNNING = 1;
|
||||
|
||||
/** Tourney has been cancelled. */
|
||||
public static final int CANCELLED = 2;
|
||||
|
||||
/** Tourney is paused. */
|
||||
public static final int PAUSED = 3;
|
||||
|
||||
/** Tourney has completed. */
|
||||
public static final int FINISHED = 4;
|
||||
|
||||
/** The current state of the tourney. */
|
||||
public int state = PENDING;
|
||||
|
||||
/** The tourney configuration. */
|
||||
public TourneyConfig config;
|
||||
|
||||
/** The real-time number of minutes before it starts. */
|
||||
public int startsIn;
|
||||
|
||||
/** Provides the way in which tourney participants can communicate with the server. */
|
||||
public TourneyMarshaller tourneyService;
|
||||
|
||||
/** A DSet that accumulates Participant records for the players involved in this tourney. */
|
||||
public DSet<Participant> participants = new DSet<Participant>();
|
||||
|
||||
// AUTO-GENERATED: METHODS START
|
||||
/**
|
||||
* Requests that the <code>state</code> field be set to the
|
||||
* specified value. The local value will be updated immediately and an
|
||||
* event will be propagated through the system to notify all listeners
|
||||
* that the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setState (int value)
|
||||
{
|
||||
int ovalue = this.state;
|
||||
requestAttributeChange(
|
||||
STATE, Integer.valueOf(value), Integer.valueOf(ovalue));
|
||||
this.state = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>config</code> field be set to the
|
||||
* specified value. The local value will be updated immediately and an
|
||||
* event will be propagated through the system to notify all listeners
|
||||
* that the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setConfig (TourneyConfig value)
|
||||
{
|
||||
TourneyConfig ovalue = this.config;
|
||||
requestAttributeChange(
|
||||
CONFIG, value, ovalue);
|
||||
this.config = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>startsIn</code> field be set to the
|
||||
* specified value. The local value will be updated immediately and an
|
||||
* event will be propagated through the system to notify all listeners
|
||||
* that the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setStartsIn (int value)
|
||||
{
|
||||
int ovalue = this.startsIn;
|
||||
requestAttributeChange(
|
||||
STARTS_IN, Integer.valueOf(value), Integer.valueOf(ovalue));
|
||||
this.startsIn = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>tourneyService</code> field be set to the
|
||||
* specified value. The local value will be updated immediately and an
|
||||
* event will be propagated through the system to notify all listeners
|
||||
* that the attribute did change. Proxied copies of this object (on
|
||||
* clients) will apply the value change when they received the
|
||||
* attribute changed notification.
|
||||
*/
|
||||
public void setTourneyService (TourneyMarshaller value)
|
||||
{
|
||||
TourneyMarshaller ovalue = this.tourneyService;
|
||||
requestAttributeChange(
|
||||
TOURNEY_SERVICE, value, ovalue);
|
||||
this.tourneyService = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the specified entry be added to the
|
||||
* <code>participants</code> set. The set will not change until the event is
|
||||
* actually propagated through the system.
|
||||
*/
|
||||
public void addToParticipants (Participant elem)
|
||||
{
|
||||
requestEntryAdd(PARTICIPANTS, participants, elem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the entry matching the supplied key be removed from
|
||||
* the <code>participants</code> set. The set will not change until the
|
||||
* event is actually propagated through the system.
|
||||
*/
|
||||
public void removeFromParticipants (Comparable key)
|
||||
{
|
||||
requestEntryRemove(PARTICIPANTS, participants, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the specified entry be updated in the
|
||||
* <code>participants</code> set. The set will not change until the event is
|
||||
* actually propagated through the system.
|
||||
*/
|
||||
public void updateParticipants (Participant elem)
|
||||
{
|
||||
requestEntryUpdate(PARTICIPANTS, participants, elem);
|
||||
}
|
||||
|
||||
/**
|
||||
* Requests that the <code>participants</code> field be set to the
|
||||
* specified value. Generally one only adds, updates and removes
|
||||
* entries of a distributed set, but certain situations call for a
|
||||
* complete replacement of the set value. The local value will be
|
||||
* updated immediately and an event will be propagated through the
|
||||
* system to notify all listeners that the attribute did
|
||||
* change. Proxied copies of this object (on clients) will apply the
|
||||
* value change when they received the attribute changed notification.
|
||||
*/
|
||||
public void setParticipants (DSet<com.threerings.parlor.tourney.data.Participant> value)
|
||||
{
|
||||
requestAttributeChange(PARTICIPANTS, value, this.participants);
|
||||
@SuppressWarnings("unchecked") DSet<com.threerings.parlor.tourney.data.Participant> clone =
|
||||
(value == null) ? null : value.typedClone();
|
||||
this.participants = clone;
|
||||
}
|
||||
// AUTO-GENERATED: METHODS END
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Vilya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2006 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/vilya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.parlor.tourney.data;
|
||||
|
||||
import com.threerings.parlor.tourney.client.TourniesService;
|
||||
import com.threerings.parlor.tourney.data.TourneyConfig;
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
import com.threerings.presents.data.InvocationMarshaller;
|
||||
import com.threerings.presents.dobj.InvocationResponseEvent;
|
||||
|
||||
/**
|
||||
* Provides the implementation of the {@link TourniesService} interface
|
||||
* that marshalls the arguments and delivers the request to the provider
|
||||
* on the server. Also provides an implementation of the response listener
|
||||
* interfaces that marshall the response arguments and deliver them back
|
||||
* to the requesting client.
|
||||
*/
|
||||
public class TourniesMarshaller extends InvocationMarshaller
|
||||
implements TourniesService
|
||||
{
|
||||
/** The method id used to dispatch {@link #createTourney} requests. */
|
||||
public static final int CREATE_TOURNEY = 1;
|
||||
|
||||
// from interface TourniesService
|
||||
public void createTourney (Client arg1, TourneyConfig arg2, InvocationService.ResultListener arg3)
|
||||
{
|
||||
InvocationMarshaller.ResultMarshaller listener3 = new InvocationMarshaller.ResultMarshaller();
|
||||
listener3.listener = arg3;
|
||||
sendRequest(arg1, CREATE_TOURNEY, new Object[] {
|
||||
arg2, listener3
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user