Models the current scores for a trick taking card game.
bids:Bids [read-only]
Access the bids of the game.
Implementation
public function get bids():Bids
protected var _gameCtrl:GameControl
protected var _playerTricks:NetArray
protected var _scores:NetArray
protected var _table:Table
table:Table [read-only]
Access the table the game is taking place at.
Implementation
public function get table():Table
protected var _target:int
target:int [read-only]
Access the target score of the game.
Implementation
public function get target():int
totalTricks:int [read-only]
Access the total number of tricks (since last resetTricks call).
Implementation
public function get totalTricks():int
protected var _tricks:NetArray
public function Scores(gameCtrl:GameControl, table:Table, bids:Bids, target:int) Create a new scores container.
Parameters
| gameCtrl:GameControl — the table these scores are at
|
| |
| table:Table — the bids object for the game
|
| |
| bids:Bids — the score that the teams are playing to |
| |
| target:int |
public function addScore(teamIdx:int, score:int):void Increase a team's score. Immediately sends a ScoresEvent.SCORES_CHANGED event.
Parameters
| teamIdx:int — the index of the team scoring.
|
| |
| score:int — the amount to add to the team's total |
public function addTrick(seat:int):void Add a trick taken by the given player. Immediately sends a ScoresEvent.TRICKS_CHANGED
event.
Parameters
| seat:int — the absolute seating position of the player at the table |
public function getBid(teamIdx:int):int Get the total bid made by the team with the given index.
Parameters
Returns
public function getPlayerTricks(seat:int):int Get the number of tricks taken so far by the player in the given absolute seating
position.
Parameters
Returns
public function getScore(teamIdx:int):int Get the score of the team with the given index.
Parameters
Returns
public function getTricks(teamIdx:int):int Get the number of tricks taken so far by the team with the given index.
Parameters
Returns
public function getWinnersAndLosers():WinnersAndLosers Tally the current scores and get the winners and losers of the game. This considers all
teams that share the highest score to be the winners, therefore there will always be
at least one winner. There can only be multiple winners if there is a tie game, in which
case there may be no losers. It is up to the game rules how to interpret this.
Returns
protected function handleElementChanged(event:ElementChangedEvent):voidParameters
| event:ElementChangedEvent |
protected function handlePropertyChanged(event:PropertyChangedEvent):voidParameters
| event:PropertyChangedEvent |
public function resetScores():void Reset the scores of all teams to 0. Immediately sends a ScoresEvent.SCORES_CHANGED event
for each team.
public function resetTricks():void Reset the tricks taken for all teams. Immediately sends a ScoresEvent.TRICKS_CHANGED
event for each team.
protected static const PLAYER_TRICKS:String = "scores.playertricks"
protected static const SCORES:String = "scores"
protected static const TRICKS:String = "scores.tricks"