Ejemplo n.º 1
0
    private void OnTrophyCompleted(EventData e)
    {
        ETrophyType tType  = (ETrophyType)e.Data["type"];
        TrophyPopup tPopup = GetFreePopup();
        int         i      = _popups.Count;

        _popups.Add(tPopup);
        tPopup.transform.localPosition = GetPositionByNumber(i);
        tPopup.InitPopup(tType);
    }
Ejemplo n.º 2
0
    private void OnPopupHided(Object popup)
    {
        TrophyPopup tPopup = (TrophyPopup)popup;

        _popups.Remove(tPopup);

        for (int i = 0; i < _popups.Count; ++i)
        {
            GameObject obj       = _popups[i].gameObject;
            float      currentY  = obj.transform.localPosition.y;
            Vector3    neededPos = GetPositionByNumber(i);
            if (currentY != neededPos.y)
            {
                LeanTween.cancel(obj);
                float atime = Mathf.Abs(currentY - neededPos.y) / MOVE_SPEED;
                LeanTween.moveLocalY(obj, neededPos.y, atime);
            }
        }
    }
Ejemplo n.º 3
0
    TrophyPopup GetFreePopup()
    {
        for (int i = 0; i < _pool.Count; ++i)
        {
            if (!_pool[i].gameObject.activeSelf)
            {
                LeanTween.cancel(_pool[i].gameObject);
                return(_pool[i]);
            }
        }
        GameObject obj = Instantiate(TrophyPopupPrefab, Vector3.zero, Quaternion.identity) as GameObject;

        obj.transform.SetParent(transform, false);
        //obj.name = "slot";
        TrophyPopup tPopup = obj.GetComponent <TrophyPopup>();

        _pool.Add(tPopup);
        return(tPopup);
    }