private CharacterCard RemvoeActiveCard() { CharactersUiController.Instance().CharacterChanged(); ActiveCard.transform.parent = transform; ActiveCard.transform.localPosition = new Vector3(_activeCardX, ActiveCard.transform.position.y); var tempCard = ActiveCard; ActiveCard.MakeNormal(); ActiveCard = null; return(tempCard); }
private void SetActiveCard(CharacterCard card) { ActiveCard = card; _activeCardX = card.transform.localPosition.x; card.MakeBig(); CharactersUiController.Instance().InfoToCard(card); if (BuyingContainer == null) { return; } if (!card.IsOpen) { BuyingContainer.SetPriceToCard(card); BuyingContainer.SetAsBuy(); } else { BuyingContainer.SetAsPlay(); } }
public void Setter(RectTransform scrollerUi, float proportion, float distanceX, float startOffSet) { _instance = this; BuyingContainer = CharactersUiController.Instance().BuyingContainer; ScrollerUi = scrollerUi; Proportion = proportion; RangeX = distanceX / 2; _leftCards = new Stack <CharacterCard>(); _rightCards = new Stack <CharacterCard>(); var temp = (from t in transform.Cast <Transform>() where t.gameObject.GetComponent <CharacterCard>() != null select t).ToArray(); if (temp.Length < 1) { throw new InvalidOperationException("We got no elements in for moving"); } foreach (var t in temp) { var card = t.gameObject.GetComponent <CharacterCard>(); if (t.position.x < -RangeX) { _leftCards.Push(card); } else if (t.position.x > RangeX) { _rightCards.Push(card); } else { SetActiveCard(card); } } _rightCards = new Stack <CharacterCard>(_rightCards.ToArray()); //Making position just prefect on the First item scrollerUi.localPosition = new Vector3((scrollerUi.sizeDelta.x / 2), 0, 0); }
public void MakeNormal() { ITween.ScaleTo(gameObject, ITween.Hash("x", _normalSize.x, "y", _normalSize.y, "time", CharactersUiController.Instance().CharacterAnimationTime, "onComplete", "FreeMemory")); ITween.MoveTo(_animationSprite.gameObject, ITween.Hash("y", _normalPositionY, "islocal", true, "time", CharactersUiController.Instance().CharacterAnimationTime)); _animationSprite.ResetAnimation(); _animationSprite.StopAnimation(); _animationSprite.GetComponent <SpriteRenderer>().sortingOrder = 0; _startingAnimation = false; }
public void MakeBig() { ITween.EaseType easeType = ITween.EaseType.easeInQuad; ITween.ScaleTo(gameObject, ITween.Hash("x", _normalSize.x * BigSizeScale, "y", _normalSize.y * BigSizeScale, "easeType", easeType, "time", CharactersUiController.Instance().CharacterAnimationTime, "onComplete", "StartAnimation")); ITween.MoveTo(_animationSprite.gameObject, ITween.Hash("y", _normalPositionY + DistanceUp, "easeType", easeType, "islocal", true, "time", CharactersUiController.Instance().CharacterAnimationTime)); transform.SetSiblingIndex(20); _animationSprite.GetComponent <SpriteRenderer>().sortingOrder = 100; if (IsOpen) { StartAnimationAndShowCard(); } }