Game Development Reference
In-Depth Information
TictactoeSkinner
You need to subclass the Skinner class (PulseUI) so as to read in the image (skin) files
that will be used to draw all the UI for all of the screens.
public class TictactoeSkinner extends Skinner
{
[Embed(source="tictactoe\\rsrc\\Outline.png")]
private static var OutlineClass:Class;
[Embed(source="tictactoe\\rsrc\\ui.png")]
private static var UIClass:Class;
[Embed(source="tictactoe\\rsrc\\frame.png")]
private static var FrameClass:Class;
public function TictactoeSkinner() {
}
protected override function load():void {
m_outline = (new OutlineClass() as BitmapAsset).
bitmapData;
m_ui = (new UIClass() as BitmapAsset).bitmapData;
m_frame = (new FrameClass() as BitmapAsset).bitmapData;
}
}
The custom skinner is quite simple. The above code is the complete listing for the
class. The load method should be overridden to create BitmapAsset for the outline,
UI, and frame. These are protected fields defined in the skinner class. The skinner
object will do all the hard work of cutting up the asset and piecing it altogether
during the runtime.
TictactoeNewGameScreen
It is optional to subclass NewGameScreen class (PulseUI) for this game. However,
we need to tell the Pulse server the specific properties of the game room, such as it
being turn-based, having a maximum of two players per room, etc.
public override function createNewRoom():void {
PulseGame.getInstance().setCreatingRoom();
var room:GameRoomClient = new GameRoomClient();
room.setAutoReady(1);
room.setRoomName(m_ti.text);
room.setMaxPlayerCount(2);
room.setRoomType(GameConstants.ROOM_TURN_BASED);
PulseGame.getInstance().
getGameClient().createGameRoom(room);
}
 
Search WWH ::




Custom Search