|
ElectroServer 5 Client: C#
|
This even occurs when a message from a plugin is received. More...
Public Member Functions | |
| PluginMessageEvent () | |
| PluginMessageEvent (TBase t) | |
| override TBase | ToThrift () |
| override TBase | NewThrift () |
| override void | FromThrift (TBase t_) |
Public Member Functions inherited from Electrotank.Electroserver5.Api.EsEvent | |
| EsEvent () | |
Properties | |
| string | PluginName [get, set] |
| Name of the plugin instance that sent the message. More... | |
| bool | SentToRoom [get, set] |
| If true then this message was sent to a room and not to the client directly. More... | |
| int | DestinationZoneId [get, set] |
| If 'sentToRoom' is true then 'destinationZoneId' and 'destinationRoomId' contain the ids of the target zone and room. More... | |
| int | DestinationRoomId [get, set] |
| If 'sentToRoom' is true then 'destinationZoneId' and 'destinationRoomId' contain the ids of the target zone and room. More... | |
| bool | RoomLevelPlugin [get, set] |
| int | OriginZoneId [get, set] |
| Id of the zone that contains the room (that contains the plugin), if the message originated from a room-level plugin. More... | |
| int | OriginRoomId [get, set] |
| Id of the room that contains the plugin, if the message originated from a room-level plugin. More... | |
| EsObject | Parameters [get, set] |
| All custom information that the plugin has sent to the client is contained in this EsObject. More... | |
This even occurs when a message from a plugin is received.
That message could have been sent to a room that the client is in, or sent directly to that client. It could have originated from a plugin in a room that the client is in, or from a plugin in a room that the client is not in, or from a server-level plugin. There is enough information on the event object to determine the origin of the message.
In most cases all you care about is the pluginName (to give you some context about where the message came from) and the 'parameters' EsObject property which contains the custom information that the plugin wanted you to know abut.
This shows how to send a message to a room-level plugin, and how to capture a plugin message event when one is received.
private var _es:ElectroServer; private var _room:Room;
private function initialize():void {
_es.engine.addEventListener(MessageType.PluginMessageEvent.name, onPluginMessageEvent);
}private function sendTestMessage():void {
var ipr:InvokePluginRequest = new InvokePluginRequest(); ipr.roomId = _room.id;
ipr.zoneId = _room.zoneId; ipr.pluginName = "TankGame";
ipr.parameters = new EsObject();
ipr.parameters.setString("action", "shoot");
ipr.parameters.setInteger("angle", 45);_es.engine.send(ipr); }
private function onPluginMessageEvent(e:PluginMessageEvent):void {
trace("plugin message event received");
trace(e.pluginName);
trace(e.parameters.getString("action"));
}
| Electrotank.Electroserver5.Api.PluginMessageEvent.PluginMessageEvent | ( | ) |
| Electrotank.Electroserver5.Api.PluginMessageEvent.PluginMessageEvent | ( | TBase | t | ) |
|
virtual |
Implements Electrotank.Electroserver5.Api.EsMessage.
|
virtual |
Implements Electrotank.Electroserver5.Api.EsMessage.
|
virtual |
Implements Electrotank.Electroserver5.Api.EsMessage.
|
getset |
If 'sentToRoom' is true then 'destinationZoneId' and 'destinationRoomId' contain the ids of the target zone and room.
|
getset |
If 'sentToRoom' is true then 'destinationZoneId' and 'destinationRoomId' contain the ids of the target zone and room.
|
getset |
Id of the room that contains the plugin, if the message originated from a room-level plugin.
|
getset |
Id of the zone that contains the room (that contains the plugin), if the message originated from a room-level plugin.
|
getset |
All custom information that the plugin has sent to the client is contained in this EsObject.
|
getset |
Name of the plugin instance that sent the message.
|
getset |
|
getset |
If true then this message was sent to a room and not to the client directly.