in Assets/Xbox Live/Scripts/SignInManager.cs [434:499]
private bool ValidatePlayerNumber(int playerNumber, string operationName, XboxLiveOperationType operationType)
{
if (playerNumber <= 0)
{
var errorMessage = operationName + " Failed: Player Number needs to be greater than zero.";
ExceptionManager.Instance.ThrowException(
ExceptionSource.SignInManager,
ExceptionType.NoPlayersAreSignedIn,
new Exception (errorMessage));
return false;
}
if (playerNumber > GetMaximumNumberOfPlayers())
{
var errorMessage = operationName + " Failed: Player Number exceeds the maximum number of users allowed on this platform.";
ExceptionManager.Instance.ThrowException(
ExceptionSource.SignInManager,
ExceptionType.MaximumPlayerNumberReached,
new Exception(errorMessage));
return false;
}
if (operationType == XboxLiveOperationType.SignIn)
{
if (CurrentPlayers[playerNumber].XboxLiveUser != null)
{
var errorMessage = operationName + " Failed: Player " + playerNumber + " is already signed in.";
ExceptionManager.Instance.ThrowException(
ExceptionSource.SignInManager,
ExceptionType.PlayerIsAlreadySignedIn,
new Exception(errorMessage));
NotifyAllCallbacks(
playerNumber,
null,
XboxLiveAuthStatus.Invalid,
errorMessage,
true);
return false;
}
}
if (operationType == XboxLiveOperationType.SignOut || operationType == XboxLiveOperationType.GetUser)
{
if (!CurrentPlayers.ContainsKey(playerNumber) || CurrentPlayers[playerNumber].XboxLiveUser == null)
{
var errorMessage = operationName + " Failed: Player " + playerNumber + " is not signed in.";
ExceptionManager.Instance.ThrowException(
ExceptionSource.SignInManager,
ExceptionType.PlayerRequestedIsNotSignedIn,
new Exception(errorMessage));
if (operationType == XboxLiveOperationType.SignOut)
{
NotifyAllCallbacks(
playerNumber,
null,
XboxLiveAuthStatus.Invalid,
errorMessage,
false);
}
return false;
}
}
return true;
}