internal void OnParticipantStatusChanged(NativeRealTimeRoom room, MultiplayerParticipant participant) { lock (mLifecycleLock) { mState.OnParticipantStatusChanged(room, participant); } }
private void FindEqualVersionMatchWithParticipant(TurnBasedMatch match, string participantId, Action <bool> onFailure, Action <MultiplayerParticipant, NativeTurnBasedMatch> onFoundParticipantAndMatch) { FindEqualVersionMatch(match, onFailure, foundMatch => { // If we received a null participantId, we're using an automatching player instead - // issue the callback using that. if (participantId == null) { using (var sentinelParticipant = MultiplayerParticipant.AutomatchingSentinel()) { onFoundParticipantAndMatch(sentinelParticipant, foundMatch); return; } } using (var participant = foundMatch.ParticipantWithId(participantId)) { if (participant == null) { Logger.e(string.Format("Located match {0} but desired participant with ID " + "{1} could not be found", match.MatchId, participantId)); onFailure(false); return; } onFoundParticipantAndMatch(participant, foundMatch); } }); }
internal MultiplayerParticipant Inviter() { MultiplayerParticipant participant = new MultiplayerParticipant(C.MultiplayerInvitation_InvitingParticipant(SelfPtr())); if (!participant.Valid()) { participant.Dispose(); return null; } return participant; }
internal MultiplayerParticipant PendingParticipant() { var participant = new MultiplayerParticipant( C.TurnBasedMatch_PendingParticipant(SelfPtr())); if (!participant.Valid()) { participant.Dispose(); return null; } return participant; }
internal override void HandleParticipantStatusChanged(NativeRealTimeRoom room, MultiplayerParticipant participant) { if (!FailedStatuses.Contains(participant.Status())) { return; } Logger.e(string.Format("Participant {0} changed to status {1}, room will never be" + "fully connected.", participant.Id(), participant.Status())); LeaveRoom(); }
internal override void OnDataReceived(NativeRealTimeRoom room, MultiplayerParticipant sender, byte[] data, bool isReliable) { mSession.OnGameThreadListener().RealTimeMessageReceived(isReliable, sender.Id(), data); }
internal virtual void HandleParticipantStatusChanged(NativeRealTimeRoom room, MultiplayerParticipant participant) { // noop }
internal sealed override void OnParticipantStatusChanged(NativeRealTimeRoom room, MultiplayerParticipant participant) { HandleParticipantStatusChanged(room, participant); UpdateCurrentRoom(room); }
internal virtual void OnDataReceived(NativeRealTimeRoom room, MultiplayerParticipant sender, byte[] data, bool isReliable) { Logger.d(this.GetType().Name + ".OnDataReceived: Defaulting to no-op."); }
internal virtual void OnParticipantStatusChanged(NativeRealTimeRoom room, MultiplayerParticipant participant) { Logger.d(this.GetType().Name + ".OnParticipantStatusChanged: Defaulting to no-op."); }
/** * Non-Lifecycle methods - these cannot cause state transitions, and thus we do not need to * hold any locks. We rely on only accessing volatile fields to ensure consistency instead. */ internal void OnDataReceived(NativeRealTimeRoom room, MultiplayerParticipant sender, byte[] data, bool isReliable) { mState.OnDataReceived(room, sender, data, isReliable); }
internal void TakeTurn(NativeTurnBasedMatch match, byte[] data, MultiplayerParticipant nextParticipant, Action<TurnBasedMatchResponse> callback) { TurnBasedMultiplayerManager.TurnBasedMultiplayerManager_TakeMyTurn( mGameServices.AsHandle(), match.AsPointer(), data, new UIntPtr((uint)data.Length), // Just pass along the old results. Technically the API allows updates here, but // we never need them. match.Results().AsPointer(), nextParticipant.AsPointer(), InternalTurnBasedMatchCallback, ToCallbackPointer(callback)); }
internal void LeaveDuringMyTurn(NativeTurnBasedMatch match, MultiplayerParticipant nextParticipant, Action<MultiplayerStatus> callback) { TurnBasedMultiplayerManager.TurnBasedMultiplayerManager_LeaveMatchDuringMyTurn( mGameServices.AsHandle(), match.AsPointer(), nextParticipant.AsPointer(), InternalMultiplayerStatusCallback, Callbacks.ToIntPtr(callback) ); }