spectator switched event question

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

User avatar
psychopixel
Posts: 19
Joined: 14 Apr 2008, 08:44
Location: Italy
Contact:

spectator switched event question

Postby psychopixel » 07 May 2010, 14:49

If I'm not wrong the onSpectatorSwitched event is sent only to the user that required to be switched, the onUserCountChange event is sent only if the number of user + spectator in a room change. We have a feature in our game that show you who is watching your match, how I can be notified when another person in my game room switch from spectator to player?
Any suggestion?
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 08 May 2010, 09:37

Hi,
good question. What you said is correct.
On the client side only the user attempting a switch (player-to-spectator or viceversa) receives an event back if the operation is successful.

Actually this is not entirely true. All players receive an update but only the user that was switched gets a client event.

This means that if you "redraw" your user list from scratch on each uCount event you would be able to show who is player and who is watching, because the User List is kept up to date.

Your request suggests that we should fire events not only for the requester but also for all other users in the Room.
I am taking a note in the todo list for the next update :)
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 89 guests