Player Interaction With The Chatbox

I have prepared a component on how you can implement a method to interact with the chatbox. The component is:

ChatBoxPlayerInputControl

Just attach this component to the root of your character and it will control opening/closing the chatbox, cursor locking/unlocking, cursor visibility, auto selecting the message input, and locking/unlocking player movement. Everything you might need to enable and disable a chatbox in a common way.

Open this component and you will see that it takes advantage of the OnChatBoxStatusChanged delegate to take appropriate actions when the chatbox is visible or not. Of course everything is completely overridable so you can modify this to your needs.

Chatbox W/ Inventory

When using the ChatBoxPlayerInputControl component with a inventory there are a few additional manual steps you need to take.

  1. On the OnChatBoxOpened event add MP_vItemManager.LockInventoryInput as true.
  2. On the OnChatBoxClosed event add MP_vItemManager.LockInventoryInput as false.
  3. Find the child gameobject holding the MP_vIventory component and on the OnOpenCloseInventory event add ChatBoxPlayerInputControl.LockInput

Now the chatbox will not fight with the inventory and visa versa.

Chatbox w/ ThrowManager

When using the ChatBoxPlayerInputControl component with a ThrowManager these are additional manual steps you need to take.

  1. On the OnChatBoxOpened event add MP_vThrowManager.CanUseThrow as false.
  2. On the OnChatBoxClosed event add MP_vThrowManager.CanUseThrow as true.

Now when typeing "g" (or whatever the throw button is) it will not take effect when you have the chatbox open.