예제 #1
0
파일: Toast.cs 프로젝트: m4ff/VRToaster
 public void Hide()
 {
     if (coroutine != null)
     {
         toaster.StopCoroutine(coroutine);
     }
     coroutine = toaster.StartCoroutine(Toaster.CoAnimateToast(toast, 0));
 }
예제 #2
0
파일: Toast.cs 프로젝트: m4ff/VRToaster
 public void Destroy(float time = 0)
 {
     if (coroutine != null)
     {
         toaster.StopCoroutine(coroutine);
     }
     toaster.StartCoroutine(Toaster.CoAnimateToast(toast, 0, GetDestroyCallback(toast)));
     coroutine = null;
     toast     = null;
 }
예제 #3
0
파일: Toast.cs 프로젝트: m4ff/VRToaster
        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));
        }
예제 #4
0
파일: Toaster.cs 프로젝트: m4ff/VRToaster
        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);
            }
        }
예제 #5
0
파일: Toaster.cs 프로젝트: m4ff/VRToaster
        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);
        }
예제 #6
0
파일: Toast.cs 프로젝트: m4ff/VRToaster
        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);
        }
예제 #7
0
파일: Toast.cs 프로젝트: m4ff/VRToaster
 public Toast(RectTransform w, Toaster t)
 {
     toast   = w;
     toaster = t;
 }