Пример #1
0
    public void Alert(string content, string title = "系统消息")
    {
        AlertUI       alert = GetNewUI <AlertUI>();
        RectTransform rtf   = alert.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);
        alert.SetData(content, title);
    }
Пример #2
0
    public AlertUI Alert(string content = "", string title = "消息")
    {
        AlertUI       malert = GetNewUI <AlertUI>();
        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);
        malert.SetData(content, title);
        pref.localScale = Vector3.one;

        return(malert);
    }