void OnActionCardOpen(CardView openCard) { ActionCardView actionCard = openCard as ActionCardView; foreach (ActionCardView card in actionCards) { card.clickable = false; card.actionCard.owner.PullActionCard(actionCard.actionCard); } actionCard.MoveToTheCenter(); }
void OnActionCardCentered(CardView centeredCard) { chosenActionCard = centeredCard as ActionCardView; while (actionCards.Count > 0) { ActionCardView card = actionCards[actionCards.Count - 1]; if (card != chosenActionCard) { card.openEvent -= OnActionCardOpen; card.centeredEvent -= OnActionCardCentered; card.gameObject.SetActive(false); } actionCards.RemoveAt(actionCards.Count - 1); } Character character = chosenActionCard.actionCard.owner; // float cardWidth = 250.0f; // float x = (float)(Screen.width / 2) - (cardWidth * (float)character.resultDeck.Count) * 0.5f; float cardWidth = 56f / (float)(character.resultDeck.Count - 1); float x = 28f; foreach (ResultCard resultCard in character.resultDeck) { var pivot = new GameObject("Pivot"); pivot.transform.parent = cardsContainer; pivot.transform.localPosition = new Vector3(0, -360f, 0); pivot.transform.localScale = Vector3.one; pivot.transform.localEulerAngles = new Vector3(0, 0, x); ResultCardView resultCardView = resultCardsPool.Get(); resultCardView.Init(resultCard); resultCardView.transform.parent = pivot.transform; resultCardView.transform.localPosition = new Vector3(0, 500.0f, 0.0f); resultCardView.transform.localRotation = Quaternion.identity; resultCardView.transform.localScale = Vector3.one * 300f; resultCardView.Reset(); resultCardView.openEvent += OnResultCardOpen; resultCardView.centeredEvent += OnResultCardCentered; resultCards.Add(resultCardView); x -= cardWidth; } }
void ATBGaugeFull(Character character) { if (character.side == BattleSide.Left) { // float cardWidth = 10.0f; float cardWidth = 56f / (float)(character.actionDeck.Count - 1); // float x = (float)(Screen.width / 2) - (cardWidth * (float)character.actionDeck.Count) * 0.5f; // float x = -(cardWidth * (float)(character.actionDeck.Count - 1)) * 0.5f; float x = 28f; foreach (ActionCard actionCard in character.actionDeck) { ActionCardView actionCardView = actionCardsPool.Get(); var pivot = new GameObject("Pivot"); pivot.transform.parent = cardsContainer; pivot.transform.localPosition = new Vector3(0, -360f, 0); pivot.transform.localScale = Vector3.one; pivot.transform.localEulerAngles = new Vector3(0, 0, x); actionCardView.Init(actionCard); actionCardView.transform.parent = pivot.transform; actionCardView.transform.localPosition = new Vector3(0, 500.0f, 0.0f); actionCardView.transform.localRotation = Quaternion.identity; actionCardView.transform.localScale = Vector3.one * 300f; actionCardView.Reset(); actionCardView.openEvent += OnActionCardOpen; actionCardView.centeredEvent += OnActionCardCentered; actionCards.Add(actionCardView); x -= cardWidth; } } }