Regulates the length of time consumed by a player making a move. Basically just listens for
turn changes and dispatches events when a certain amount of time has passed. Reduces the amount
of time allowed for a player's turn each time that player misses, reducing the annoyance of
other players if someone goes AFK or offline or just isn't fast enough. The base turn time is
restored within a small number of turns if the player returns to making moves.
protected var _amInControl:Function
protected var _debug:Function
debug:Function [read-write]
Access a function to be called for outputting messages about turn timing. The function
must take a single string argument and return void. If set to null, no debug output
will occur.
Implementation
public function get debug():Function
public function set debug(value:Function):void
protected var _enabled:Boolean = true
protected var _gameCtrl:GameControl
protected var _lastTurnHolder:int = 0
protected var _playTime:Number = 10
playTime:Number [read-write]
Access the amount of time allowed for playing a card.
Implementation
public function get playTime():Number
public function set playTime(value:Number):void
protected var _table:Table
protected var _timer:Timer
turnHolder:int [read-only]Implementation
protected function get turnHolder():int
public function TurnTimer(gameCtrl:GameControl, table:Table, useServerAgent:Boolean = false) Creates a new turn timer for a given game control and table.
Parameters
| gameCtrl:GameControl — the game control
|
| |
| table:Table — the table where turns are being timed
|
| |
| useServerAgent:Boolean (default = false) — the bids (needed because more time is allowed for bidding) |
protected function addHistory(turnHolder:int, expired:Boolean, count:int):voidParameters
| turnHolder:int |
| |
| expired:Boolean |
| |
| count:int |
protected function countExpiries(seat:int):intParameters
Returns
public function disable():void Disable the turn timer. For debugging specific game play situations.
protected function getCurrentTurnTimeBase(turnHolder:int):Number Get the base amount of time that should be allowed for the current turn. The time is
automatically diminished proprtionally to the number of turns the player has missed.
Subclasses should override to accout for different game play situations.
Parameters
Returns
protected function handleMessage(event:MessageReceivedEvent):voidParameters
| event:MessageReceivedEvent |
protected function handleTurnChanged(event:StateChangedEvent):voidParameters
public function restart():void Restart the timer for the current turnholder. Used if there is a multi-stage turn where
the turn holder does not change.
protected function timerListener(event:TimerEvent):voidParameters
protected static const EXPIRY_TRACKER:String = "turntimer.expirytracker"
protected static const HISTORY_EFFECT:Array
protected static const HISTORY_MASK:int = 0x0000000F
protected static const HISTORY_SIZE:int = 4
protected static const MSG_EXPIRED:String = "turntimer.stop"
protected static const MSG_START:String = "turntimer.start"