/// <summary> /// Listener to react when a "WebSocket error" event occurs. /// </summary> /// <param name="error">The error's message.</param> private void OnWebSocketError(string error) { DebugLogs.LogError("[GeeoWS:OnWebSocketError] WebSocket error ›› " + error); // Trigger the OnError event if any callback registered to it if (OnError != null) { OnError(error); } }
/// <summary> /// Register the singleton instance at Awake. /// </summary> protected virtual void Awake() { if (instance == null) { instance = this; } else { DebugLogs.LogError("[MonoSingleton:Awake] Found more than one instance of " + this.GetType().Name + " ›› Destroying the last one"); Destroy(this); } }
/// <summary> /// Handle an "error report" type received WebSocket message from the Geeo server to report an error. /// </summary> /// <param name="errorData">Received message data about an error.</param> private void WebSocketMessage_ErrorReport(ErrorJson errorData) { DebugLogs.LogError("[GeeoWS:WebSocketMessage_ErrorReport] Server error: " + errorData); // Trigger the OnError event if any callback registered to it if (OnError != null) { if (errorData.message != null) { OnError(errorData.error + " ›› " + errorData.message); } else { OnError(errorData.error); } } }
/// <summary> /// Error callback for the GetGuestToken request. /// </summary> /// <param name="error">Error description.</param> /// <param name="OnError">The callback in case of request error.</param> private void GetGuestToken_OnError(string error, Action <string> OnError) { DebugLogs.LogError("[GeeoHTTP:GetGuestToken] Request Error: " + error); OnError(error); }