Added 'turn' stuff, and the GameControllerDelegate required to do so.

git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@42 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2006-08-16 00:26:28 +00:00
parent f171848695
commit ee4fc4a8db
5 changed files with 358 additions and 24 deletions
@@ -250,14 +250,10 @@ public /*abstract*/ class GameController extends PlaceController
// clear out our game over flag
setGameOver(false);
/* TODO
// let our delegates do their business
applyToDelegates(new DelegateOp() {
public void apply (PlaceControllerDelegate delegate) {
((GameControllerDelegate)delegate).gameDidStart();
}
applyToDelegates(function (del :GameControllerDelegate) :void {
del.gameDidStart();
});
*/
}
/**
@@ -267,14 +263,10 @@ public /*abstract*/ class GameController extends PlaceController
*/
protected function gameDidEnd () :void
{
/* TODO
// let our delegates do their business
applyToDelegates(new DelegateOp() {
public void apply (PlaceControllerDelegate delegate) {
((GameControllerDelegate)delegate).gameDidEnd();
}
applyToDelegates(function (del :GameControllerDelegate) :void {
del.gameDidEnd();
});
*/
}
/**
@@ -282,14 +274,10 @@ public /*abstract*/ class GameController extends PlaceController
*/
protected function gameWasCancelled () :void
{
/*
// let our delegates do their business
applyToDelegates(new DelegateOp() {
public void apply (PlaceControllerDelegate delegate) {
((GameControllerDelegate)delegate).gameWasCancelled();
}
applyToDelegates(function (del :GameControllerDelegate) :void {
del.gameWasCancelled();
});
*/
}
/**
@@ -299,14 +287,10 @@ public /*abstract*/ class GameController extends PlaceController
*/
protected function gameWillReset () :void
{
/* TODO
// let our delegates do their business
applyToDelegates(new DelegateOp() {
public void apply (PlaceControllerDelegate delegate) {
((GameControllerDelegate)delegate).gameWillReset();
}
applyToDelegates(function (del :GameControllerDelegate) :void {
del.gameWillReset();
});
*/
}
/**
@@ -0,0 +1,75 @@
//
// $Id: GameControllerDelegate.java 3381 2005-03-03 19:36:34Z mdb $
//
// Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved
// http://www.threerings.net/code/narya/
//
// 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.game.client {
import com.threerings.crowd.client.PlaceControllerDelegate;
/**
* Extends the {@link PlaceControllerDelegate} mechanism with game
* controller specific methods.
*/
public class GameControllerDelegate extends PlaceControllerDelegate
{
/**
* Provides the delegate with a reference to the game controller for
* which it is delegating.
*/
public function GameControllerDelegate (ctrl :GameController)
{
super(ctrl);
}
/**
* Called when the game transitions to the <code>IN_PLAY</code>
* state. This happens when all of the players have arrived and the
* server starts the game.
*/
public function gameDidStart () :void
{
}
/**
* Called when the game transitions to the <code>GAME_OVER</code>
* state. This happens when the game reaches some end condition by
* normal means (is not cancelled or aborted).
*/
public function gameDidEnd () :void
{
}
/**
* Called when the game was cancelled for some reason.
*/
public function gameWasCancelled () :void
{
}
/**
* Called to give derived classes a chance to display animations, send
* a final packet, or do any other business they care to do when the
* game is about to reset.
*/
public function gameWillReset () :void
{
}
}
}