public TableCell CellForIdx(TableView tableView, int idx) { LevelListTableCell tableCell = avatarList.tableView.DequeueReusableCellForIdentifier(kTableCellReuseIdentifier) as LevelListTableCell; if (!tableCell) { tableCell = Instantiate(_tableCellTemplate); foreach (var image in tableCell.GetPrivateField <LevelListTableCell, UnityEngine.UI.Image[]>("_beatmapCharacteristicImages")) { DestroyImmediate(image); } tableCell.SetPrivateField("_beatmapCharacteristicImages", new UnityEngine.UI.Image[0]); tableCell.GetPrivateField <LevelListTableCell, RawImage>("_favoritesBadgeImage").enabled = false; tableCell.reuseIdentifier = kTableCellReuseIdentifier; } AvatarListItem avatar = _avatars[idx]; tableCell.GetPrivateField <LevelListTableCell, TextMeshProUGUI>("_songNameText").text = avatar.name; tableCell.GetPrivateField <LevelListTableCell, TextMeshProUGUI>("_authorText").text = avatar.author; tableCell.GetPrivateField <LevelListTableCell, RawImage>("_coverRawImage").texture = avatar.icon ?? _blankAvatarIcon; return(tableCell); }
public TableCell CellForIdx(TableView tableView, int idx) { LevelListTableCell tableCell = _tableView.DequeueReusableCellForIdentifier(kTableCellReuseIdentifier) as LevelListTableCell; if (!tableCell) { tableCell = Instantiate(_tableCellTemplate); tableCell.name = "AvatarsTableViewCell"; tableCell.GetPrivateField <Image>("_backgroundImage").enabled = false; tableCell.GetPrivateField <Image>("_favoritesBadgeImage").enabled = false; tableCell.transform.Find("BpmIcon").gameObject.SetActive(false); tableCell.GetPrivateField <TextMeshProUGUI>("_songDurationText").enabled = false; tableCell.GetPrivateField <TextMeshProUGUI>("_songBpmText").enabled = false; tableCell.reuseIdentifier = kTableCellReuseIdentifier; } AvatarListItem avatar = _avatars[idx]; tableCell.GetPrivateField <TextMeshProUGUI>("_songNameText").text = avatar.name; tableCell.GetPrivateField <TextMeshProUGUI>("_songAuthorText").text = avatar.author; Texture2D icon = avatar.icon ? avatar.icon : _blankAvatarIcon; tableCell.GetPrivateField <Image>("_coverImage").sprite = Sprite.Create(icon, new Rect(0, 0, icon.width, icon.height), Vector2.zero); return(tableCell); }
public TableCell CellForIdx(TableView tableView, int idx) { AvatarListTableCell tableCell = _tableView.DequeueReusableCellForIdentifier(kTableCellReuseIdentifier) as AvatarListTableCell; if (!tableCell) { tableCell = Instantiate(_tableCellPrefab); tableCell.reuseIdentifier = kTableCellReuseIdentifier; } AvatarListItem avatar = _avatars[idx]; Sprite icon = avatar.icon ? avatar.icon : _blankAvatarIcon; tableCell.nameText.text = avatar.name; tableCell.authorText.text = avatar.author; tableCell.cover.sprite = icon; return(tableCell); }