Browse Source

Some renaming

master
Nico de Poel 5 years ago
parent
commit
fa6f730347
  1. 24
      Assets/Scripts/EOSVoiceChat.cs

24
Assets/Scripts/EOSVoiceChat.cs

@ -19,7 +19,7 @@ public class EOSVoiceChat
private readonly LobbyInterface lobbyInterface; private readonly LobbyInterface lobbyInterface;
private readonly RTCInterface rtcInterface; private readonly RTCInterface rtcInterface;
private readonly RTCAudioInterface audioInterface; private readonly RTCAudioInterface audioInterface;
private readonly Func<ProductUserId> productUserProvider;
private readonly Func<ProductUserId> localUserProvider;
private readonly IProductUserMapper productUserMapper; private readonly IProductUserMapper productUserMapper;
private readonly Dictionary<ProductUserId, ChatUser> chatUsers = new Dictionary<ProductUserId, ChatUser>(); private readonly Dictionary<ProductUserId, ChatUser> chatUsers = new Dictionary<ProductUserId, ChatUser>();
@ -36,12 +36,12 @@ public class EOSVoiceChat
/// </summary> /// </summary>
public EOSVoiceChat( public EOSVoiceChat(
LobbyInterface lobbyInterface, RTCInterface rtcInterface, RTCAudioInterface audioInterface, LobbyInterface lobbyInterface, RTCInterface rtcInterface, RTCAudioInterface audioInterface,
Func<ProductUserId> productUserProvider, IProductUserMapper productUserMapper)
Func<ProductUserId> localUserProvider, IProductUserMapper productUserMapper)
{ {
this.lobbyInterface = lobbyInterface; this.lobbyInterface = lobbyInterface;
this.rtcInterface = rtcInterface; this.rtcInterface = rtcInterface;
this.audioInterface = audioInterface; this.audioInterface = audioInterface;
this.productUserProvider = productUserProvider;
this.localUserProvider = localUserProvider;
this.productUserMapper = productUserMapper; this.productUserMapper = productUserMapper;
} }
@ -58,7 +58,7 @@ public class EOSVoiceChat
lobbyInterface.CreateLobbySearch(new CreateLobbySearchOptions { MaxResults = 1 }, out var searchHandle); lobbyInterface.CreateLobbySearch(new CreateLobbySearchOptions { MaxResults = 1 }, out var searchHandle);
searchHandle.SetLobbyId(new LobbySearchSetLobbyIdOptions { LobbyId = chatLobbyName }); searchHandle.SetLobbyId(new LobbySearchSetLobbyIdOptions { LobbyId = chatLobbyName });
var localUserId = productUserProvider.Invoke();
var localUserId = localUserProvider.Invoke();
searchHandle.Find(new LobbySearchFindOptions { LocalUserId = localUserId }, null, findData => searchHandle.Find(new LobbySearchFindOptions { LocalUserId = localUserId }, null, findData =>
{ {
switch (findData.ResultCode) switch (findData.ResultCode)
@ -162,7 +162,7 @@ public class EOSVoiceChat
rtcRoomName = null; rtcRoomName = null;
var result = lobbyInterface.GetRTCRoomName( var result = lobbyInterface.GetRTCRoomName(
new GetRTCRoomNameOptions { LocalUserId = productUserProvider.Invoke(), LobbyId = connectedLobbyId },
new GetRTCRoomNameOptions { LocalUserId = localUserProvider.Invoke(), LobbyId = connectedLobbyId },
out string roomName); out string roomName);
if (result != Result.Success) if (result != Result.Success)
@ -186,7 +186,7 @@ public class EOSVoiceChat
( (
new LeaveLobbyOptions new LeaveLobbyOptions
{ {
LocalUserId = productUserProvider.Invoke(),
LocalUserId = localUserProvider.Invoke(),
LobbyId = connectedLobbyId, LobbyId = connectedLobbyId,
}, },
null, null,
@ -208,7 +208,7 @@ public class EOSVoiceChat
audioInterface.UpdateSending(new UpdateSendingOptions audioInterface.UpdateSending(new UpdateSendingOptions
{ {
LocalUserId = productUserProvider.Invoke(),
LocalUserId = localUserProvider.Invoke(),
RoomName = rtcRoomName, RoomName = rtcRoomName,
AudioStatus = muted ? RTCAudioStatus.Disabled : RTCAudioStatus.Enabled, AudioStatus = muted ? RTCAudioStatus.Disabled : RTCAudioStatus.Enabled,
}, null, data => { }); }, null, data => { });
@ -227,7 +227,7 @@ public class EOSVoiceChat
{ {
audioInterface.UpdateReceiving(new UpdateReceivingOptions audioInterface.UpdateReceiving(new UpdateReceivingOptions
{ {
LocalUserId = productUserProvider.Invoke(),
LocalUserId = localUserProvider.Invoke(),
ParticipantId = remoteProductUser, ParticipantId = remoteProductUser,
RoomName = rtcRoomName, RoomName = rtcRoomName,
AudioEnabled = !muted, AudioEnabled = !muted,
@ -244,7 +244,7 @@ public class EOSVoiceChat
if (!IsConnected) if (!IsConnected)
return; return;
var localUserId = productUserProvider.Invoke();
var localUserId = localUserProvider.Invoke();
foreach (var remoteProductUser in chatUsers.Keys) foreach (var remoteProductUser in chatUsers.Keys)
{ {
audioInterface.UpdateReceiving(new UpdateReceivingOptions audioInterface.UpdateReceiving(new UpdateReceivingOptions
@ -265,7 +265,7 @@ public class EOSVoiceChat
{ {
audioInterface.SetAudioOutputSettings(new SetAudioOutputSettingsOptions audioInterface.SetAudioOutputSettings(new SetAudioOutputSettingsOptions
{ {
LocalUserId = productUserProvider.Invoke(),
LocalUserId = localUserProvider.Invoke(),
DeviceId = null, // Default output device DeviceId = null, // Default output device
Volume = volume * 50f, Volume = volume * 50f,
}); });
@ -275,7 +275,7 @@ public class EOSVoiceChat
/// Whether the requested player is currently talking or not. /// Whether the requested player is currently talking or not.
/// This can be either the local player or a remote player. /// This can be either the local player or a remote player.
/// </summary> /// </summary>
public bool IsUserTalking(string playerId)
public bool IsPlayerTalking(string playerId)
{ {
foreach (var chatUser in chatUsers.Values) foreach (var chatUser in chatUsers.Values)
{ {
@ -292,7 +292,7 @@ public class EOSVoiceChat
private void SubscribeToRoomNotifications() private void SubscribeToRoomNotifications()
{ {
var localUserId = productUserProvider.Invoke();
var localUserId = localUserProvider.Invoke();
if (!onConnectionChangedCallbackId.HasValue) if (!onConnectionChangedCallbackId.HasValue)
{ {

Loading…
Cancel
Save