protected void UseCard(APFCardUI cardUI, APFCharacter target_clickedChar) { base.UseCard(cardUI.GetTable(), target_clickedChar); DeselectDeckCard(SelectedCard_OnDeck); RemoveCard_InDeckUI(cardUI); int findIdx_DeckCardPool = CardPool[PFCardPool.DeckCard].FindIndex(comp => { if (cardUI != null) { return(comp == cardUI.CardTableId); } return(false); }); if (findIdx_DeckCardPool >= 0) { CardPool[PFCardPool.DeckCard].RemoveAt(findIdx_DeckCardPool); if (cardUI.GetTable().cardPoolType == PFTable.ECardPoolType.ToUsedPool_AfterAction) { AddComponent_ToCardPool(PFCardPool.UsedCard, cardUI.CardTableId); } else if (cardUI.GetTable().cardPoolType == PFTable.ECardPoolType.ToDestroyedPool_AfterAction) { AddComponent_ToCardPool(PFCardPool.DestroyedCard, cardUI.CardTableId); } } }
private void RemoveCard_InDeckUI(APFCardUI cardUI) { int findIdx_DeckUI = DeckCardList.FindIndex(comp => { return(comp == cardUI); }); if (findIdx_DeckUI >= 0) { GameObject.Destroy(DeckCardList[findIdx_DeckUI].gameObject); DeckCardList.RemoveAt(findIdx_DeckUI); } }
private void DeselectDeckCard(APFCardUI deselectCard) { List <APFCharacter> aliveCharList = APFGameMode.GetInstance().GetAliveCharList(); PFCharacterStuff.Active_CharSelectIconUI(aliveCharList, false); if (deselectCard != null) { float fDefaultScale = 1.0f; deselectCard.gameObject.transform.localScale = new Vector3(fDefaultScale, fDefaultScale, fDefaultScale); } SelectedCard_OnDeck = null; }
public static List <APFCardUI> Create_DeckCards(GameObject cardParent, List <int> deckCardIdList, int bgFrameWidth) { APFCardUI card_original = Resources.Load <APFCardUI>(PFPrefabPath.Card); if (card_original == null) { StringBuilder sbLog = new StringBuilder(""); sbLog.AppendFormat("{0} 경로에 카드프리팹이 없습니다.", PFPrefabPath.Card); Debug.LogError(sbLog.ToString()); return(null); } int cardWidth = card_original.GetCardWidth(); int cardCount = deckCardIdList.Count; int cardTotalWidth = cardWidth * cardCount; float createPosX = (bgFrameWidth - cardTotalWidth) / 2; createPosX += cardWidth / 2; List <APFCardUI> newInstanceList = new List <APFCardUI>(cardCount); for (int i = 0; i < cardCount; ++i) { int cardId = deckCardIdList[i]; PFTable.Card cardTable = PFTable.GetCard(cardId); if (cardTable != null) { Vector3 createPos = new Vector3(createPosX, 0.0f, 0.0f); APFCardUI newCardInstance = PFUtil.Instantiate(card_original, cardParent, createPos); newCardInstance.Init(cardTable); newInstanceList.Add(newCardInstance); createPosX += cardWidth; } else { StringBuilder sbLog = new StringBuilder(""); sbLog.AppendFormat("카드테이블 id: {0} 카드정보가 없습니다", cardId); Debug.LogError(sbLog.ToString()); return(null); } } return(newInstanceList); }
public void UpdateUI_CardList(List <int> cardList) { PFUtil.DestroyChild(CardListGrid.gameObject, false); if (cardList == null) { return; } for (int i = 0; i < cardList.Count; ++i) { APFCardUI pfCard = PFUtil.Instantiate <APFCardUI>(PFPrefabPath.Card, CardListGrid.gameObject, Vector3.zero); pfCard.Init(PFTable.GetCard(cardList[i])); } CardListGrid.repositionNow = true; }
private void SelectDeckCard(APFCardUI selectCard) { DeselectDeckCard(SelectedCard_OnDeck); if (selectCard != null) { SelectedCard_OnDeck = selectCard; SelectedCard_OnDeck.gameObject.transform.localScale = new Vector3(PFConst.Scale_ClickedCardOnDeck, PFConst.Scale_ClickedCardOnDeck, 1.0f); PFTable.ECardApplyTarget applyTarget = PFCardTable.GetApplyTarget(SelectedCard_OnDeck.CardTableId); if (applyTarget == PFTable.ECardApplyTarget.EnemyAll) { List <APFCharacter> aliveMonsterList = APFGameMode.GetInstance().GetAliveCharList(PFTable.CharacterType.Monster); PFCharacterStuff.Active_CharSelectIconUI(aliveMonsterList, true); } } }
private void OnClick_DeckCard(APFCardUI clickedCard) { bool isClicked_SameCard = (SelectedCard_OnDeck == clickedCard); if (clickedCard != null) { if (isClicked_SameCard) { DeselectDeckCard(clickedCard); } else { int remainCost = GetCost(); int cardCost = clickedCard.GetCost(); if (cardCost <= remainCost) { SelectDeckCard(clickedCard); } } } }