private void OnInputFieldChatValueChanged(string rawInput) { // update parsed input parsedInput = Chat.ParsePlayerInput(rawInput, chatContext); var inputChannel = parsedInput.ParsedChannel; // Check if player typed new channel shotrcut (for instance ';' or ':e') if (inputChannel != ChatChannel.None) { // check if entered channel avaliable for player var availChannels = GetAvailableChannels(); if (availChannels.HasFlag(inputChannel)) { EnableChannel(inputChannel); } else { // TODO: need some addition UX indication that channel is not avaliable Logger.Log($"Player trying to write message to channel {inputChannel}, but there are only {availChannels} avaliable;", Category.Chat); } // delete all tags from input InputFieldChat.text = parsedInput.ClearMessage; } OnChatInputChanged?.Invoke(rawInput, selectedChannels); }
public void OnClickSend() { parsedInput = Chat.ParsePlayerInput(InputFieldChat.text, chatContext); if (Chat.IsValidToSend(parsedInput.ClearMessage)) { _ = SoundManager.Play(SingletonSOSounds.Instance.Click01); PlayerSendChat(parsedInput.ClearMessage); } CloseChatWindow(); }
public void OnClickSend() { parsedInput = Chat.ParsePlayerInput(InputFieldChat.text, chatContext); if (Chat.IsValidToSend(parsedInput.ClearMessage)) { SoundManager.Play("Click01"); PlayerSendChat(parsedInput.ClearMessage); } CloseChatWindow(); }
private void Update() { // TODO add events to inventory slot changes to trigger channel refresh if (chatInputWindow.activeInHierarchy && !isChannelListUpToDate()) { Logger.Log("Channel list is outdated!", Category.Chat); RefreshChannelPanel(); } if (KeyboardInputManager.IsEnterPressed() && !windowCoolDown && chatInputWindow.activeInHierarchy) { if (UIManager.IsInputFocus) { parsedInput = Chat.ParsePlayerInput(InputFieldChat.text, chatContext); if (Chat.IsValidToSend(parsedInput.ClearMessage)) { PlayerSendChat(parsedInput.ClearMessage); } CloseChatWindow(); } } if (!chatInputWindow.activeInHierarchy) { return; } if (KeyboardInputManager.IsEscapePressed()) { CloseChatWindow(); } if (InputFieldChat.isFocused) { return; } if (KeyboardInputManager.IsMovementPressed() || KeyboardInputManager.IsEscapePressed()) { CloseChatWindow(); } }