Ejemplo n.º 1
0
        public void UpdateBackground(KeyValuePair <int, PTFlatGroupCollection> collection)
        {
            Collection = collection;
            int size = Collection.Value == null ? 0 : Collection.Value.Count;

            if (size > 0)
            {
                List <PTTouch> touchesDraggingThis = PTGlobalInput.FindTouchesDragging(GetComponent <Collider>());
                if (touchesDraggingThis == null || touchesDraggingThis.Count == 0)
                {
                    transform.SetLocalPosition(groups.GetComponent <PTZone>().TargetLocalPositionOf(groups.GetSiblingIndex(Collection.Value.content[0])), groups.timerAnimation);
                }
            }
            switch (size)
            {
            case 0:
                StartCoroutine(SetAppearance(false));
                break;

            case 1:
                if (backgroundSize == 0 || backgroundSize == 1)
                {
                    StartCoroutine(SetAppearance(true));
                }
                else
                {
                    StartCoroutine(SpriteSwap(false));
                }
                break;

            case 2:
                if (backgroundSize == 1)
                {
                    StartCoroutine(SpriteSwap(true));
                }
                else
                {
                    StartCoroutine(Stretch(size));
                }
                break;

            default:
                StartCoroutine(Stretch(size));
                break;
            }
            backgroundSize = size;
        }