ElectroServer 5 Client: C#
Electrotank.Electroserver5.Api.CreateOrJoinGameResponse Class Reference

The QuickJoinGameRequest is used to create a new game on the server, or to join a game that matches the criteria passed in. More...

Inheritance diagram for Electrotank.Electroserver5.Api.CreateOrJoinGameResponse:
Electrotank.Electroserver5.Api.EsResponse Electrotank.Electroserver5.Api.EsMessage Electrotank.Electroserver5.Api.IThriftSerializable

Public Member Functions

 CreateOrJoinGameResponse ()
 
 CreateOrJoinGameResponse (TBase t)
 
override TBase ToThrift ()
 
override TBase NewThrift ()
 
override void FromThrift (TBase t_)
 
- Public Member Functions inherited from Electrotank.Electroserver5.Api.EsResponse
 EsResponse ()
 

Properties

bool Successful [get, set]
 If true, the client successfully joined the game. More...
 
ErrorType Error [get, set]
 If successful is false then this contains the reason why. More...
 
int ZoneId [get, set]
 The id of the zone that contains the new game, if successful is true. More...
 
int RoomId [get, set]
 The id of the room that contains the new game, if successful is true. More...
 
int GameId [get, set]
 The id of the new game if successful is true. More...
 
EsObjectRO GameDetails [get, set]
 

Detailed Description

The QuickJoinGameRequest is used to create a new game on the server, or to join a game that matches the criteria passed in.

That request leads to this response.

This server feature is called the Game Manager. In order to use a game with the Game Manager the game must be registered with the server via the Remote Admin. A game is essentially just a room with one or more plugins associated with it. All games that are managed can be searched using the FindGamesReqest. A game can be joined via QuickJoinGameRequest or by using the JoinGameRequest and specifying a specific game id. You can learn of a game id by someone telling you via various server messaging techniques, or by loading a list of games using the FindGamesRequest and looking at the game ids.

      This example shows how to create a fictional game of poker. If the game was registered with the server as PokerGame, and if the game plugin was set up to receive and interpret 

the custom EsObject passed in, then this is what the code to create or join such a game would look like.

private var _es:ElectroServer;
private function initialize():void {
        _es.engine.addEventListener(MessageType.CreateOrJoinGameResponse.name, onCreateOrJoinGameResponse);
        _es.engine.addEventListener(MessageType.JoinRoomEvent.name, onJoinRoomEvent);
        //create the request
        var qjr:QuickJoinGameRequest = new QuickJoinGameRequest();
        //gameType is the name of the game as registered on the server
        qjr.gameType = "PokerGame";
        //zone in which to put the game
        qjr.zoneName = "GameZone";
        //should the game show up in the room list
        qjr.hidden = false;
        //if true, the game is automatically locked when you join until unlocked
        qjr.locked = false;
        //if true, then the request won't look for an existing game for you to join, it will only create one
        qjr.createOnly = false;
        //optional EsObject of data to pass into the game
        var esob:EsObject = new EsObject();
        esob.setInteger("potLimit", 2500);
        esob.setInteger("tableSize", 8);
        qjr.gameDetails = esob;
        _es.engine.send(qjr);
}
private function onJoinRoomEvent(e:JoinRoomEvent):void {
        trace("Joined the game room");
}
private function onCreateOrJoinGameResponse(e:CreateOrJoinGameResponse):void {
        trace("Joined game: " + e.successful.toString());
}

Constructor & Destructor Documentation

Electrotank.Electroserver5.Api.CreateOrJoinGameResponse.CreateOrJoinGameResponse ( )
Electrotank.Electroserver5.Api.CreateOrJoinGameResponse.CreateOrJoinGameResponse ( TBase  t)

Member Function Documentation

override void Electrotank.Electroserver5.Api.CreateOrJoinGameResponse.FromThrift ( TBase  t_)
virtual
override TBase Electrotank.Electroserver5.Api.CreateOrJoinGameResponse.NewThrift ( )
virtual
override TBase Electrotank.Electroserver5.Api.CreateOrJoinGameResponse.ToThrift ( )
virtual

Property Documentation

ErrorType Electrotank.Electroserver5.Api.CreateOrJoinGameResponse.Error
getset

If successful is false then this contains the reason why.

EsObjectRO Electrotank.Electroserver5.Api.CreateOrJoinGameResponse.GameDetails
getset
int Electrotank.Electroserver5.Api.CreateOrJoinGameResponse.GameId
getset

The id of the new game if successful is true.

int Electrotank.Electroserver5.Api.CreateOrJoinGameResponse.RoomId
getset

The id of the room that contains the new game, if successful is true.

bool Electrotank.Electroserver5.Api.CreateOrJoinGameResponse.Successful
getset

If true, the client successfully joined the game.

int Electrotank.Electroserver5.Api.CreateOrJoinGameResponse.ZoneId
getset

The id of the zone that contains the new game, if successful is true.