Ejemplo n.º 1
0
        public void DoPopup(PopupEventData data, PopupTweenData tweenData)
        {
            var   popup = _popupPool.Get();
            var   rect  = popup.rectTransform;
            float dur   = tweenData.duration;

            popup.text.color        = data.color;
            popup.text.text         = data.useRandomText ? data.randomText : data.text;
            popup.image.sprite      = data.sprite != null ? data.sprite : GraphicExt.TransparentTexture;
            popup.canvasGroup.alpha = 0;
            rect.sizeDelta          = new Vector2(data.width, rect.sizeDelta.y);

            //TODO: replace with some kind of scr.obj. refrence for camera

            rect.anchoredPosition = data.usesWorldPos
                ? data.worldPos.FromWorldToCanvasPosition(Camera.main, _popupsCanvas)
                : Vector2.zero;

            LeanTween.move(rect, rect.anchoredPosition + tweenData.offset, dur).setEase(tweenData.positionCurve)
            .setOnComplete(popup.ReturnToPool);

            LeanTween.alphaCanvas(popup.canvasGroup, 1, dur).setEase(tweenData.alphaCurve);
        }
Ejemplo n.º 2
0
 public void DoPopup(PopupEventData data)
 {
     DoPopup(data, data.overrideTweeningSettings ? data.tweenSettings : _defaultTweening);
 }