BuddyMessageRequest Class |
Namespace: Sfs2X.Requests.Buddylist
public class BuddyMessageRequest : GenericMessageRequest
Name | Description | |
---|---|---|
BuddyMessageRequest(String, Buddy) |
See BuddyMessageRequest(String, Buddy, ISFSObject) constructor.
| |
BuddyMessageRequest(String, Buddy, ISFSObject) |
Creates a new BuddyMessageRequest instance.
|
void SomeMethod() { sfs.AddEventListener(SFSBuddyEvent.BUDDY_MESSAGE, OnBuddyMessage); // Obtain the recipient of the message Buddy kermitTheFrog = sfs.BuddyListManager.GetBuddyByName("KermitTheFrog"); // Block a buddy in the current buddy list sfs.Send(new BuddyMessageRequest("Hello Kermit!", kermitTheFrog)); } void OnBuddyMessage(BaseEvent evt) { bool isItMe = (bool)evt.Params["isItMe"]; Buddy buddy = (Buddy)evt.Params["buddy"]; if (isItMe) { Console.WriteLine("I said: " + (string)evt.Params["message"]); // .Net / Unity System.Diagnostics.Debug.WriteLine("I said: " + (string)evt.Params["message"]); // UWP } else { Console.WriteLine(buddy.Name + " said: " + (string)evt.Params["message"]); // .Net / Unity System.Diagnostics.Debug.WriteLine(buddy.Name + " said: " + (string)evt.Params["message"]); // UWP } }