public Alert(ALERT_TYPE type, string description, DateTime timestamp, Event e = null) { this.type = type; this.description = description; this.timestamp = timestamp; this.e = e; this.read = false; }
public TCAlertViewController (UIViewController parentController, string title, string message, UIView customView, string cancelButtonTitle, string okButtonTitle) { this.parentController = parentController; this.alertType = ALERT_TYPE.DEFAULT; this.title = title; this.message = message == null ? "" : message; this.cancelButtonTitle = cancelButtonTitle; this.okButtonTitle = okButtonTitle; this.customView = customView; createUI (); }
public void showAlert(ALERT_TYPE type, string info, ALERT_FUN fun1 = null, ALERT_FUN fun2 = null, int count = 0) { _info.text = info; GameObject obj = null; switch ((int)type) { case 1: _type1.SetActive(true); obj = _type1; _type2.SetActive(false); _type3.SetActive(false); break; case 2: _type1.SetActive(false); _type2.SetActive(true); obj = _type2; _type3.SetActive(false); break; case 3: _type1.SetActive(false); _type2.SetActive(false); _type3.SetActive(true); obj = _type3; break; } _alert.SetActive(true); if (obj != null) { if (obj.transform.GetChild(0).GetComponent <Button>() != null) { obj.transform.GetChild(0).GetComponent <Button>().onClick.RemoveAllListeners(); obj.transform.GetChild(0).GetComponent <Button>().onClick.AddListener(delegate { if (fun1 != null) { fun1.Invoke(); } close(); }); } if (obj.transform.GetChild(1).GetComponent <Button>() != null) { obj.transform.GetChild(1).GetComponent <Button>().onClick.RemoveAllListeners(); obj.transform.GetChild(1).GetComponent <Button>().onClick.AddListener(delegate { if (fun2 != null) { fun2.Invoke(); } close(); }); } } if (count != 0) { Text countText = obj.transform.GetChild(0).transform.FindChild("count").GetComponent <Text>(); countText.text = count + "s"; Timer timerCount = null; timerCount = new Timer(delegate { Loom.QueueOnMainThread(() => { count -= 1; countText.text = count + "s"; if (count == 0) { close(); timerCount.Dispose(); } }); }, this, 1000, 1000); } else { Text countText = obj.transform.GetChild(0).transform.FindChild("count").GetComponent <Text>(); countText.text = ""; } }