More updates.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2882 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: PuzzlePanel.java,v 1.1 2003/11/26 01:42:34 mdb Exp $
|
||||
// $Id: PuzzlePanel.java,v 1.2 2003/11/26 17:46:06 mdb Exp $
|
||||
|
||||
package com.threerings.puzzle.client;
|
||||
|
||||
@@ -48,10 +48,6 @@ public abstract class PuzzlePanel extends JPanel
|
||||
_xlate = getKeyTranslator();
|
||||
_ctx.getKeyboardManager().setTarget(this, _xlate);
|
||||
|
||||
// leave the keyboard manager disabled to start, and set things up
|
||||
// for chatting
|
||||
setPuzzleGrabsKeys(false);
|
||||
|
||||
// configure the puzzle panel
|
||||
setLayout(new BorderLayout());
|
||||
|
||||
@@ -59,12 +55,22 @@ public abstract class PuzzlePanel extends JPanel
|
||||
_bview = createBoardView(ctx);
|
||||
|
||||
// create the puzzle board panel
|
||||
_bpanel = createBoardPanel();
|
||||
_bpanel = createBoardPanel(ctx);
|
||||
|
||||
// add the board panel
|
||||
add(_bpanel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
public void addNotify ()
|
||||
{
|
||||
super.addNotify();
|
||||
|
||||
// leave the keyboard manager disabled to start, and set things up
|
||||
// for chatting
|
||||
setPuzzleGrabsKeys(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporarily replaces the puzzle board display with the supplied
|
||||
* overlay panel. The panel can be removed and the board display
|
||||
@@ -184,7 +190,7 @@ public abstract class PuzzlePanel extends JPanel
|
||||
* derived panel is responsible for making sure that the board view is
|
||||
* present in the board panel.
|
||||
*/
|
||||
protected abstract JPanel createBoardPanel ();
|
||||
protected abstract JPanel createBoardPanel (PuzzleContext ctx);
|
||||
|
||||
/**
|
||||
* Returns a key translator with the desired key to controller command
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: PuzzleManager.java,v 1.2 2003/11/26 02:07:45 mdb Exp $
|
||||
// $Id: PuzzleManager.java,v 1.3 2003/11/26 17:46:06 mdb Exp $
|
||||
|
||||
package com.threerings.puzzle.server;
|
||||
|
||||
@@ -165,6 +165,17 @@ public abstract class PuzzleManager extends GameManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether game conclusion antics such as rating updates
|
||||
* should be performed when an in-play game is ended. Derived classes
|
||||
* may wish to override this method to customize the conditions under
|
||||
* which the game is concluded.
|
||||
*/
|
||||
public boolean shouldConcludeGame ()
|
||||
{
|
||||
return (_puzobj.state == PuzzleObject.GAME_OVER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when a player has been marked as knocked out but before the
|
||||
* knock-out status update has been sent to the players. Any status
|
||||
@@ -407,6 +418,13 @@ public abstract class PuzzleManager extends GameManager
|
||||
// send along one final status update
|
||||
sendStatusUpdate();
|
||||
|
||||
// report the winners and losers if appropriate
|
||||
int winnerCount = _puzobj.getWinnerCount();
|
||||
boolean draw = (winnerCount == getPlayerCount());
|
||||
if (shouldConcludeGame() && winnerCount > 0 && !draw) {
|
||||
reportWinnersAndLosers();
|
||||
}
|
||||
|
||||
super.gameDidEnd();
|
||||
}
|
||||
|
||||
@@ -470,17 +488,6 @@ public abstract class PuzzleManager extends GameManager
|
||||
_invmgr.clearDispatcher(_puzobj.puzzleGameService);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether game conclusion antics such as rating updates
|
||||
* should be performed when an in-play game is ended. Derived classes
|
||||
* may wish to override this method to customize the conditions under
|
||||
* which the game is concluded.
|
||||
*/
|
||||
protected boolean shouldConcludeGame ()
|
||||
{
|
||||
return (_puzobj.state == PuzzleObject.GAME_OVER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies progress updates received from the client. If puzzle
|
||||
* debugging is enabled, this also compares the client board dumps
|
||||
|
||||
Reference in New Issue
Block a user