private void voiceManager_OnTextMessageLogReceivedEvent(string sender, IChannelTextMessage channelTextMessage) // TextMessage를 받는 event handler { if (channelTextMessage.ApplicationStanzaNamespace.EndsWith(NetworkManagerHUDWBTB.MatchStatus.Seeking.ToString()) && NetworkServer.active) // { SendLobbyUpdate(NetworkManagerHUDWBTB.MatchStatus.Open); } }
public void DisplayHostingMessage(IChannelTextMessage channelTextMessage) { var newMessageObj = Instantiate(MessageObject, ChatContentObj.transform); _messageObjPool.Add(newMessageObj); Text newMessageText = newMessageObj.GetComponent <Text>(); }
private void VivoxVoiceManager_OnTextMessageLogReceivedEvent(string sender, IChannelTextMessage channelTextMessage) { if (channelTextMessage.ApplicationStanzaNamespace.EndsWith(VivoxNetworkManager.MatchStatus.Seeking.ToString()) && NetworkServer.active) { SendLobbyUpdate(VivoxNetworkManager.MatchStatus.Open); } }
private void OnChatMessageRecieved(ChatChannelType channelType, [NotNull] IChannelTextMessage args) { if (args == null) { throw new ArgumentNullException(nameof(args)); } if (!Enum.IsDefined(typeof(ChatChannelType), channelType)) { throw new InvalidEnumArgumentException(nameof(channelType), (int)channelType, typeof(ChatChannelType)); } AccountId id = args.Sender; int characterId = int.Parse(id.Name); //TODO: We need to translate the guid to a name. NetworkEntityGuid guid = NetworkEntityGuidBuilder.New() .WithType(EntityType.Player) .WithId(characterId) .Build(); if (NameQueryService.Exists(guid)) { PublishTextData(channelType, args, guid, NameQueryService.Retrieve(guid)); } else { UnityAsyncHelper.UnityMainThreadContext.PostAsync(async() => { string queryResponse = await NameQueryService.RetrieveAsync(guid) .ConfigureAwaitFalse(); PublishTextData(channelType, args, guid, queryResponse); }); } }
private void OnTextMessageLogReceivedEvent(string sender, IChannelTextMessage channelTextMessage) { if (!String.IsNullOrEmpty(channelTextMessage.ApplicationStanzaNamespace)) { // If we find a message with an ApplicationStanzaNamespace we don't push that to the chat box. // Such messages denote opening/closing or requesting the open status of multiplayer matches. return; } var newMessageObj = Instantiate(MessageObject, ChatContentObj.transform); _messageObjPool.Add(newMessageObj); Text newMessageText = newMessageObj.GetComponent <Text>(); if (channelTextMessage.FromSelf) { newMessageText.alignment = TextAnchor.MiddleRight; newMessageText.text = string.Format($"{channelTextMessage.Message} :<color=blue>{sender} </color>\n<color=#5A5A5A><size=8>{channelTextMessage.ReceivedTime}</size></color>"); StartCoroutine(SendScrollRectToBottom()); } else { newMessageText.alignment = TextAnchor.MiddleLeft; newMessageText.text = string.Format($"<color=green>{sender} </color>: {channelTextMessage.Message}\n<color=#5A5A5A><size=8>{channelTextMessage.ReceivedTime}</size></color>"); if (ToggleTTS.isOn) { // Speak local tts message with incoming text message new TTSMessage($"{sender} said,", TTSDestination.QueuedLocalPlayback).Speak(_vivoxVoiceManager.LoginSession); new TTSMessage($"{channelTextMessage.Message}", TTSDestination.QueuedLocalPlayback).Speak(_vivoxVoiceManager.LoginSession); } } }
private void OnTextMessageLogReceivedEvent(string sender, IChannelTextMessage channelTextMessage) // text message가 vivox channel에 들어오는 event 발생에 대한 handler { if (!String.IsNullOrEmpty(channelTextMessage.ApplicationStanzaNamespace)) { // If we find a message with an ApplicationStanzaNamespace we don't push that to the chat box. // Such messages denote opening/closing or requesting the open status of multiplayer matches. return; } var newMessageObj = Instantiate(MessageObject, ChatContentObj.transform); _messageObjPool.Add(newMessageObj); Text newMessageText = newMessageObj.GetComponent<Text>(); if (SceneManager.GetActiveScene().name != "InGame") { if (channelTextMessage.FromSelf) // 내가 보낸것 { newMessageText.alignment = TextAnchor.MiddleRight; newMessageText.text = string.Format($"<color=blue>{sender} :</color> {channelTextMessage.Message}"); StartCoroutine(SendScrollRectToBottom()); } else // 딴 사람이 보낸 것 { newMessageText.alignment = TextAnchor.MiddleLeft; newMessageText.text = string.Format($"<color=green>{sender} </color> : {channelTextMessage.Message}"); StartCoroutine(SendScrollRectToBottom()); } } else { Image newMessageImg = newMessageObj.GetComponentInChildren<Image>(); foreach (var p in _playerManagers) { if(_networkManager.PlayerNameList_[p.index] == channelTextMessage.Sender.DisplayName) { newMessageImg.sprite = p.color_sprite[p.myColor]; break; } } if (channelTextMessage.FromSelf) // 내가 보낸것 { newMessageImg.rectTransform.anchorMax = new Vector2(1f, 0.5f); newMessageImg.rectTransform.anchorMin = new Vector2(1f, 0.5f); newMessageImg.rectTransform.anchoredPosition = new Vector2(-55f, 0f); newMessageText.alignment = TextAnchor.MiddleRight; newMessageText.text = string.Format($"{channelTextMessage.Message} "); StartCoroutine(SendScrollRectToBottom()); } else // 딴 사람이 보낸 것 { newMessageImg.rectTransform.anchorMax = new Vector2(0f, 0.5f); newMessageImg.rectTransform.anchorMin = new Vector2(0f, 0.5f); newMessageImg.rectTransform.anchoredPosition = new Vector2(20f, 0f); newMessageText.alignment = TextAnchor.MiddleLeft; newMessageText.text = string.Format($" {channelTextMessage.Message}"); StartCoroutine(SendScrollRectToBottom()); } } }
public VivoxChannelTextMessageChatMessageAdapter([NotNull] IChannelTextMessage channelMessage, ChatChannelType channelType) { if (!Enum.IsDefined(typeof(ChatChannelType), channelType)) { throw new InvalidEnumArgumentException(nameof(channelType), (int)channelType, typeof(ChatChannelType)); } ChannelMessage = channelMessage ?? throw new ArgumentNullException(nameof(channelMessage)); ChannelType = channelType; }
public void Check_Message_Args(IChannelTextMessage message) { if (message.ApplicationStanzaNamespace == "Test") { Debug.Log("This is a test"); if (message.ApplicationStanzaBody == "blue") { Debug.Log("this player is blue"); } } if (message.ApplicationStanzaBody == "Helloe Body") { Debug.Log("This a hidden message"); } }
public void DisplayHostingMessage(IChannelTextMessage channelTextMessage) { GameObject newMessageObject = Instantiate(messageObject, chatContentWindow.transform); messagePool.Add(newMessageObject); TextMeshProUGUI messageText = newMessageObject.GetComponent <TextMeshProUGUI>(); if (channelTextMessage.ApplicationStanzaNamespace.EndsWith(VivoxNetworkManager.MatchStatus.Open.ToString())) { messageText.alignment = TextAlignmentOptions.MidlineLeft; messageText.SetText(string.Format($"<color=blue>{channelTextMessage.Sender.DisplayName} has begun hosting a match.</color>\n<color=#5A5A5A><size=8>{channelTextMessage.ReceivedTime}</size></color>")); } else if (channelTextMessage.ApplicationStanzaNamespace.EndsWith(VivoxNetworkManager.MatchStatus.Closed.ToString())) { messageText.alignment = TextAlignmentOptions.MidlineLeft; messageText.SetText(string.Format($"<color=green>{channelTextMessage.Sender.DisplayName}'s match has ended.</color>\n<color=#5A5A5A><size=8>{channelTextMessage.ReceivedTime}</size></color>")); } }
public void DisplayHostingMessage(IChannelTextMessage channelTextMessage) { var newMessageObj = Instantiate(MessageObject, ChatContentObj.transform); _messageObjPool.Add(newMessageObj); Text newMessageText = newMessageObj.GetComponent <Text>(); if (channelTextMessage.ApplicationStanzaNamespace.EndsWith(VivoxNetworkManager.MatchStatus.Open.ToString())) { newMessageText.alignment = TextAnchor.MiddleLeft; newMessageText.text = string.Format($"<color=blue>{channelTextMessage.Sender.DisplayName} has begun hosting a match.</color>\n<color=#5A5A5A><size=8>{channelTextMessage.ReceivedTime}</size></color>"); } else if (channelTextMessage.ApplicationStanzaNamespace.EndsWith(VivoxNetworkManager.MatchStatus.Closed.ToString())) { newMessageText.alignment = TextAnchor.MiddleLeft; newMessageText.text = string.Format($"<color=blue>{channelTextMessage.Sender.DisplayName}'s match has ended.</color>\n<color=#5A5A5A><size=8>{channelTextMessage.ReceivedTime}</size></color>"); } }
private void onTextMessageLogRecivedEvent(string sender, IChannelTextMessage channelTextMessage) { if (!String.IsNullOrEmpty(channelTextMessage.ApplicationStanzaNamespace)) { return; } var newMessage = Instantiate(messageObj, chatConntent.transform); if (messageObjPoll.Count >= 14) { Destroy(messageObjPoll[0]); messageObjPoll.RemoveAt(0); } newMessage.GetComponent <Text>().text = string.Format($"<color=#3F3F3F><size=8>{sender} </size><size=5>{channelTextMessage.ReceivedTime}</size></color>\n{channelTextMessage.Message}"); messageObjPoll.Add(newMessage); Debug.Log(channelTextMessage.Message); StartCoroutine(SendScrollRectToBottom()); }
private void OnTextMessageLogReceived(string sender, IChannelTextMessage channelTextMessage) { if (String.IsNullOrEmpty(channelTextMessage.ApplicationStanzaNamespace)) { return; } if (channelTextMessage.ApplicationStanzaNamespace.EndsWith(VivoxNetworkManager.MatchStatus.Open.ToString())) { if (AddJoinButton(channelTextMessage.Sender.Name, channelTextMessage.Sender.DisplayName, channelTextMessage.ApplicationStanzaBody)) { textChat.DisplayHostingMessage(channelTextMessage); } } else if (channelTextMessage.ApplicationStanzaBody.EndsWith(VivoxNetworkManager.MatchStatus.Closed.ToString())) { if (RemoveJoinButton(channelTextMessage.Sender.Name)) { textChat.DisplayHostingMessage(channelTextMessage); } } }
private void OnTextMessageLogReceived(string sender, IChannelTextMessage channelTextMessage) { if (!String.IsNullOrEmpty(channelTextMessage.ApplicationStanzaNamespace)) { return; } GameObject newMessageObject = Instantiate(messageObject, chatContentWindow.transform); messagePool.Add(newMessageObject); TextMeshProUGUI messageText = newMessageObject.GetComponent <TextMeshProUGUI>(); if (channelTextMessage.FromSelf) { messageText.alignment = TextAlignmentOptions.MidlineRight; messageText.SetText($"{channelTextMessage.Message} <color=blue>:{sender}</color>\n<color=#5A5A5A><size=14>{channelTextMessage.ReceivedTime}</size></color>"); StartCoroutine(SetScrollRectPositioning()); } else { messageText.alignment = TextAlignmentOptions.MidlineLeft; messageText.SetText($"<color=green>{sender}:</color> {channelTextMessage.Message}\n<color=#5A5A5A><size=14>{channelTextMessage.ReceivedTime}</size></color>"); } }
private void OnTextMessageLogReceivedEvent(string sender, IChannelTextMessage channelTextMessage) { // Only handle MatchStatus control signals if (String.IsNullOrEmpty(channelTextMessage.ApplicationStanzaNamespace)) { return; } // If we find a message with this tag we don't push that to the chat box. Messages with this tag are intended to denote an open or closed multiplayer match. if (channelTextMessage.ApplicationStanzaNamespace.EndsWith(VivoxNetworkManager.MatchStatus.Open.ToString())) { if (AddJoinButton(channelTextMessage.Sender.Name, channelTextMessage.Sender.DisplayName, channelTextMessage.ApplicationStanzaBody)) { TextChatUIObj.DisplayHostingMessage(channelTextMessage); } } else if (channelTextMessage.ApplicationStanzaNamespace.EndsWith(VivoxNetworkManager.MatchStatus.Closed.ToString())) { if (RemoveJoinButton(channelTextMessage.Sender.Name)) { TextChatUIObj.DisplayHostingMessage(channelTextMessage); } } }
private void PublishTextData(ChatChannelType channelType, IChannelTextMessage args, NetworkEntityGuid guid, string name) { TextChatEventArgs data = TextDataFactory.CreateChatData(new EntityAssociatedData <VivoxChannelTextMessageChatMessageAdapter>(guid, new VivoxChannelTextMessageChatMessageAdapter(args, channelType)), name); MessageRecievedPublisher.PublishEvent(this, data); }
public void OnReceiveTextMessage(string sender, IChannelTextMessage channelTextMessage) { channelTextMessageReceived?.Invoke($"{sender}: {channelTextMessage.Message}"); }
private void Vivox_OnTextMessageLogReceivedEvent(string sender, IChannelTextMessage channelTextMessage) { Debug.Log(channelTextMessage); }