private void _UpdateLobbyType1(DataLobby lobby) { LobbyRowType1 lobbyRow = types1.Find(lb => lb.data.roomId == lobby.roomId); if (lobbyRow != null) { lobbyRow.setData(lobby); } }
private IEnumerator _AddRowType1(DataLobby lobby) { yield return(new WaitForEndOfFrame()); types1.Add(LobbyRowType1.Create(lobby, tableType1, JoinGame)); yield return(new WaitForSeconds(0.1f)); tableType1.repositionNow = true; yield return(new WaitForSeconds(0.2f)); tableType1.GetComponent <UICenterOnChild>().Recenter(); }
public static LobbyRowType1 Create(DataLobby data, UITable parent, Action <DataLobby> callBack) { GameObject go = GameObject.Instantiate(Resources.Load("Prefabs/Lobby/LobbyRowType1")) as GameObject; go.transform.parent = parent.transform; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; go.GetComponent <UIDragScrollView>().scrollView = parent.GetComponentInParent <UIScrollView>(); go.name = "#" + data.roomId; LobbyRowType1 item = go.GetComponent <LobbyRowType1>(); item.setData(data); item.action = callBack; return(item); }
public void RemoveLobby(DataLobby lobby) { if (isShowType1) { LobbyRowType1 lobbyRow = types1.Find(lobbiesView => lobbiesView.data.roomId == lobby.roomId); if (lobbyRow != null && lobbyRow.gameObject != null) { GameObject.Destroy(lobbyRow.gameObject); types1.Remove(lobbyRow); } } else { LobbyRowType2 lobbyRow = types2.Find(lobbiesView => lobbiesView.data.roomId == lobby.roomId); GameObject.Destroy(lobbyRow.gameObject); types2.Remove(lobbyRow); } }
IEnumerator initShowRowType1(List <DataLobby> lobbies) { ClearAllRow(); yield return(new WaitForEndOfFrame()); if (lobbies.Count > 0) { for (int i = 0; i < lobbies.Count; i++) { if (types1.Find(lb => lb.data.roomId == lobbies[i].roomId) != null) { continue; } LobbyRowType1 lobby = LobbyRowType1.Create(lobbies[i], tableType1, JoinGame); types1.Add(lobby); } tableType1.repositionNow = true; yield return(new WaitForEndOfFrame()); tableType1.GetComponent <UICenterOnChild>().CenterOn(tableType1.transform.GetChild(0)); } }