public Notification_IGDC SetupNotification(Message_IGDC message, UnityAction call) { originalHeight = _image.rectTransform.rect.height; this.message = message; _text.text = message.condition; _button.onClick.AddListener(call); switch (message.logType) { case LogType.Assert: case LogType.Log: _image.color = log_color; break; case LogType.Warning: _image.color = warning_color; break; case LogType.Error: case LogType.Exception: _image.color = error_color; break; } inStack++; return(this); }
private Notification_IGDC CreateNotification(Message_IGDC message) { Notification_IGDC not = Instantiate(not_prefab, nots_parent); not.SetupNotification(message, delegate { ShowNotificationsStackTrace(not); }); nots_alive.Add(not); return(not); }
private void Application_logMessageReceived(string condition, string stackTrace, LogType type) { if (showOnError && !stuffContainer.gameObject.activeInHierarchy && (type == LogType.Error || type == LogType.Exception)) { OpenWindow(true); } Message_IGDC message = new Message_IGDC(condition, stackTrace, type); messages.Add(message); if (keep_number > -1) { float difference_msg = messages.Count - keep_number; if (messages.Count > keep_number) { for (int i = 0; i < difference_msg; i++) { messages.RemoveAt(i); } } float difference_nots = nots_parent.childCount - messages.Count; if (nots_parent.childCount > messages.Count - 1) { for (int i = 0; i < difference_nots; i++) { Destroy(nots_alive[i].gameObject); nots_alive.RemoveAt(i); } } } switch (stackingMode) { case STACKING_MODE.CONSECUTIVE_MESSAGES: if (nots_alive.Count > 0 && nots_alive[nots_alive.Count - 1].message.condition == condition && nots_alive[nots_alive.Count - 1].message.stackTrace == stackTrace) { nots_alive[nots_alive.Count - 1].InStack++; return; } break; case STACKING_MODE.EVERY_MESSAGE: foreach (Notification_IGDC _not in nots_alive) { if (_not.message.condition == condition && _not.message.stackTrace == stackTrace) { _not.InStack++; return; } } break; case STACKING_MODE.NONE: break; } CreateNotification(message); MoveNotifications(); if (!stuffContainer.gameObject.activeInHierarchy) { tray_ctrl.NewUnreadMessage(); } Resize(true); //TODO start coroutine showing the notification and then hiding it }