C# Класс ChatGui, TLH

Simple Chat Server Gui to be put on a separate GameObject. Provides a global chat (in lobby) and a room chat (in room).
This script flags it's GameObject with DontDestroyOnLoad(). Make sure this is OK in your case. The Chat Server API in ChatClient basically lets you create any number of channels. You just have to name them. Example: "gc" for Global Channel or for rooms: "rc"+RoomName.GetHashCode() This simple demo sends in a global chat when in lobby and in room channel when in room. Create a more elaborate UI to let players chat in either channel while in room or send private messages. Names of users are set in Authenticate. That should be unique so users can actually get their messages. Workflow: Create ChatClient, Connect to a server with your AppID, Authenticate the user (apply a unique name) and subscribe to some channels. Subscribe a channel before you publish to that channel! Note: Don't forget to call ChatClient.Service(). Might later on be integrated into PUN but for now don't forget.
Наследование: MonoBehaviour, IChatClientListener
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
AlignBottom bool
ChannelsToJoinOnConnect string[]
ChatAppId string
DemoPublishOnSubscribe bool
FullScreen bool
GuiRect Rect
HistoryLengthToFetch int
IsVisible bool
chatClient ChatClient

Открытые методы

Метод Описание
Awake ( ) : void
DebugReturn ( DebugLevel, level, string message ) : void
OnApplicationQuit ( ) : void

To avoid the Editor becoming unresponsive, disconnect all Photon connections in OnApplicationQuit.

OnChatStateChange ( ChatState state ) : void
OnConnected ( ) : void
OnDestroy ( ) : void

To avoid the Editor becoming unresponsive, disconnect the Chat connection.

OnDisconnected ( ) : void
OnEnable ( ) : void
OnGUI ( ) : void
OnGetMessages ( string channelName, string senders, object messages ) : void
OnPrivateMessage ( string sender, object message, string channelName ) : void
OnStatusUpdate ( string user, int status, bool gotMessage, object message ) : void
OnSubscribed ( string channels, bool results ) : void
OnUnsubscribed ( string channels ) : void
Start ( ) : void
Update ( ) : void

Приватные методы

Метод Описание
GuiSendsMsg ( ) : void
PostHelpToCurrentChannel ( ) : void

Описание методов

Awake() публичный Метод

public Awake ( ) : void
Результат void

DebugReturn() публичный Метод

public DebugReturn ( DebugLevel, level, string message ) : void
level DebugLevel,
message string
Результат void

OnApplicationQuit() публичный Метод

To avoid the Editor becoming unresponsive, disconnect all Photon connections in OnApplicationQuit.
public OnApplicationQuit ( ) : void
Результат void

OnChatStateChange() публичный Метод

public OnChatStateChange ( ChatState state ) : void
state ChatState
Результат void

OnConnected() публичный Метод

public OnConnected ( ) : void
Результат void

OnDestroy() публичный Метод

To avoid the Editor becoming unresponsive, disconnect the Chat connection.
public OnDestroy ( ) : void
Результат void

OnDisconnected() публичный Метод

public OnDisconnected ( ) : void
Результат void

OnEnable() публичный Метод

public OnEnable ( ) : void
Результат void

OnGUI() публичный Метод

public OnGUI ( ) : void
Результат void

OnGetMessages() публичный Метод

public OnGetMessages ( string channelName, string senders, object messages ) : void
channelName string
senders string
messages object
Результат void

OnPrivateMessage() публичный Метод

public OnPrivateMessage ( string sender, object message, string channelName ) : void
sender string
message object
channelName string
Результат void

OnStatusUpdate() публичный Метод

public OnStatusUpdate ( string user, int status, bool gotMessage, object message ) : void
user string
status int
gotMessage bool
message object
Результат void

OnSubscribed() публичный Метод

public OnSubscribed ( string channels, bool results ) : void
channels string
results bool
Результат void

OnUnsubscribed() публичный Метод

public OnUnsubscribed ( string channels ) : void
channels string
Результат void

Start() публичный Метод

public Start ( ) : void
Результат void

Update() публичный Метод

public Update ( ) : void
Результат void

Описание свойств

AlignBottom публичное свойство

public bool AlignBottom
Результат bool

ChannelsToJoinOnConnect публичное свойство

public string[] ChannelsToJoinOnConnect
Результат string[]

ChatAppId публичное свойство

public string ChatAppId
Результат string

DemoPublishOnSubscribe публичное свойство

public bool DemoPublishOnSubscribe
Результат bool

FullScreen публичное свойство

public bool FullScreen
Результат bool

GuiRect публичное свойство

public Rect GuiRect
Результат Rect

HistoryLengthToFetch публичное свойство

public int HistoryLengthToFetch
Результат int

IsVisible публичное свойство

public bool IsVisible
Результат bool

chatClient публичное свойство

public ChatClient chatClient
Результат ChatClient