public override void Update() { fitScrollBox(); if (Messages == null) { Label.Caption = ""; return; } yoffset = Util.Clamp(yoffset - Time.deltaTime * 100, 0, 32); // Detect any added messages int newMessages = newMessageCount(); if (newMessages > 0) { // a new message has been added, so invalidate. Invalidate(); removeMessageTimer = AutoRemoveMessageTimeout; if (ScrollOn) { yoffset += 16 * newMessages; } if (AutoScrollToBottom) { ScrollToBottom(); } } // Auto delete if (AutoRemoveMessageTimeout != 0.0f) { if (Messages.Count > 0) { removeMessageTimer -= Time.deltaTime; if (removeMessageTimer <= 0) { for (int lp = 0; lp < Messages.Count; lp++) { if (!Messages[lp].FadeAndRemove) { Messages[lp].FadeAndRemove = true; break; } } removeMessageTimer = 0.33f; } } } // Retraction if (hideValue != goalHideValue) { if (hideValue < goalHideValue) { hideValue = (FadeOutTime == 0) ? goalHideValue : Util.Clamp(hideValue + Time.deltaTime / FadeOutTime, 0, goalHideValue); } if (hideValue > goalHideValue) { hideValue = (FadeInTime == 0) ? goalHideValue : Util.Clamp(hideValue - Time.deltaTime / FadeInTime, goalHideValue, 1); } } // Auto hide. if (AutoHideTimeout != 0.0f) { if (Time.time > mostRecentTimeStamp + AutoHideTimeout) { goalHideValue = 1.0f; } else { goalHideValue = 0.0f; } } // Fade out and remove messages. for (int lp = Messages.Count - 1; lp >= 0; lp--) { if (Messages[lp].FadeAndRemove) { Invalidate(); Messages[lp].Color.a -= Time.deltaTime; if (Messages[lp].Color.a <= 0) { Messages.RemoveAt(lp); } } } // Refresh text if needed. if (needsUpdate) { RefreshText(); } // Auto fading if (HideStyle == MessageBoxHideStyle.FadingMouse) { if (IsMouseOver) { goalHideValue = 0f; } } base.Update(); }