GODPAPER | All Packages | All Classes | Index | Frames No Frames |
Multiplayer

Package | playerio
Interface | public interface Multiplayer

Provides access to the Multiplayer services provided by Player.IO.

Public Properties

| Property | Defined By
--- | --- | ---
|  | developmentServer : String If defined the system will connect to a local development server instead of a live server. | Multiplayer

Public Methods

| Method | Defined By
--- | --- | ---
|  | createJoinRoom(roomId:String, roomType:String, visible:Boolean, roomData:Object, joinData:Object, callback:Function = null, errorHandler:Function = null):void Creates or joins a room of the specified server type. | Multiplayer
|  | createRoom(roomId:String, roomType:String, visible:Boolean, roomData:Object, callback:Function = null, errorHandler:Function = null):void Creates a room of the specified server type. | Multiplayer
|  | joinRoom(roomId:String, joinData:Object, callback:Function = null, errorHandler:Function = null):void Joins an already existing room | Multiplayer
|  | listRooms(roomType:String, searchCriteria:Object, resultLimit:int, resultOffset:int, callback:Function = null, errorHandler:Function = null):void List all room instances of a specific server type | Multiplayer

Property Detail

developmentServer | property

`developmentServer:String`

If defined the system will connect to a local development server instead of a live server.

Implementation
`public function get developmentServer():String`
`public function set developmentServer(value:String):void`
Example
The following example connects to a development server running on localhost on port 8184

             client.multiplayer.developmentServer = "127.0.0.1:8184";

Method Detail

createJoinRoom | () | method

`public function createJoinRoom(roomId:String, roomType:String, visible:Boolean, roomData:Object, joinData:Object, callback:Function = null, errorHandler:Function = null):void`

Creates or joins a room of the specified server type.

Parameters

| `roomId:String` — The id of the room, if set to null the room is assigned a random id
| `roomType:String` — The type of room we should start
| `visible:Boolean` — If the room should be returned when doing a listRooms request
| `roomData:Object` — Init data, this init data can be read on by server: {Name:"MyRoom", Level:3}
| `joinData:Object` — User join data, this join data can be read by the server: {Name:"Chris", Type:"Sniper"}
| `callback:Function` (default = `null`)`` — Method executed when the createJoinRoom call executed successfully: function(connection:Connection):void{...}
| `errorHandler:Function` (default = `null`)`` — Method executed if the createJoinRoom request failed: function(error:PlayerIOError):void{...}

createRoom | () | method |

`public function createRoom(roomId:String, roomType:String, visible:Boolean, roomData:Object, callback:Function = null, errorHandler:Function = null):void`

Creates a room of the specified server type.

Parameters

| `roomId:String` — The id of the room, if set to null the room is assigned a random id
| `roomType:String` — The type of room we should start
| `visible:Boolean` — If the room should be returned when doing a listRooms request
| `roomData:Object` — Init data, this init data can be read by server: {Name:"MyRoom", Level:3}
| `callback:Function` (default = `null`)`` — Method executed when the createRoom call executed successfully, returns the id of the created room: function(roomId:String):void{...}
| `errorHandler:Function` (default = `null`)`` — Method executed if the joinRoom request failed: function(error:PlayerIOError):void{...}

joinRoom | () | method |

`public function joinRoom(roomId:String, joinData:Object, callback:Function = null, errorHandler:Function = null):void`

Joins an already existing room

Parameters

| `roomId:String` — The id of the room we wish to join
| `joinData:Object` — User join data, this join data can be read by the server: {Name:"Chris", Type:"Sniper"}
| `callback:Function` (default = `null`)`` — Method executed when the joinRoom call executed successfully: function(connection:Connection):void{...}
| `errorHandler:Function` (default = `null`)`` — Method executed if the joinRoom request failed: function(error:PlayerIOError):void{...}

listRooms | () | method |

`public function listRooms(roomType:String, searchCriteria:Object, resultLimit:int, resultOffset:int, callback:Function = null, errorHandler:Function = null):void`

List all room instances of a specific server type

Parameters

| `roomType:String` — The type of room we should list
| `searchCriteria:Object` — Compares the properties of the parsed object to properties on the roomData object and returns only perfect matches. Passing the object {level:"3"} returns only rooms which have level defined as 3 on the roomData object. To use search criteria you must first define what properties are searchable under the Multiplayer menu option for your game.
| `resultLimit:int` — How many room instances should we load from the server
| `resultOffset:int` — At what offset should we list from
| `callback:Function` (default = `null`)`` — Method executed when the listRooms call executed successfully: function(rooms:Array<RoomInfo>):void{...}
| `errorHandler:Function` (default = `null`)`` — Method executed if the listRooms request failed: function(error:PlayerIOError):void{...}

Thu Jan 16 2014, 01:11 PM +08:00