SmartFoxServer 2X C++ API
Sfs2X::Requests::SpectatorToPlayerRequest Class Reference

Attempt to turn the current User from Spectator into a Player (in a Game Room) More...

#include <SpectatorToPlayerRequest.h>

Inherits Sfs2X::Requests::BaseRequest.

Public Member Functions

 SpectatorToPlayerRequest ()
 SpectatorToPlayerRequest(Room*) More...
 
 SpectatorToPlayerRequest (boost::shared_ptr< Room > targetRoom)
 Constructor More...
 

Detailed Description

Attempt to turn the current User from Spectator into a Player (in a Game Room)

This could fail if no Player slots are available in the Room at the time of the request

Constructor & Destructor Documentation

◆ SpectatorToPlayerRequest() [1/2]

Sfs2X::Requests::SpectatorToPlayerRequest::SpectatorToPlayerRequest ( )

SpectatorToPlayerRequest(Room*)

◆ SpectatorToPlayerRequest() [2/2]

Sfs2X::Requests::SpectatorToPlayerRequest::SpectatorToPlayerRequest ( boost::shared_ptr< Room >  targetRoom)

Constructor

Parameters
targetRoomthe Room where the change has to be performed, a null value indicates the last joined Room (default)
ptrSmartFox->AddEventListener(SFSEvent::SPECTATOR_TO_PLAYER, boost::shared_ptr<EventListenerDelegate> (EventListenerDelegate(CMyClass::OnPlayerOk, (unsigned long long)this));
ptrSmartFox->AddEventListener(SFSEvent::SPECTATOR_TO_PLAYER_ERROR, boost::shared_ptr<EventListenerDelegate> (EventListenerDelegate(CMyClass::OnPlayerError, (unsigned long long)this));
boost::shared_ptr<IRequest> request (new SpectatorToPlayerRequest());
ptrSmartFox->Send(request);
static void OnPlayerOk(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
static void OnPlayerError(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
void CMyClass::OnPlayerOk(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
{
// Success! I am now a Player in this Game!
}
void CMyClass::OnPlayerError(unsigned long long ptrContext, boost::shared_ptr<BaseEvent> ptrEvent);
{
// I was not able to become Player in the Game
}
See also
Core.SFSEvent.SPECTATOR_TO_PLAYER, Core.SFSEvent.SPECTATOR_TO_PLAYER_ERROR, PlayerToSpectatorRequest