Exemplo n.º 1
0
 public void Hide()
 {
     if (coroutine != null)
     {
         toaster.StopCoroutine(coroutine);
     }
     coroutine = toaster.StartCoroutine(Toaster.CoAnimateToast(toast, 0));
 }
Exemplo n.º 2
0
 public void Destroy(float time = 0)
 {
     if (coroutine != null)
     {
         toaster.StopCoroutine(coroutine);
     }
     toaster.StartCoroutine(Toaster.CoAnimateToast(toast, 0, GetDestroyCallback(toast)));
     coroutine = null;
     toast     = null;
 }
Exemplo n.º 3
0
        public void Show(string text = null)
        {
            if (text as object != null)
            {
                toast.GetComponentInChildren <Text>().text = text;
            }

            if (coroutine != null)
            {
                toaster.StopCoroutine(coroutine);
            }
            coroutine = toaster.StartCoroutine(Toaster.CoAnimateToast(toast, 1));
        }
Exemplo n.º 4
0
        void OnDestroy()
        {
            if (singleton == this)
            {
                singleton = null;

                for (int i = 0; i < (int)ToastGroup.Count; i++)
                {
                    if (toastRoots[i])
                    {
                        Destroy(toastRoots[i].gameObject);
                    }
                }

                //if (leftTransform) Destroy(leftTransform.gameObject);
                //if (rightTransform) Destroy(rightTransform.gameObject);
                //if (frontalTransform) Destroy(frontalTransform.gameObject);
            }
        }
Exemplo n.º 5
0
        void Awake()
        {
            if (singleton)
            {
                DestroyImmediate(this, false);
                return;
            }

            singleton = this;

            toastRoots[(int)ToastGroup.LeftHand]  = new GameObject("VRToaster_LeftText", WrapperComponentList).GetComponent <RectTransform>();
            toastRoots[(int)ToastGroup.RightHand] = new GameObject("VRToaster_RightText", WrapperComponentList).GetComponent <RectTransform>();
            toastRoots[(int)ToastGroup.Frontal]   = new GameObject("VRToaster_FrontText", WrapperComponentList).GetComponent <RectTransform>();

            InitWrapper(toastRoots[(int)ToastGroup.LeftHand], handToastWidth, handToastDensity);
            InitWrapper(toastRoots[(int)ToastGroup.RightHand], handToastWidth, handToastDensity);
            InitWrapper(toastRoots[(int)ToastGroup.Frontal], frontalToastWidth, frontalToastDensity);

            handTextPadding    = Mathf.RoundToInt(handToastWidth * handToastDensity * toastPadding);
            frontalTextPadding = Mathf.RoundToInt(frontalToastWidth * frontalToastDensity * toastPadding);
        }
Exemplo n.º 6
0
        public void Replace(string text)
        {
            if (coroutine != null)
            {
                toaster.StopCoroutine(coroutine);
            }
            coroutine = null;

            toaster.StartCoroutine(Toaster.CoAnimateToast(toast, 0, GetDestroyCallback(toast)));

            var clone = Object.Instantiate(toast, toast.parent, true);

            var rect = clone.GetComponent <RectTransform>();

            rect.SetSiblingIndex(toast.GetSiblingIndex() + 1);
            rect.localScale = new Vector3(1, 0, 1);

            clone.GetComponent <CanvasGroup>().alpha = 0;

            toast = clone;

            Show(text);
        }
Exemplo n.º 7
0
 public Toast(RectTransform w, Toaster t)
 {
     toast   = w;
     toaster = t;
 }