www.pudn.com > Bluegammon蓝牙的应用编程.rar > DicesNewTurnAnim.java


// Copyright (c) 2005 Sony Ericsson Mobile Communications AB 
// 
// This software is provided "AS IS," without a warranty of any kind.  
// ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,  
// INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A  
// PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED.  
// 
// THIS SOFTWARE IS COMPLEMENTARY OF JAYWAY AB (www.jayway.se) 
 
package bluegammon.gui.animation; 
 
import bluegammon.gui.BoardCanvas; 
 
/** 
 * Animation of a player throwing his or her two dices at 
 * the start of a new turn. 
 *  
 * @author Peter Andersson 
 */ 
public class DicesNewTurnAnim extends AbstractDicesAnim 
{ 
 
  /** 
   * Creates a new animation on a new turn, throws two dices 
   * of the same color. 
   * @param dicesWhite	True if dices should be white, false otherwise. 
   * @param dice1		Value of first dice (1-6). 
   * @param dice2		Value of second dice (1-6). 
   */ 
  public DicesNewTurnAnim(boolean dicesWhite, int dice1, int dice2) 
  { 
    super(dicesWhite, dicesWhite, dice1, dice2); 
  } 
 
  /** 
   * Prevents interacton and disables drawing of dicevalues. 
   */ 
  public void onStart() 
  { 
    super.onStart(); 
    BoardCanvas.getInstance().allowInteraction(false); 
    BoardCanvas.getInstance().setDrawDiceValues(false); 
  } 
 
  /** 
   * Updates cursor, enables interaction and start 
   * drawing the dicevalues. 
   */ 
  public void onExit() 
  { 
    super.onExit(); 
    BoardCanvas.getInstance().cursorNearestIndex(0,0); 
    BoardCanvas.getInstance().allowInteraction(true); 
    BoardCanvas.getInstance().setDrawDiceValues(true); 
    BoardCanvas.getInstance().updateCursor(); 
  } 
}