What there is, as far as I can see, is a join method in the C#, which I have:
- Code: Select all
public override bool AllowUserJoin(Player player)
{
Console.WriteLine("This is player"+PlayerCount);
if (PlayerCount == 4)
{
return false;
}
return base.AllowUserJoin(player);
}
Which sortof works: it allows a player to join, but immediately kicks them.
However, in my AS code, I have
- Code: Select all
private function handleJoin(c:Connection):void{
trace("Successfully connected to the multiplayer server");
}
private function handleError(error:PlayerIOError):void{
trace("Got", error);
}
Joining a "full game" will always count as a successful join, even if the player is immediately kicked.
It seems to me that a failed join should count as an error, with an appropriate error message. As it is, I have the player join the game, see if they are kicked, and if so remove them again, which seems messsy.
Is there a better way for me to do this?