public void AddIncomingNotification(UIAlertType type, string title, string text, int duration = 0) { // If there is already an incoming notification, we need to click it into place. this.SendIncomingNotificationToList(); // Begin Incoming Notification this.incomingNotif = new UIGroupNotify(this, type, title, text, (duration > 0 ? Systems.timer.UniFrame + duration : 0)); this.incomingMoved = 0; // Reset the Y notification movement. }
private void DirectPlayerAttention(Vector2 worldPos, UIAlertType alertType) { alertObject = Instantiate(leftClickAlert, worldPos, Quaternion.identity); if (alertType == UIAlertType.Hover) { alertObject.transform.GetChild(1).gameObject.SetActive(false); } if (alertType == UIAlertType.FlippedX) { alertObject.transform.localScale = new Vector3(-alertObject.transform.localScale.x, alertObject.transform.localScale.y, alertObject.transform.localScale.z); } }
private void DirectPlayerAttention(HexEntry hex, UIAlertType alertType) { Vector2 targetPos = HexVectorUtil.worldPositionOfHexCoord(hex.BoardPos); alertObject = Instantiate(leftClickAlert, new Vector2(targetPos.x + (alertType == UIAlertType.FlippedX ? -0.14f : 0.14f), targetPos.y - 0.14f), Quaternion.identity); if (alertType == UIAlertType.Hover) { alertObject.transform.GetChild(1).gameObject.SetActive(false); } if (alertType == UIAlertType.FlippedX) { alertObject.transform.localScale = new Vector3(-alertObject.transform.localScale.x, alertObject.transform.localScale.y, alertObject.transform.localScale.z); } }
public UINotification(UIComponent parent, UIAlertType type, string title, string text, int exitFrame, short width) : base(parent) { // Type Theme var theme = UIHandler.theme; if (type == UIAlertType.Error) { this.bg = theme.ErrorBG; this.outline = theme.ErrorOutline; } else if (type == UIAlertType.Success) { this.bg = theme.SuccessBG; this.outline = theme.SuccessOutline; } else if (type == UIAlertType.Warning) { this.bg = theme.WarningBG; this.outline = theme.WarningOutline; } else if (type == UIAlertType.Normal) { this.bg = theme.NormBG; this.outline = theme.NormOutline; } // Measure Strings Vector2 measureTitle = UIHandler.theme.smallHeaderFont.font.MeasureString(title); Vector2 measureText = UIHandler.theme.normalFont.font.MeasureString(text); // Text + Multi-Line Handler this.title = title; this.text = TextHelper.WrapTextSplit(UIHandler.theme.normalFont.font, text, width - 16 - 16); // Behaviors this.alpha = 1; this.exitFrame = exitFrame; // Size Setup this.SetHeight((short)(measureTitle.Y + measureText.Y * this.text.Length + 10 + 10 + 6)); this.SetWidth(width); }
public UIGroupNotify(UIComponent parent, UIAlertType type, string title, string text, int exitFrame) : base(parent, type, title, text, exitFrame, parent.width) { }
// Notifications public static void AddNotification(UIAlertType type, string title, string text, int duration) { UIHandler.globalUI.notifyBox.AddIncomingNotification(type, title, text, duration); }