void OnClickBaby(GameObject sender) { Baby b = (Baby)UIEventListener.Get(sender).parameter; TurnOnbabyListCell lCell = sender.GetComponent <TurnOnbabyListCell>(); if (curCell != null) { curCell.backsp.spriteName = "ln_jinlan"; } SetBabyData(b); instId = b.InstId; curCell = lCell; lCell.backsp.spriteName = "jn_jinlanliang"; }
void addBabyList(List <Baby> bas) { for (int i = 0; i < bas.Count; i++) { GameObject bClone = GameObject.Instantiate(babyItemObj) as GameObject; bClone.SetActive(true); bClone.transform.parent = grid.transform; bClone.transform.localScale = Vector3.one; TurnOnbabyListCell tbcell = bClone.GetComponent <TurnOnbabyListCell>(); tbcell.babyData = bas[i]; babyListener = UIEventListener.Get(bClone); babyListener.onClick = OnClickBaby; babyListener.parameter = bas[i]; grid.repositionNow = true; } if (bas.Count > 0) { SetBabyData(bas[0]); } else { ClearBabytext(); } }