public void init(List <UserGameData> list, int roomNo) { this.roomNo = roomNo; attackGuide.gameObject.SetActive(false); UserGameData myData = new UserGameData(); foreach (UserGameData data in list) { if (isMyData(data)) { myData.setData(data); list.Remove(data); break; } } for (int i = 0; i < 4; i++) { GameObject itemObj = NGUITools.AddChild(grid.gameObject, userObj); userObjList.Add(itemObj); UserPanel data = itemObj.GetComponent <UserPanel>(); if (i < list.Count) { data.setData(list[i]); data.reload(); playUserList.Add(userObjList[i]); } else { if (i == 3) { data.setData(myData); data.reload(); playUserList.Add(userObjList[i]); } else { //userObjList[i].SetActive(false); data.offPanel(); } } } }
public void reload() { foreach (UserGameData data in userList) { foreach (GameObject obj in playUserList) { UserPanel panelData = obj.GetComponent <UserPanel>(); if (panelData.userData.email.Equals(data.email)) { panelData.setData(data); panelData.reload(); } } } }
//public void updateData(List<UserGameData> userList, int turnUserIndex) //{ // this.userList = userList; // isUpdate = true; // this.turnUserIndex = turnUserIndex; //} public void setData(List <UserGameData> userList, int turnUserIndex) { this.userList = userList; this.turnUserIndex = turnUserIndex; foreach (UserGameData data in userList) { foreach (GameObject obj in playUserList) { UserPanel panelData = obj.GetComponent <UserPanel>(); if (panelData.userData.email.Equals(data.email)) { panelData.setData(data); } } } }