private void UpdateChatPermissionInfoComplete(PARTY_XBL_CHAT_USER_HANDLE localXblChatUser, PARTY_XBL_CHAT_USER_HANDLE targetXblChatUser) { PlayFabMultiplayerManager._LogInfo("PlayFabChatXboxLivePolicyProvider:UpdateChatPermissionInfoComplete()"); ulong localXuid; ulong targetXuid; if (!Succeeded(XBLSDK.PartyXblChatUserGetXboxUserId(localXblChatUser, out localXuid))) { return; } if (!Succeeded(XBLSDK.PartyXblChatUserGetXboxUserId(targetXblChatUser, out targetXuid))) { return; } PlayFabPlayer localPlayer = GetPlayerByXuid(localXuid); PlayFabPlayer targetPlayer = GetPlayerByXuid(targetXuid); PARTY_XBL_CHAT_PERMISSION_INFO chatPermissionInfo; Succeeded(XBLSDK.PartyXblLocalChatUserGetRequiredChatPermissionInfo( localXblChatUser, targetXblChatUser, out chatPermissionInfo )); Succeeded(PartyCSharpSDK.SDK.PartyChatControlSetPermissions( localPlayer._chatControlHandle, targetPlayer._chatControlHandle, chatPermissionInfo.ChatPermissionMask )); var permissionsQuery = chatPermissionInfo.ChatPermissionMask; if (permissionsQuery != _CHAT_PERMISSIONS_ALL) { foreach (var playerKeyPair in _multiplayerManager.RemotePlayers) { if (playerKeyPair.EntityKey.Id == targetPlayer.EntityKey.Id) { playerKeyPair._mutedByPlatform = true; playerKeyPair.IsMuted = true; break; } } } if (!_playerChatPermissions.ContainsKey(targetPlayer)) { _playerChatPermissions.Add(targetPlayer, chatPermissionInfo); } }
private bool IsReadyToSetChatPermissions(PARTY_XBL_CHAT_USER_HANDLE localXblChatUser, PARTY_XBL_CHAT_USER_HANDLE targetXblChatUser) { bool isReadyToSetChatPermissions = false; ulong localXuid; ulong targetXuid; if (!Succeeded(XBLSDK.PartyXblChatUserGetXboxUserId(localXblChatUser, out localXuid))) { return(false); } if (!Succeeded(XBLSDK.PartyXblChatUserGetXboxUserId(targetXblChatUser, out targetXuid))) { return(false); } isReadyToSetChatPermissions = GetPlayerByXuid(localXuid) != null && GetPlayerByXuid(targetXuid) != null; return(isReadyToSetChatPermissions); }
private void UpdateChatPermissionInfoComplete(PARTY_XBL_CHAT_USER_HANDLE localXblChatUser, PARTY_XBL_CHAT_USER_HANDLE targetXblChatUser) { PlayFabMultiplayerManager._LogInfo("PlayFabChatXboxLivePolicyProvider:UpdateChatPermissionInfoComplete()"); // UpdateChatPermissionInfoComplete() is called when we are finally ready to set permissions, // and thus the cached operation in _queuedUpdateChatPermissionsOp is no longer needed // (if it was created then localXblChatUser and targetXblChatUser from it will be used in this method // to set permissions). It needs to be reset to prevent unnecessary continuous re-entrance to this method. if (_queuedUpdateChatPermissionsOp.queued) { _queuedUpdateChatPermissionsOp = new QueuedUpdateChatPermissionsOp(); // reset _queuedUpdateChatPermissionsOp to its initial (default) state } ulong localXuid; ulong targetXuid; if (!Succeeded(XBLSDK.PartyXblChatUserGetXboxUserId(localXblChatUser, out localXuid))) { return; } if (!Succeeded(XBLSDK.PartyXblChatUserGetXboxUserId(targetXblChatUser, out targetXuid))) { return; } PlayFabPlayer localPlayer = GetPlayerByXuid(localXuid); PlayFabPlayer targetPlayer = GetPlayerByXuid(targetXuid); if (localPlayer == null || targetPlayer == null) { return; } PARTY_XBL_CHAT_PERMISSION_INFO chatPermissionInfo; Succeeded(XBLSDK.PartyXblLocalChatUserGetRequiredChatPermissionInfo( localXblChatUser, targetXblChatUser, out chatPermissionInfo )); Succeeded(PartyCSharpSDK.SDK.PartyChatControlSetPermissions( localPlayer._chatControlHandle, targetPlayer._chatControlHandle, chatPermissionInfo.ChatPermissionMask )); var permissionsQuery = chatPermissionInfo.ChatPermissionMask; if (permissionsQuery != _CHAT_PERMISSIONS_ALL) { foreach (var playerKeyPair in _multiplayerManager.RemotePlayers) { if (playerKeyPair.EntityKey.Id == targetPlayer.EntityKey.Id) { playerKeyPair._mutedByPlatform = true; playerKeyPair.IsMuted = true; break; } } } if (!_playerChatPermissions.ContainsKey(targetPlayer)) { _playerChatPermissions.Add(targetPlayer, chatPermissionInfo); } }