public void initList() { lArea.Clear(); for (int i = 0; i < transCon.childCount; i++) { GameObject.Destroy(transCon.GetChild(i).gameObject); } int len = 1; List <ServerData> l = Globle.lServer; if (l.Count % 10 == 0) { len = l.Count / 10; } else { len = l.Count / 10 + 1; } for (int i = 0; i < len; i++) { GameObject go = GameObject.Instantiate(goTemp) as GameObject; go.transform.SetParent(transCon, false); go.SetActive(true); AreaItem item = new AreaItem(go.transform, onAreaClick, i); lArea.Add(item); } RectTransform rect = transCon.GetComponent <RectTransform>(); rect.sizeDelta = new Vector2(rect.sizeDelta.x, len * h); }
public void initList() { this.lArea.Clear(); for (int i = 0; i < this.transCon.childCount; i++) { UnityEngine.Object.Destroy(this.transCon.GetChild(i).gameObject); } List <ServerData> lServer = Globle.lServer; bool flag = lServer.Count % 10 == 0; int num; if (flag) { num = lServer.Count / 10; } else { num = lServer.Count / 10 + 1; } for (int j = 0; j < num; j++) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.goTemp); gameObject.transform.SetParent(this.transCon, false); gameObject.SetActive(true); AreaItem item = new AreaItem(gameObject.transform, new Action <int>(this.onAreaClick), j); this.lArea.Add(item); } RectTransform component = this.transCon.GetComponent <RectTransform>(); component.sizeDelta = new Vector2(component.sizeDelta.x, (float)num * this.h); }
public void changeArea(int idx) { if (lastArea != null) { lastArea.bt.interactable = true; } lastArea = lArea[idx]; lastArea.bt.interactable = false; refeshServers(idx * 10); }
public void changeArea(int idx) { bool flag = this.lastArea != null; if (flag) { this.lastArea.bt.interactable = true; } this.lastArea = this.lArea[idx]; this.lastArea.bt.interactable = false; this.refeshServers(idx * 10); }