Beispiel #1
0
    public void Confirm(string content, string title = "系统消息确认", ConfirmUI.Complete handler = null)
    {
        ConfirmUI     confirm = GetNewUI <ConfirmUI>();
        RectTransform rtf     = confirm.transform as RectTransform;

        //设置UI容器大小
        rtf.sizeDelta = new Vector2(Screen.width, Screen.height);
        rtf.anchorMin = Vector2.zero;
        rtf.anchorMax = Vector2.one;
        rtf.offsetMin = new Vector2(0, 0);
        rtf.offsetMax = new Vector2(0, 0);
        confirm.SetData(content, title);
        confirm.onClosedHandler += handler;
    }
Beispiel #2
0
    public ConfirmUI Confirm(string content = "", string title = "消息", ConfirmUI.ConfirmHandler handler = null)
    {
        ConfirmUI     malert = GetNewUI <ConfirmUI>();
        RectTransform pref   = malert.GetComponent <RectTransform>();

        pref.SetParent(root);
        pref.localPosition = Vector3.zero;
        pref.sizeDelta     = new Vector2(Screen.width, Screen.height);
        pref.offsetMin     = new Vector2(0, 0);
        pref.offsetMax     = new Vector2(0, 0);
        pref.sizeDelta     = new Vector2(Screen.width, Screen.height);
        pref.localScale    = Vector3.one;
        malert.SetData(content, title);

        malert.OnConfirmHandler += handler;
        return(malert);
    }