SpectatorToPlayerRequest Class |
Namespace: Sfs2X.Requests
public class SpectatorToPlayerRequest : BaseRequest
Name | Description | |
---|---|---|
SpectatorToPlayerRequest |
See SpectatorToPlayerRequest(Room) constructor.
| |
SpectatorToPlayerRequest(Room) |
Creates a new SpectatorToPlayerRequest instance.
|
void SomeMethod() { sfs.AddEventListener(SFSEvent.SPECTATOR_TO_PLAYER, OnSpectatorToPlayerSwitch); sfs.AddEventListener(SFSEvent.SPECTATOR_TO_PLAYER_ERROR, OnSpectatorToPlayerSwitchError); // Switch spectator to player sfs.Send( new PlayerToSpectatorRequest() ); } void OnSpectatorToPlayerSwitch(BaseEvent evt) { User user = (User)evt.Params["user"]; Console.WriteLine("Spectator " + user.Name + " is now a player"); // .Net / Unity System.Diagnostics.Debug.WriteLine("Spectator " + user.Name + " is now a player"); // UWP } void OnSpectatorToPlayerSwitchError(BaseEvent evt) { Console.WriteLine("Unable to become a player due to the following error: " + (string)evt.Params["errorMessage"]); // .Net / Unity System.Diagnostics.Debug.WriteLine("Unable to become a player due to the following error: " + (string)evt.Params["errorMessage"]); // UWP }