PublicMessageRequest Class |
Namespace: Sfs2X.Requests
public class PublicMessageRequest : GenericMessageRequest
Name | Description | |
---|---|---|
PublicMessageRequest(String) |
See PublicMessageRequest(string, ISFSObject, Room) constructor.
| |
PublicMessageRequest(String, ISFSObject) |
See PublicMessageRequest(string, ISFSObject, Room) constructor.
| |
PublicMessageRequest(String, ISFSObject, Room) |
Creates a new PublicMessageRequest instance.
|
void SomeMethod() { sfs.AddEventListener(SFSEvent.PUBLIC_MESSAGE, OnPublicMessage); // Send a public message sfs.Send( new PublicMessageRequest("Hello everyone!") ); } void OnPublicMessage(BaseEvent evt) { // As messages are forwarded to the sender too, I have to check if I am the sender User sender = (User)evt.Params["sender"]; if (sender == sfs.MySelf) { Console.WriteLine("I said " + (string)evt.Params["message"]); // .Net / Unity System.Diagnostics.Debug.WriteLine("I said " + (string)evt.Params["message"]); // UWP } else { Console.WriteLine("User " + sender.Name + " said: " + (string)evt.Params["message"]); // .Net / Unity System.Diagnostics.Debug.WriteLine("User " + sender.Name + " said: " + (string)evt.Params["message"]); // UWP } }