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

When a user is joined successfully to a room this event occurs. More...

Inheritance diagram for Electrotank.Electroserver5.Api.JoinRoomEvent:
Electrotank.Electroserver5.Api.EsEvent Electrotank.Electroserver5.Api.EsMessage Electrotank.Electroserver5.Api.IThriftSerializable

Public Member Functions

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

Properties

int ZoneId [get, set]
 The id of the zone that contains the room. More...
 
int RoomId [get, set]
 The id of the room the user just joined. More...
 
string RoomName [get, set]
 The name of the room the user just joined. More...
 
string RoomDescription [get, set]
 Optional field. More...
 
bool HasPassword [get, set]
 If the room is password protected, this is true. More...
 
bool Hidden [get, set]
 If the room is hidden, this is true. More...
 
int Capacity [get, set]
 The number of users allowed in this room. More...
 
List< UserListEntryUsers [get, set]
 A list of users (UserListEntry) that are in this room. More...
 
List< RoomVariableRoomVariables [get, set]
 A list of RoomVariables in this room. More...
 
List< string > PluginHandles [get, set]
 A list of plugins attached to this room. More...
 

Detailed Description

When a user is joined successfully to a room this event occurs.

A user can end up in a room in one of two ways: 1) They can opt into joining the room by using the JoinRoomRequest or CreateRoomRequest requests, or 2) a server extension can put them into a room. In either case this event will occur if the room is joined.

In the event of a CreateRoomRequest that fails to join a room, the client will be sent a GenericErrorResponse.

      Shows the most simple example of how to create a new room and capture the JoinRoomEvent.
package  {
        import com.electrotank.electroserver5.api.CreateRoomRequest;
        import com.electrotank.electroserver5.api.JoinRoomEvent;
        import com.electrotank.electroserver5.api.MessageType;
        import com.electrotank.electroserver5.ElectroServer;
        import com.electrotank.electroserver5.user.User;
        import com.electrotank.electroserver5.zone.Room;
        import flash.events.Event;
        public class RoomJoiner {

    private var _es:ElectroServer;

    public function initialize():void {

listen for the JoinRoomEvent so we know when it happens _es.engine.addEventListener(MessageType.JoinRoomEvent.name, onJoinRoomEvent);

create the request and populate it with the room details
                        var crr:CreateRoomRequest = new CreateRoomRequest();
                        crr.roomName = "MyRoom";
                        crr.zoneName = "MyZone";
send it
                        _es.engine.send(crr);
                }
                private function onJoinRoomEvent(e:JoinRoomEvent):void {
                        trace("room joined!");
get the room you're in
                        var room:Room = _es.managerHelper.zoneManager.zoneById(e.zoneId).roomById(e.roomId);
print out the users in the room
                        for each (var user:User in room.users) {
                                trace(user.userName);
                        }
                }
                public function set es(value:ElectroServer):void {
                        _es = value;
                }
        }
}
    

Constructor & Destructor Documentation

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

Member Function Documentation

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

Property Documentation

int Electrotank.Electroserver5.Api.JoinRoomEvent.Capacity
getset

The number of users allowed in this room.

A value of -1 means there is no restriction.

bool Electrotank.Electroserver5.Api.JoinRoomEvent.HasPassword
getset

If the room is password protected, this is true.

bool Electrotank.Electroserver5.Api.JoinRoomEvent.Hidden
getset

If the room is hidden, this is true.

List<string> Electrotank.Electroserver5.Api.JoinRoomEvent.PluginHandles
getset

A list of plugins attached to this room.

string Electrotank.Electroserver5.Api.JoinRoomEvent.RoomDescription
getset

Optional field.

The description of the room the user just joined.

int Electrotank.Electroserver5.Api.JoinRoomEvent.RoomId
getset

The id of the room the user just joined.

string Electrotank.Electroserver5.Api.JoinRoomEvent.RoomName
getset

The name of the room the user just joined.

List<RoomVariable> Electrotank.Electroserver5.Api.JoinRoomEvent.RoomVariables
getset

A list of RoomVariables in this room.

List<UserListEntry> Electrotank.Electroserver5.Api.JoinRoomEvent.Users
getset

A list of users (UserListEntry) that are in this room.

int Electrotank.Electroserver5.Api.JoinRoomEvent.ZoneId
getset

The id of the zone that contains the room.