Packagecom.whirled.contrib.avrg.oneroom
Classpublic class OneRoomGameServer
InheritanceOneRoomGameServer Inheritance com.whirled.ServerObject

Server agent for games that take place in exactly one room. This means that whenever a player leaves the room, he is automatically ejected from the game. To use this class, the game should put something like the following in Server.as:
 import com.whirled.contrib.avrg.oneroom.OneRoomGameServer;
public class Server extends OneRoomGameServer { roomType = MyRoomType; }
The MyRoomType in the example must be a subclass of OneRoomGameRoom. Instances of this type will be created as needed and those instances will effectively handle all game activity.

See also

OneRoomGameRoom


Public Properties
 PropertyDefined by
  gameCtrl : AVRServerGameControl
[read-only] Accesses the game control for this server agent.
OneRoomGameServer
  log : Log
[static] The log sink associated with this agent.
OneRoomGameServer
  roomType : Class
[static] The type of room objects to create.
OneRoomGameServer
Protected Properties
 PropertyDefined by
  _gameCtrl : AVRServerGameControl
The game control for this server agent.
OneRoomGameServer
  _rooms : Dictionary
Mapping of room ids to OneRoomGameRoom instances.
OneRoomGameServer
Public Methods
 MethodDefined by
  
Creates a new server agent for a game that takes place in exactly one room.
OneRoomGameServer
Protected Methods
 MethodDefined by
  
Creates a new room.
OneRoomGameServer
  
enteredRoom(evt:AVRGamePlayerEvent):void
Tells the agent that a player has entered a room.
OneRoomGameServer
  
leftRoom(evt:AVRGamePlayerEvent):void
Tells the agent that a player has left a room.
OneRoomGameServer
  
playerJoinedGame(evt:AVRGameControlEvent):void
Tells the agent that a player has joined the game.
OneRoomGameServer
  
playerQuitGame(evt:AVRGameControlEvent):void
Tells the agent that a player has quit the game.
OneRoomGameServer
Property detail
_gameCtrlproperty
protected var _gameCtrl:AVRServerGameControl

The game control for this server agent.

gameCtrlproperty 
gameCtrl:AVRServerGameControl  [read-only]

Accesses the game control for this server agent.

Implementation
    public function get gameCtrl():AVRServerGameControl
logproperty 
public static var log:Log

The log sink associated with this agent.

_roomsproperty 
protected var _rooms:Dictionary

Mapping of room ids to OneRoomGameRoom instances.

roomTypeproperty 
public static var roomType:Class

The type of room objects to create. The caller must set this type when the server agent is instantiated. The set value must be a subclass of OneRoomGameRoom.

See also

Constructor detail
OneRoomGameServer()constructor
public function OneRoomGameServer()

Creates a new server agent for a game that takes place in exactly one room.

Method detail
createRoom()method
protected function createRoom(roomId:int):OneRoomGameRoom

Creates a new room. Subclasses should not normally need to override this.

Parameters
roomId:int

Returns
OneRoomGameRoom
enteredRoom()method 
protected function enteredRoom(evt:AVRGamePlayerEvent):void

Tells the agent that a player has entered a room. Takes care of creating a new room object if one does not already exist. This is called by whirled and subclasses should not normally need to override it.

Parameters
evt:AVRGamePlayerEvent

See also

leftRoom()method 
protected function leftRoom(evt:AVRGamePlayerEvent):void

Tells the agent that a player has left a room. If this is the last player in the room, then calls OneRoomGameRoom.shutdown. This is called by whirled and subclasses should not normally need to override it.

Parameters
evt:AVRGamePlayerEvent

See also

OneRoomGameRoom.shutdown
playerJoinedGame()method 
protected function playerJoinedGame(evt:AVRGameControlEvent):void

Tells the agent that a player has joined the game. This is called by whirled and subclasses should not normally need to override it.

Parameters
evt:AVRGameControlEvent
playerQuitGame()method 
protected function playerQuitGame(evt:AVRGameControlEvent):void

Tells the agent that a player has quit the game. This is called by whirled and subclasses should not normally need to override it.

Parameters
evt:AVRGameControlEvent