Packagecom.whirled.contrib.card.trick
Classpublic class Bids
InheritanceBids Inheritance flash.events.EventDispatcher

Manages the player bids for a trick taking card game such as spades. Changes to bids are sent to the server and the data structure is only modified once the reply is received, at which time a BidEvent is dispatched.



Public Properties
 PropertyDefined by
  complete : Boolean
[read-only] Access whether or not all bids have been placed.
Bids
  hasSelected : Boolean
[read-only] Access whether or not a bid has been selected since the call to request a bid.
Bids
  length : int
[read-only] Access the number of bids placed so far.
Bids
  maximum : int
[read-only] Access the maximum bid value.
Bids
Protected Properties
 PropertyDefined by
  _bids : NetArray
Bids
  _gameCtrl : GameControl
Bids
  _hasSelected : Boolean
Bids
  _maximum : int
Bids
  players : Array
[read-only]
Bids
Public Methods
 MethodDefined by
  
Bids(gameCtrl:GameControl, maximum:int)
Create a new set of player bids.
Bids
  
getBid(seat:int):int
Get the bid for an absolute seating position.
Bids
  
hasBid(seat:int):Boolean
Check if the player in an absolute seating position has placed a bid yet.
Bids
  
placeBid(value:int):void
Send a bid request to the server on behalf of the local player.
Bids
  
request(max:int):void
Request a bid from the local player up to a specified maximum amount.
Bids
  
reset():void
Send a message to the server to clear all bids in preparation for the next round.
Bids
  
select(value:int):void
Select the given bid on behalf of the local player.
Bids
Protected Methods
 MethodDefined by
  
handleElementChanged(event:ElementChangedEvent):void
Bids
  
handlePropertyChanged(event:PropertyChangedEvent):void
Bids
Protected Constants
 ConstantDefined by
  ARRAYNAME : String = "bids"
[static]
Bids
  NO_BID : int = -1
[static]
Bids
Property detail
_bidsproperty
protected var _bids:NetArray
completeproperty 
complete:Boolean  [read-only]

Access whether or not all bids have been placed.

Implementation
    public function get complete():Boolean
_gameCtrlproperty 
protected var _gameCtrl:GameControl
_hasSelectedproperty 
protected var _hasSelected:Boolean
hasSelectedproperty 
hasSelected:Boolean  [read-only]

Access whether or not a bid has been selected since the call to request a bid. This is necessary for the auto-play feature to prevent a second bid from occurring while the first one is propagating.

Implementation
    public function get hasSelected():Boolean
lengthproperty 
length:int  [read-only]

Access the number of bids placed so far.

Implementation
    public function get length():int
_maximumproperty 
protected var _maximum:int
maximumproperty 
maximum:int  [read-only]

Access the maximum bid value.

Implementation
    public function get maximum():int
playersproperty 
players:Array  [read-only]Implementation
    protected function get players():Array
Constructor detail
Bids()constructor
public function Bids(gameCtrl:GameControl, maximum:int)

Create a new set of player bids.

Parameters
gameCtrl:GameControl — the game control object used to set up the storage and communicate with the server.
 
maximum:int — the maximum bid that the game rules will allow (the turn maximum is typically lower and set in the request method)
Method detail
getBid()method
public function getBid(seat:int):int

Get the bid for an absolute seating position.

Parameters
seat:int

Returns
int
handleElementChanged()method 
protected function handleElementChanged(event:ElementChangedEvent):voidParameters
event:ElementChangedEvent
handlePropertyChanged()method 
protected function handlePropertyChanged(event:PropertyChangedEvent):voidParameters
event:PropertyChangedEvent
hasBid()method 
public function hasBid(seat:int):Boolean

Check if the player in an absolute seating position has placed a bid yet.

Parameters
seat:int

Returns
Boolean
placeBid()method 
public function placeBid(value:int):void

Send a bid request to the server on behalf of the local player. When the reply is received, a BidEvent.PLACED event will be dispatched. If all bids are in, a BidEvent.COMPLETED event will be sent.

Parameters
value:int

Throws
— if the player has already bid.
request()method 
public function request(max:int):void

Request a bid from the local player up to a specified maximum amount. This is not a network event and immediately dispatches a BidEvent.REQUESTED event.

Parameters
max:int
reset()method 
public function reset():void

Send a message to the server to clear all bids in preparation for the next round. When the reply is received, a BidEvent.RESET event will be dispatched.

select()method 
public function select(value:int):void

Select the given bid on behalf of the local player. This is not a network event and immediately sends a BidEvent.SELECTED event.

Parameters
value:int
Constant detail
ARRAYNAMEconstant
protected static const ARRAYNAME:String = "bids"
NO_BIDconstant 
protected static const NO_BID:int = -1