Game Development Reference
In-Depth Information
In all cases, we would subclass (MyGame) the PulseGame. In order to have our
own subclass of lobby screen, we first need to create class ( MyGameLobbyScreen )
inherited from GameLobbyScreen . In addition, we also need to override the method
initLobbyScreen as shown below:
protected override function initLobbyScreen():void {
m_gameLobbyScreen = new MyGameLobbyScreen();
}
In order to provide our own RoomsDisplay , we need to create a subclass
( MyRoomsDisplay ) inherited from RoomsDisplay class and we need to override the
method where it creates the RoomsDisplay in GameLobbyScreen as shown below:
protected function createRoomsDisplay():void {
m_roomsDisplay = new MyRoomsDisplay();
}
Finally, we do similar subclassing for MyRoomDisplay and override the method that
creates the RoomDisplay in MyRoomsDisplay as follows:
protected override function
createRoomDisplay (room:GameRoomClient):RoomDisplay {
return new MyRoomDisplay(room);
}
Now that we have hooked up to create our own implementation of RoomDisplay , we
are free to add any additional information we like. In order to add additional sprites,
we now simply need to override the init method of GameRoom and provide our
additional sprites.
Filtering rooms to display
The choice is up to the game developer to either display all the rooms currently
created or just the ones that are available to join. We may override the method
shouldShowRoom method in the subclass of RoomsDisplay ( MyRoomsDisplay ) to
change the default behavior. The default behavior is to show rooms that are only
available to join as well as rooms that allow players to join even after the game
has started.
 
Search WWH ::




Custom Search