Class ChatPopup
Very similar to SocialUIPopup, but for the ChatPanel. We need different information like UIChatMessage instead of
Assign your own custom subclass of ChatPopupClickHandler to manage the actual clicking functionality.
Note: OnDeselect(BaseEventData) calls UnityEngine.Animator.SetTrigger(System.String) with FADE_OUT. To avoid warnings the UnityEngine.RuntimeAnimatorController should have a Trigger with that name.
Inheritance
Implements
Inherited Members
Namespace: LlamaSoftware.Chat.UI
Assembly: LlamaSoftware.Chat.dll
Syntax
[RequireComponent(typeof(RectTransform), typeof(Selectable), typeof(Animator))]
[RequireComponent(typeof(CanvasGroup))]
public class ChatPopup : MonoBehaviour, IDeselectHandler, IEventSystemHandler
Fields
AnimationController
Optional RuntimeAnimatorController. If assigned it will override whatever is assigned to the animator in Awake().
Declaration
public RuntimeAnimatorController AnimationController
Field Value
Type | Description |
---|---|
UnityEngine.RuntimeAnimatorController |
animator
Animator for this Popup. Automatically assigned in Awake(). If AnimationController is assigned, will override whatever is set up in the inspector.
Declaration
[HideInInspector]
public Animator animator
Field Value
Type | Description |
---|---|
UnityEngine.Animator |
canvasGroup
CanvasGroup for this Popup. Automatically assigned / configured in Awake().
Declaration
[HideInInspector]
public CanvasGroup canvasGroup
Field Value
Type | Description |
---|---|
UnityEngine.CanvasGroup |
chatPanel
Chat Panel instance. This is assigned by the ChatPanel.
Declaration
public ChatPanel chatPanel
Field Value
Type | Description |
---|---|
ChatPanel |
ClickedLink
The link that was clicked.
You should assign it in your custom HandleClick(ChatPopup, TMP_LinkInfo, PointerEventData).
Declaration
public TMP_LinkInfo ClickedLink
Field Value
Type | Description |
---|---|
TMPro.TMP_LinkInfo |
ClickHandler
The Click Handler to use to handle clicks. You will have to write your own subclass (see
Declaration
public ChatPopupClickHandler ClickHandler
Field Value
Type | Description |
---|---|
ChatPopupClickHandler |
IsSelected
If this is selected or not. If you want to show this popup then you should assign it to true in your custom HandleClick(ChatPopup, TMP_LinkInfo, PointerEventData). Is set to false automatically in the OnDeselect(BaseEventData).
Declaration
public bool IsSelected
Field Value
Type | Description |
---|---|
System.Boolean |
LocalPlayer
Local Player_Chat instance. Assigned in OnStartLocalPlayer().
Declaration
public Player_Chat LocalPlayer
Field Value
Type | Description |
---|---|
Player_Chat |
Options
List of available Chat Item options.
Declaration
public List<DynamicChatItem> Options
Field Value
Type | Description |
---|---|
System.Collections.Generic.List<DynamicChatItem> |
rectTransform
RectTransform for this Popup. Automatically assigned / configured in Awake()
Declaration
[HideInInspector]
public RectTransform rectTransform
Field Value
Type | Description |
---|---|
UnityEngine.RectTransform |
selectable
Selectable for this Popup. Automatically assigned / configured in Awake()
Declaration
[HideInInspector]
public Selectable selectable
Field Value
Type | Description |
---|---|
UnityEngine.UI.Selectable |
selectedChatMessage
The ChatMessage that was clicked.
You should assign it in your custom HandleClick(ChatPopup, TMP_LinkInfo, PointerEventData).
Declaration
public UIChatMessage selectedChatMessage
Field Value
Type | Description |
---|---|
UIChatMessage |
SelectedLinkHashCode
Text Mesh Pro's Selected Link Hash Code. Will be -1 if no link is clicked. You should assign it in your custom HandleClick(ChatPopup, TMP_LinkInfo, PointerEventData).
For examples see
Declaration
public int SelectedLinkHashCode
Field Value
Type | Description |
---|---|
System.Int32 |
Methods
Awake()
Sets up the component, adds required components if missing
Declaration
protected virtual void Awake()
HandleClick(TMP_LinkInfo, PointerEventData)
Just calls the click handler and give it a referece to this class since we have a lot of referenes it will need to do any interesting behaviors.
Declaration
public virtual void HandleClick(TMP_LinkInfo ClickedLink, PointerEventData pointerEventData)
Parameters
Type | Name | Description |
---|---|---|
TMPro.TMP_LinkInfo | ClickedLink | Link that was clicked |
UnityEngine.EventSystems.PointerEventData | pointerEventData | Event Data |
OnDeselect(BaseEventData)
This is automatically called on deselect because of UnityEngine.EventSystems.IDeselectHandler. Resets SelectedLinkHashCode, IsSelected = false, and calls UnityEngine.Animator.SetTrigger(System.String) with FADE_OUT.
Declaration
public virtual void OnDeselect(BaseEventData eventData)
Parameters
Type | Name | Description |
---|---|---|
UnityEngine.EventSystems.BaseEventData | eventData |