• Home
  • Documentation
  • Guides
  • FAQ
  • Get Llama Chat
Search Results for

    Show / Hide Table of Contents
    • LlamaSoftware.Chat
      • AbstractPlayerDatabase<T>
      • AreaTriggeredChannelJoiner
      • BaseNetworkManager
      • ChatSystem
      • ChatSystemConstants
      • InMemoryPlayerDatabase
      • LlamaChatSettings
      • LlamaChatSettingsProvider
      • Player_Chat
      • SQLitePlayerDatabase
    • LlamaSoftware.Chat.CustomEditors
      • ChatPanelEditor
      • ChatPopupEditor
      • ChatSystemEditor
      • LlamaChatSettingsCreator
      • Player_ChatEditor
      • SocialUIPopupEditor
      • Utilities
    • LlamaSoftware.Chat.Demo
      • ChatCommandHandler
      • CreateAccount
      • DemoGuildJoiner
      • DemoGuildLeaver
      • DummyNameGenerator
      • DynamicChatPopup
      • InMemoryPlayerLogin
      • Login
      • LoginController
      • SettingsPanel
    • LlamaSoftware.Chat.Demo.Lobby
      • LobbyController
      • LobbyLoginController
      • LobbyNetworkManager
      • LobbyPlayer
      • StressTestSender
    • LlamaSoftware.Chat.Demo.Model
      • LobbyPlayerListMessage
      • LoginMessage
      • LoginResponseMessage
      • RegisterPlayerMessage
      • RegisterUserResponseMessage
    • LlamaSoftware.Chat.Model
      • AddRemoveFriendMessage
      • BlockListMessage
      • BlockUnblockPlayerMessage
      • ChatChannel
      • ChatChannel.ChatType
      • ChatEntry
      • ChatMessage
      • FriendsListMessage
      • FriendUpdateMessage
      • Player
      • PlayerToSocialPlayerConverter
      • ServerBroadcastMessage
      • SocialPlayer
      • SubscribeToChannelsMessage
    • LlamaSoftware.Chat.UI
      • BlockedPlayer
      • ChatChannelClickHandler
      • ChatPanel
      • ChatPanel.DirectChatPlayer
      • ChatPanel.UIChatChannel
      • ChatPopup
      • ChatPopupClickHandler
      • Command
      • DynamicChatItem
      • DynamicChatItemEvent
      • Friend
      • Friend.Status
      • LinkType
      • SocialClickHandler
      • SocialUI
      • SocialUIClickHandler
      • SocialUIPopup
      • UIChatMessage
      • WordFilter

    Class Player_Chat

    Local Player identifying script. Manages registering handlers, setting up scene references, overhead text, and the SocialUI if provided.

    This should be attached to your root Player object in your game.

    Inheritance
    System.Object
    Player_Chat
    Namespace: LlamaSoftware.Chat
    Assembly: LlamaSoftware.Chat.dll
    Syntax
    public class Player_Chat : NetworkBehaviour

    Fields

    chatPanel

    Reference to the ChatPanel in the current active scene. Set up in OnStartLocalPlayer().

    Declaration
    public ChatPanel chatPanel
    Field Value
    Type Description
    ChatPanel

    DefaultChannels

    Default Chat Channels the player should be subscribed to. Every player will default to be inside these channels on object construction. Any dynamic channels should not be included here. See AreaTriggeredChannelJoiner for setting up dynamic channels.

    Declaration
    public List<ChatChannel> DefaultChannels
    Field Value
    Type Description
    System.Collections.Generic.List<ChatChannel>

    DelayBeforeFadingWorldChat

    Delay before calling UnityEngine.Animator.SetTrigger(System.String) with FADE_OUT after the text is first displayed.

    Declaration
    public float DelayBeforeFadingWorldChat
    Field Value
    Type Description
    System.Single

    FADE_OUT_WORLD_SPACE_CHAT_METHOD_NAME

    Cached name of FadeOutWorldSpaceChat()

    Declaration
    protected const string FADE_OUT_WORLD_SPACE_CHAT_METHOD_NAME = "FadeOutWorldSpaceChat"
    Field Value
    Type Description
    System.String

    Id

    Unique ID for this player. Should be the same as PlayerId.

    Declaration
    public string Id
    Field Value
    Type Description
    System.String

    LocalChatRadiusOnReceiveMessage

    Radius to use with UnityEngine.Physics.OverlapSphere(UnityEngine.Vector3,System.Single) to check if a message should show as overhead chat.

    Declaration
    public float LocalChatRadiusOnReceiveMessage
    Field Value
    Type Description
    System.Single

    Name

    Display name for this player. Should be the same as Name.

    Declaration
    public string Name
    Field Value
    Type Description
    System.String

    NO_PARSE_TEXT

    String format for OverheadText to prevent users from using TextMeshPro tags in their messages.

    Declaration
    protected const string NO_PARSE_TEXT = "<noparse>{0}</noparse>"
    Field Value
    Type Description
    System.String

    OverheadText

    TextMeshPro instance to set text for world space chat on.

    Declaration
    public TextMeshPro OverheadText
    Field Value
    Type Description
    TMPro.TextMeshPro

    OverheadTextAnimator

    Animator for Overhead Text / World Space Chat. The active UnityEngine.RuntimeAnimatorController must accept triggers FADE_IN, and FADE_OUT to function properly.

    Declaration
    public Animator OverheadTextAnimator
    Field Value
    Type Description
    UnityEngine.Animator

    socialUI

    Reference to the SocialUI in the current active scene. Set up in OnStartLocalPlayer().

    Declaration
    public SocialUI socialUI
    Field Value
    Type Description
    SocialUI

    SubscribedChannels

    Dictionary of ChatChannels the player is currently subscribed to. Keyed by Channel.

    Declaration
    public Dictionary<uint, ChatChannel> SubscribedChannels
    Field Value
    Type Description
    System.Collections.Generic.Dictionary<System.UInt32, ChatChannel>

    Methods

    Awake()

    Sets up Overhead Text. Warns if missing components.

    Declaration
    protected virtual void Awake()

    ClientBlockedListUpdated(NetworkMessage)

    Client handler for updating a player's block list. Calls .

    Declaration
    protected virtual void ClientBlockedListUpdated(NetworkMessage message)
    Parameters
    Type Name Description
    NetworkMessage message

    Network Message from the . Specifically must be BlockListMessage

    ClientFriendsListUpdated(NetworkMessage)

    Client handler for updating player's friends list. Calls .

    Declaration
    protected virtual void ClientFriendsListUpdated(NetworkMessage message)
    Parameters
    Type Name Description
    NetworkMessage message

    Network Message from the . Specifically must be FriendsListMessage

    ClientFriendUpdated(NetworkMessage)

    Client handler for Friend status update. Calls

    Declaration
    protected virtual void ClientFriendUpdated(NetworkMessage message)
    Parameters
    Type Name Description
    NetworkMessage message

    Network Message from the . Specifically must be FriendUpdateMessage

    FadeOutWorldSpaceChat()

    Calls UnityEngine.Animator.SetTrigger(System.String) on OverheadTextAnimator with FADE_OUT.

    Declaration
    protected virtual void FadeOutWorldSpaceChat()

    GetFriendsAndBlockedPlayers(Int32, Player)

    Sends Friends List and Block list to the client.

    Declaration
    protected virtual void GetFriendsAndBlockedPlayers(int ConnectionId, Player player)
    Parameters
    Type Name Description
    System.Int32 ConnectionId

    Connection id to send the friends/block list to.

    Player player

    Player with friends/block list.

    HandleFindingChatPanel()

    Finds ChatPanel in the scene if not assigned, otherwise does nothing.

    Declaration
    protected virtual void HandleFindingChatPanel()

    NameUpdated(String)

    hook when the name of the player changes.

    Declaration
    protected virtual void NameUpdated(string newName)
    Parameters
    Type Name Description
    System.String newName

    New Player name

    OnStartLocalPlayer()

    Sets up scene references to ChatPanel and SocialUI. Binds this Player_Chat instance to those. Also does all calls to handle incoming messages from the server.

    Declaration
    public override void OnStartLocalPlayer()

    OnStartServer()

    Finds player by connection id from FindPlayerByConnectionId(Int32) and sets up Name and Id.

    Declaration
    public override void OnStartServer()

    ReceivedMessage(NetworkMessage)

    Client handler for chat messages. Calls ReceivedMessage(ChatMessage). Also handles Worldspace chat.

    Declaration
    protected virtual void ReceivedMessage(NetworkMessage message)
    Parameters
    Type Name Description
    NetworkMessage message

    Network Message from the . Must be ChatMessage

    ReceivedPrivateMessage(NetworkMessage)

    Client handler for direct/private messages. Calls ReceivedPrivateMessage(ChatMessage).

    Declaration
    protected virtual void ReceivedPrivateMessage(NetworkMessage message)
    Parameters
    Type Name Description
    NetworkMessage message

    Network Message from the . Specifically must be ChatMessage

    ReceivedServerMessage(NetworkMessage)

    Client handler for server broadcast messages. Calls ReceivedServerBroadcastMessage(String).

    Declaration
    protected virtual void ReceivedServerMessage(NetworkMessage message)
    Parameters
    Type Name Description
    NetworkMessage message

    Network Message from the . Must be ServerBroadcastMessage

    SetupInitialSubscriptions()

    Makes a SubscribeToChannelsMessage request to retrieve list of subscribed channels from the server. See SubscriptionUpdated(NetworkMessage) (UNET) / (Mirror) for how response is handled. Also calls GetFriendsAndBlockedPlayers(Int32, Player)

    Declaration
    protected virtual void SetupInitialSubscriptions()

    ShowOverheadChat(ChatMessage)

    Calls UnityEngine.Animator.SetTrigger(System.String) on OverheadTextAnimator with FADE_IN. Invokes FadeOutWorldSpaceChat() after DelayBeforeFadingWorldChat.

    Declaration
    public virtual void ShowOverheadChat(ChatMessage chatMessage)
    Parameters
    Type Name Description
    ChatMessage chatMessage

    Start()

    Calls SetupInitialSubscriptions() on the server. Moving to OnStartServer(), which sounds better since this only runs on the server, was unstable.

    Declaration
    protected virtual void Start()

    SubscriptionUpdated(NetworkMessage)

    Client handler for Chat Channel subscription changes.

    Declaration
    protected virtual void SubscriptionUpdated(NetworkMessage message)
    Parameters
    Type Name Description
    NetworkMessage message

    Network Message from the . Specifically must be SubscribeToChannelsMessage

    Update()

    Makes the OverheadTextAnimator always face the UnityEngine.Camera.main camera.

    Declaration
    protected virtual void Update()
    In This Article
    Back to top Generated by DocFX