public UIHeroSlotContainer GetHeroContainerFromPool(HeroData heroData) { UIHeroSlotContainer heroSlot = null; for (int i = 0; i < heroContainerPool.Count; i++) { if (heroContainerPool[i].transform.parent == slotStackArea.transform) { heroSlot = heroContainerPool[i]; break; } } if (!heroSlot) { heroSlot = InitSameHeroSlot(heroData); GameObject go = Instantiate(heroSlotPrefab) as GameObject; UIHeroSlot slot = go.GetComponent <UIHeroSlot>(); heroSlot.SetHeroSlot(slot); heroContainerPool.Add(heroSlot); } else { heroSlot.heroInvenID = heroData.id; heroSlot.ResetSlotData(); string heroID = heroData.heroID; if (heroID.EndsWith("_Hero")) { heroSlot.transform.SetParent(battleScrollViewContent.transform, false); } else { heroSlot.transform.SetParent(territoryScrollViewContent.transform, false); } } return(heroSlot); }