Пример #1
0
        /// <summary>
        /// 普通提示弹窗,弹出提示后消失
        /// </summary>
        /// <param name="message"></param>
        /// <param name="position"></param>
        /// <param name="WaitDestoryTime"></param>
        public static void StandardShow(string message = null, Vector3?position = null, int WaitDestoryTime = 1)
        {
            if (GameObject.Find("StandarShow") != null)
            {
                return;
            }
            var parent = GameObject.Find("Canvas").transform;

            obj = Instantiate(Resources.Load("StandarShow") as GameObject);
            if (message != null)
            {
                obj.transform.FindChild("Text").GetComponent <Text>().text = message;
            }
            else
            {
                obj.transform.FindChild("Text").GetComponent <Text>().text = "当前字符串为:null";
            }

            if (parent != null)
            {
                obj.transform.SetParent(parent, false);
            }
            if (position == null)
            {
                position = Vector3.zero;
            }
            DestoryObj ds = obj.AddComponent <DestoryObj>();

            ds.SetDestoryInfo(obj, WaitDestoryTime, obj);
            obj.transform.SetAsLastSibling();
            obj.transform.localPosition = (Vector3)position;
            obj.name = "StandarShow";
            obj.SetActive(true);
        }
Пример #2
0
        public static void SelectDestory()
        {
            DestoryObj ds = obj.AddComponent <DestoryObj>();

            ds.SetDestoryInfo(obj, 0, obj);
            SelectPopShowErrorEvent -= SelectDestory;
            SelectPopShowTrueEvent  -= SelectDestory;
        }