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.
- On the
OnChatBoxOpenedevent addMP_vItemManager.LockInventoryInputastrue. - On the
OnChatBoxClosedevent addMP_vItemManager.LockInventoryInputasfalse. - Find the child gameobject holding the
MP_vIventorycomponent and on theOnOpenCloseInventoryevent addChatBoxPlayerInputControl.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.
- On the
OnChatBoxOpenedevent addMP_vThrowManager.CanUseThrowasfalse. - On the
OnChatBoxClosedevent addMP_vThrowManager.CanUseThrowastrue.
Now when typeing "g" (or whatever the throw button is) it will not take effect when you have the chatbox open.