Make it easier for drop puzzles to implement their own fancy drop logic

if they've got that burning need to do something out of the ordinary.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@371 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Dave Hoover
2007-07-19 22:38:32 +00:00
parent 9d4a41f54f
commit c8b2f7212b
2 changed files with 21 additions and 5 deletions
@@ -144,7 +144,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
// create the piece dropper if appropriate // create the piece dropper if appropriate
PieceDropLogic pdl = getPieceDropLogic(); PieceDropLogic pdl = getPieceDropLogic();
if (pdl != null) { if (pdl != null) {
_dropper = new PieceDropper(pdl); _dropper = getPieceDropper(pdl);
} }
} }
@@ -867,7 +867,7 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
} }
/** /**
* Returns the piece dropper used to drop any pieces that need * Returns the piece drop logic used to drop any pieces that need
* dropping in the board. Derived classes that intend to make use of * dropping in the board. Derived classes that intend to make use of
* {@link #dropPieces} must implement this method and return a * {@link #dropPieces} must implement this method and return a
* reference to their game-specific piece dropper implementation. * reference to their game-specific piece dropper implementation.
@@ -877,6 +877,14 @@ public abstract class DropControllerDelegate extends PuzzleControllerDelegate
return null; return null;
} }
/**
* Returns the piece dropper used to drop any pieces that need dropping in the board.
*/
protected PieceDropper getPieceDropper (PieceDropLogic logic)
{
return new PieceDropper(logic);
}
// documentation inherited // documentation inherited
public void tick (long tickStamp) public void tick (long tickStamp)
{ {
@@ -106,7 +106,7 @@ public abstract class DropManagerDelegate extends PuzzleManagerDelegate
// create the piece dropper if appropriate // create the piece dropper if appropriate
PieceDropLogic pdl = getPieceDropLogic(); PieceDropLogic pdl = getPieceDropLogic();
if (pdl != null) { if (pdl != null) {
_dropper = new PieceDropper(pdl); _dropper = getPieceDropper(pdl);
} }
} }
@@ -132,14 +132,22 @@ public abstract class DropManagerDelegate extends PuzzleManagerDelegate
} }
/** /**
* Returns the piece drop logic used to drop any pieces that need * Returns the piece drop logic used to drop any pieces that need dropping in the board.
* dropping in the board.
*/ */
protected PieceDropLogic getPieceDropLogic () protected PieceDropLogic getPieceDropLogic ()
{ {
return null; return null;
} }
/**
* Returns the piece dropper used to drop any pieces that need dropping in the board.
*/
protected PieceDropper getPieceDropper (PieceDropLogic logic)
{
return new PieceDropper(logic);
}
/** /**
* This method should be called by derived classes whenever the player * This method should be called by derived classes whenever the player
* successfully places a drop block. * successfully places a drop block.