/// <summary> /// Denies the player to connect and sends a reason code to the client. /// </summary> /// <param name="reason">The reason for not being granted a connection the player will get as a parameter in the /// callback <see cref="uLink.Network.uLink_OnFailedToConnect"/></param> public void Deny(NetworkConnectionError reason) { if (_status == NetworkPlayerApprovalStatus.Approved || _status == NetworkPlayerApprovalStatus.Denied) { throw new ArgumentNullException("Player has already been " + _status); } _status = NetworkPlayerApprovalStatus.Denied; _network._DenyClient(this, _msg, reason); }
/// <summary> /// Approves the client. A connection response will be sent internally by uLink to the client. /// </summary> /// <param name="approvalData">The approval data that will be delivered to the client.</param> /// <exception cref="ArgumentNullException">when approvalData is null or one of the arguments is null.</exception> /// <remarks>You can use approval data to send level number, team info or any other information to the client.</remarks> public void Approve(params object[] approvalData) { if (_status == NetworkPlayerApprovalStatus.Approved || _status == NetworkPlayerApprovalStatus.Denied) { throw new ArgumentNullException("Player has already been " + _status); } if (approvalData == null) { throw new ArgumentNullException("approvalData"); } for (int i = 0; i < approvalData.Length; i++) { if (approvalData[i] == null) { throw new ArgumentNullException("approvalData[" + i + "]"); } } _status = NetworkPlayerApprovalStatus.Approved; _network._ApproveClient(this, _msg, approvalData); }
/// <summary> /// Change approval status of the player to waiting. /// This should be called if you want to do a time consuming operation like connecting to web services or loading /// data from data bases to decide on the player's approval. /// </summary> public void Wait() { _status = NetworkPlayerApprovalStatus.Waiting; }