/// <summary> /// On success -- join a channel. /// </summary> void OnNetworkConnect(bool result, string message) { if (result) { TNManager.JoinChannel(channelID, firstLevel); } else if (!string.IsNullOrEmpty(failureFunctionName)) { UnityTools.Broadcast(failureFunctionName, message); } else { Debug.LogError(message); } }
/// <summary> /// Joined a channel (or failed to). /// </summary> void OnNetworkJoinChannel(bool result, string message) { if (result) { if (!string.IsNullOrEmpty(successFunctionName)) { UnityTools.Broadcast(successFunctionName); } } else { if (!string.IsNullOrEmpty(failureFunctionName)) { UnityTools.Broadcast(failureFunctionName, message); } else { Debug.LogError(message); } TNManager.Disconnect(); } }
/// <summary> /// Notification of another player leaving the channel. /// </summary> void OnPlayerLeft(Player p) { UnityTools.Broadcast("OnNetworkPlayerLeave", p); }
/// <summary> /// Notification of a new player joining the channel. /// </summary> void OnPlayerJoined(Player p) { UnityTools.Broadcast("OnNetworkPlayerJoin", p); }
/// <summary> /// Notification sent when leaving a channel. /// Also sent just before a disconnect (if inside a channel when it happens). /// </summary> void OnLeftChannel() { UnityTools.Broadcast("OnNetworkLeaveChannel"); }
/// <summary> /// Notification sent when attempting to join a channel, indicating a success or failure. /// </summary> void OnJoinChannel(bool success, string message) { UnityTools.Broadcast("OnNetworkJoinChannel", success, message); }
/// <summary> /// Notification that happens when the client gets disconnected from the server. /// </summary> void OnDisconnect() { UnityTools.Broadcast("OnNetworkDisconnect"); }
/// <summary> /// Connection result notification. /// </summary> void OnConnect(bool success, string message) { UnityTools.Broadcast("OnNetworkConnect", success, message); }
/// <summary> /// Error notification. /// </summary> void OnError(string err) { UnityTools.Broadcast("OnNetworkError", err); }
/// <summary> /// Notification of a player being renamed. /// </summary> void OnRenamePlayer(Player p, string previous) { mPlayer.name = p.name; UnityTools.Broadcast("OnNetworkPlayerRenamed", p, previous); }