Beispiel #1
0
    public void Show(int star, int rate, System.Action onComplate)
    {
        starPool.resetAllTarget();
        RectTransform backStar = starPool.getIdleTarget <RectTransform>();

        backStar.transform.localScale = Vector3.zero;
        starRateText.gameObject.SetActive(false);
        starRateText.transform.localScale = new Vector3(2, 2, 2);
        starCount = 0;

        int             money = star * rate;
        GetStarPosEvent evt   = new GetStarPosEvent((pos) =>
        {
            Sequence sq = DOTween.Sequence();
            sq.Append(backStar.DOScale(new Vector3(3, 3, 3), 0.5f).SetEase(Ease.OutBack));
            for (int i = 0; i < 5; i++)
            {
                Image image = starPool.getIdleTarget <Image>();
                image.transform.position = pos;
                image.transform.DOMove(transform.position, 0.5f).SetEase(Ease.InCubic).SetDelay(i * 0.2f);
                image.DOFade(1, 0.3f).SetDelay(i * 0.2f + 0.2f).OnComplete(() => {
                    starCount = star;
                    image.gameObject.SetActive(false);
                });
            }
            sq.AppendInterval(5 * 0.2f);
            sq.AppendCallback(() => {
                starRateText.gameObject.SetActive(true);
                starRateText.text = "X" + rate.ToString();
            });
            sq.Append(starRateText.transform.DOScale(new Vector3(1, 1, 1), 0.7f).SetEase(Ease.InBack));
            sq.AppendCallback(() =>
            {
                if (onComplate != null)
                {
                    onComplate();
                }
            });
            sq.AppendInterval(1);
            sq.OnComplete(() =>
            {
                gameObject.SetActive(false);
            });
        });

        EventDispatcher.instance.DispatchEvent(evt);
    }
Beispiel #2
0
    private void OnGetStar(BaseEvent e)
    {
        GetStarPosEvent evt = e as GetStarPosEvent;

        evt.starPos(starLabel.transform.position);
    }