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; }