Show / Hide Table of Contents

Class ChatManager

Inheritance
System.Object
ChatManager
Implements
INetObjectPriority
INetObject
IChatManager
IStorage
ISerializable
Namespace: Eco.Gameplay.Systems.Messaging.Chat
Assembly: Eco.Gameplay.dll
Syntax
[ChatCommandHandler]
public class ChatManager : Singleton<ChatManager>, INetObjectPriority, INetObject, IChatManager, IStorage, ISerializable

Constructors

ChatManager()

Declaration
public ChatManager()

Fields

ChannelManager

Declaration
public ChannelManager ChannelManager
Field Value
Type Description
ChannelManager

ChannelRegistrar

Declaration
public Registrar<Channel> ChannelRegistrar
Field Value
Type Description
Registrar<Channel>

MessageSent

Declaration
public static readonly ThreadSafeAction<ChatMessage> MessageSent
Field Value
Type Description
ThreadSafeAction<ChatMessage>

NotificationSources

Declaration
public ThreadSafeHashSet<NotificationMessageSource> NotificationSources
Field Value
Type Description
ThreadSafeHashSet<NotificationMessageSource>

OnPreMessageSent

Declaration
public static readonly ThreadSafeAction<ChatMessage> OnPreMessageSent
Field Value
Type Description
ThreadSafeAction<ChatMessage>

Properties

Active

Declaration
public bool Active { get; }
Property Value
Type Description
System.Boolean

ChatCommandService

Declaration
public ChatCommandService ChatCommandService { get; }
Property Value
Type Description
ChatCommandService

ID

Declaration
public int ID { get; }
Property Value
Type Description
System.Int32

NetObjectCreationRealtime

Declaration
public double NetObjectCreationRealtime { get; set; }
Property Value
Type Description
System.Double

Priority

Declaration
public float Priority { get; }
Property Value
Type Description
System.Single

StorageHandle

Declaration
public IPersistent StorageHandle { get; set; }
Property Value
Type Description
IPersistent

TotalMessages

Declaration
public int TotalMessages { get; }
Property Value
Type Description
System.Int32

Methods

AddCommandHandler(Type)

Adds handler type. May be used for types which not auto-discovered by reflection (i.e. when some commands only available under specific conditions).

Declaration
public void AddCommandHandler(Type handlerType)
Parameters
Type Name Description
System.Type handlerType

AddToChatLog(ChatMessage)

Declaration
public void AddToChatLog(ChatMessage message)
Parameters
Type Name Description
ChatMessage message

ExecuteCommand(IChatClient, String, SupportedLanguage)

Execute a command string directly, from a IChatClient rather than a User. This allows only a subset of chat commands (those that accept IChatClient instead of User as their first property). Does not require the beginning forward slash '/')

Declaration
public void ExecuteCommand(IChatClient chatClient, string command, SupportedLanguage language)
Parameters
Type Name Description
IChatClient chatClient
System.String command
SupportedLanguage language

ExecuteCommandAsync(IChatClient, String, SupportedLanguage)

Execute a command string directly, from a IChatClient rather than a User. This allows only a subset of chat commands (those that accept IChatClient instead of User as their first property). Does not require the beginning forward slash '/')

Declaration
public Task ExecuteCommandAsync(IChatClient chatClient, string command, SupportedLanguage language)
Parameters
Type Name Description
IChatClient chatClient
System.String command
SupportedLanguage language
Returns
Type Description
System.Threading.Tasks.Task

GetAllChatMessages()

Declaration
public IEnumerable<ChatMessage> GetAllChatMessages()
Returns
Type Description
System.Collections.Generic.IEnumerable<ChatMessage>

GetAllCommands()

Declaration
public IEnumerable<ChatCommand> GetAllCommands()
Returns
Type Description
System.Collections.Generic.IEnumerable<ChatCommand>

GetContext(ChatMessage, Int32, Int32)

Declaration
public static IEnumerable<ChatMessage> GetContext(ChatMessage message, int nPreviousMessages = 0, int nFollowingMessages = 0)
Parameters
Type Name Description
ChatMessage message
System.Int32 nPreviousMessages
System.Int32 nFollowingMessages
Returns
Type Description
System.Collections.Generic.IEnumerable<ChatMessage>

GetMessagesVisibleTo(User, Int32, Double)

Declaration
public static IEnumerable<ChatMessage> GetMessagesVisibleTo(User user, int max, double timeSentBefore = 1.7976931348623157E+308)
Parameters
Type Name Description
User user
System.Int32 max
System.Double timeSentBefore
Returns
Type Description
System.Collections.Generic.IEnumerable<ChatMessage>

GetPlayerMessages(Double, Double)

Declaration
public static IEnumerable<ChatMessage> GetPlayerMessages(double minTimeSeconds = -1.7976931348623157E+308, double maxTimeSeconds = 1.7976931348623157E+308)
Parameters
Type Name Description
System.Double minTimeSeconds
System.Double maxTimeSeconds
Returns
Type Description
System.Collections.Generic.IEnumerable<ChatMessage>

GetSettingsForUser(User)

Declaration
public ChatSettings GetSettingsForUser(User user)
Parameters
Type Name Description
User user
Returns
Type Description
ChatSettings

Initialize()

Declaration
public void Initialize()

InitializeRegistrars(TimedTask)

Declaration
public void InitializeRegistrars(TimedTask timer)
Parameters
Type Name Description
TimedTask timer

IsNotRelevant(INetObjectViewer)

Declaration
public bool IsNotRelevant(INetObjectViewer viewer)
Parameters
Type Name Description
INetObjectViewer viewer
Returns
Type Description
System.Boolean

IsRelevant(INetObjectViewer)

Declaration
public bool IsRelevant(INetObjectViewer viewer)
Parameters
Type Name Description
INetObjectViewer viewer
Returns
Type Description
System.Boolean

IsUpdated(INetObjectViewer)

Declaration
public bool IsUpdated(INetObjectViewer viewer)
Parameters
Type Name Description
INetObjectViewer viewer
Returns
Type Description
System.Boolean

MarkDirty()

Declaration
public void MarkDirty()

ReceiveInitialState(BSONObject)

Declaration
public void ReceiveInitialState(BSONObject bsonObj)
Parameters
Type Name Description
BSONObject bsonObj

ReceiveUpdate(BSONObject)

Declaration
public void ReceiveUpdate(BSONObject bsonObj)
Parameters
Type Name Description
BSONObject bsonObj

RemoveChannelReferencesFromChat(Channel)

Remove a specific channel, that was deleted from the game, from all the tabs that have it in their "Chat Sources"(the list of all the channels that can be displayed in that tab) and all associated chat messages

Declaration
public void RemoveChannelReferencesFromChat(Channel receiver)
Parameters
Type Name Description
Channel receiver

RemoveMessages(Predicate<ChatMessage>)

Removes all messages matching predicate.

Declaration
public int RemoveMessages(Predicate<ChatMessage> predicate)
Parameters
Type Name Description
System.Predicate<ChatMessage> predicate
Returns
Type Description
System.Int32

SanitizeAndSendChat(User, String, SupportedLanguage, String, INetObject)

Declaration
public static Result SanitizeAndSendChat(User user, string text, SupportedLanguage language, string tag = null, INetObject target = null)
Parameters
Type Name Description
User user
System.String text
SupportedLanguage language
System.String tag
INetObject target
Returns
Type Description
Result

Send(User, IChatReceiver, String)

Declaration
public Result Send(User user, IChatReceiver to, string message)
Parameters
Type Name Description
User user
IChatReceiver to
System.String message
Returns
Type Description
Result

SendInitialState(BSONObject, INetObjectViewer)

Declaration
public void SendInitialState(BSONObject bsonObj, INetObjectViewer viewer)
Parameters
Type Name Description
BSONObject bsonObj
INetObjectViewer viewer

SendMessage(User, IChatReceiver, String)

Declaration
public static Result SendMessage(User user, IChatReceiver to, string message)
Parameters
Type Name Description
User user
IChatReceiver to
System.String message
Returns
Type Description
Result

SendUpdate(BSONObject, INetObjectViewer)

Declaration
public void SendUpdate(BSONObject bsonObj, INetObjectViewer viewer)
Parameters
Type Name Description
BSONObject bsonObj
INetObjectViewer viewer

SetChatReceiver(Player, IChatReceiver, Boolean)

Declaration
public void SetChatReceiver(Player player, IChatReceiver receiver, bool activateChat = false)
Parameters
Type Name Description
Player player
IChatReceiver receiver
System.Boolean activateChat

TryResetChatSettings()

Reset chat settings of all users to use the default. Mostly used for testing and playtest.

Declaration
public void TryResetChatSettings()

Implements

INetObjectPriority
INetObject
IChatManager
IStorage
ISerializable

Extension Methods

TagUtils.TagNames(Object, Boolean)
TagUtils.TagDisplayNames(Object, Boolean)
ClientSetViewExtensions.SetClassOfProperty(Object, Player, String, String, Int32)
TypeTooltipExtensions.UILinkGeneric(Object)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾