C# Class 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.
Inheritance: MonoBehaviour, IChatClientListener
Afficher le fichier Open project: hydrater/TLH Class Usage Examples

Méthodes publiques

Свойство Type Description
AlignBottom bool
ChannelsToJoinOnConnect string[]
ChatAppId string
DemoPublishOnSubscribe bool
FullScreen bool
GuiRect Rect
HistoryLengthToFetch int
IsVisible bool
chatClient ChatClient

Méthodes publiques

Méthode Description
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

Private Methods

Méthode Description
GuiSendsMsg ( ) : void
PostHelpToCurrentChannel ( ) : void

Method Details

Awake() public méthode

public Awake ( ) : void
Résultat void

DebugReturn() public méthode

public DebugReturn ( DebugLevel, level, string message ) : void
level DebugLevel,
message string
Résultat void

OnApplicationQuit() public méthode

To avoid the Editor becoming unresponsive, disconnect all Photon connections in OnApplicationQuit.
public OnApplicationQuit ( ) : void
Résultat void

OnChatStateChange() public méthode

public OnChatStateChange ( ChatState state ) : void
state ChatState
Résultat void

OnConnected() public méthode

public OnConnected ( ) : void
Résultat void

OnDestroy() public méthode

To avoid the Editor becoming unresponsive, disconnect the Chat connection.
public OnDestroy ( ) : void
Résultat void

OnDisconnected() public méthode

public OnDisconnected ( ) : void
Résultat void

OnEnable() public méthode

public OnEnable ( ) : void
Résultat void

OnGUI() public méthode

public OnGUI ( ) : void
Résultat void

OnGetMessages() public méthode

public OnGetMessages ( string channelName, string senders, object messages ) : void
channelName string
senders string
messages object
Résultat void

OnPrivateMessage() public méthode

public OnPrivateMessage ( string sender, object message, string channelName ) : void
sender string
message object
channelName string
Résultat void

OnStatusUpdate() public méthode

public OnStatusUpdate ( string user, int status, bool gotMessage, object message ) : void
user string
status int
gotMessage bool
message object
Résultat void

OnSubscribed() public méthode

public OnSubscribed ( string channels, bool results ) : void
channels string
results bool
Résultat void

OnUnsubscribed() public méthode

public OnUnsubscribed ( string channels ) : void
channels string
Résultat void

Start() public méthode

public Start ( ) : void
Résultat void

Update() public méthode

public Update ( ) : void
Résultat void

Property Details

AlignBottom public_oe property

public bool AlignBottom
Résultat bool

ChannelsToJoinOnConnect public_oe property

public string[] ChannelsToJoinOnConnect
Résultat string[]

ChatAppId public_oe property

public string ChatAppId
Résultat string

DemoPublishOnSubscribe public_oe property

public bool DemoPublishOnSubscribe
Résultat bool

FullScreen public_oe property

public bool FullScreen
Résultat bool

GuiRect public_oe property

public Rect GuiRect
Résultat Rect

HistoryLengthToFetch public_oe property

public int HistoryLengthToFetch
Résultat int

IsVisible public_oe property

public bool IsVisible
Résultat bool

chatClient public_oe property

public ChatClient chatClient
Résultat ChatClient