Skip to main content

OnGlobalChat

public GlobalChatEventHandler OnGlobalChat;

Argument

ValueTypeDescription
argsGlobalChatEventArgsMessage information sent from the operator

GlobalChatEventArgs

ValueTypeDescription
ErrInfoErrorInfoSuccess/failure information
FromSessionInfoInformation of the person who sent the announcement message
MessageStringAnnouncement message content

Description

Receives messages sent by the operator.

In order for an event to be called, the message sending/receiving method must be called.

Example

// First way
Backend.Chat.OnGlobalChat = (GlobalChatEventArgs args) =>
{
Debug.Log(string.Format("OnGlobalChat {0}", args.ErrInfo));

if(args.ErrInfo == ErrorInfo.Success)
{
Debug.Log(string.Format("[User Notification] {0} : ", args.From.NickName, args.Message));
}
else
{
Debug.Log(string.Format("[Error] {0}", "Not an operator"));
}
};

// Second way
Backend.Chat.OnGlobalChat += (args) => {
// Same logic as the first way
}

Argument cases

When a message from an operator is received args.ErrInfo : ErrorInfo.Success ErrInfo.Category: Success ErrInfo.Detail: Success ErrInfo.SocketError: Success

When an announcement is sent but the sender is not an operator ErrInfo.Category: InvalidOperation ErrInfo.Detail: BannedChat ErrInfo.SocketError: Success ErrInfo.Reason: You are not admin.