public void init(HallWindow hallWindow) { rectTrans = GetComponent <RectTransform>(); _hallWindow = hallWindow; int i; for (i = 0; i < transform.childCount; i++) { Table table = transform.GetChild(i).gameObject.AddComponent <Table>(); table.Init(hallWindow); _tableList.Add(table); } }
public void Init(HallWindow hallWindow) { _hallWindow = hallWindow; var btnSeat1 = transform.FindChild("BtnSeat1").GetComponent <Button>(); btnSeat1.onClick.AddListener(this.OnSeat1); var btnSeat2 = transform.FindChild("BtnSeat2").GetComponent <Button>(); btnSeat2.onClick.AddListener(this.OnSeat2); Transform transHeadIconFrame1 = transform.FindChild("ImgHeadIconFrame1"); _btnHead1 = transHeadIconFrame1.FindChild("BtnHeadIcon").GetComponent <Button>(); _btnHead1.onClick.AddListener(this.OnHead1); _imgHeadIcon1 = _btnHead1.GetComponent <Image>(); Transform transHeadIconFrame2 = transform.FindChild("ImgHeadIconFrame2"); _btnHead2 = transHeadIconFrame2.FindChild("BtnHeadIcon").GetComponent <Button>(); _btnHead2.onClick.AddListener(this.OnHead2); _imgHeadIcon2 = _btnHead2.GetComponent <Image>(); _txtTableName = transform.FindChild("TxtTableName").GetComponent <Text>(); _txtRateValue = transform.FindChild("TxtRateLabel").FindChild("TxtRateValue").GetComponent <Text>(); _txtLeastGold = transform.FindChild("TxtLeastGoldLabel").FindChild("TxtLeastGoldValue").GetComponent <Text>(); gameObject.SetActive(false); }