This commit is contained in:
2026-05-22 15:43:00 +08:00
parent 6f17a740e8
commit de23d47e5f
14 changed files with 669 additions and 135 deletions

View File

@@ -11,8 +11,8 @@ namespace Script
{
public class ContactEntryController : MonoBehaviour, IController
{
private Transform _background;
private Transform _backgroundName;
private Image _background;
private Text _backgroundName;
private GameObject _confirmBtnTime;
private Text _confirmBtnTimeText;
private Button _confirmButton;
@@ -37,36 +37,24 @@ namespace Script
{
_usersItem = item;
_meetingContacts = meetingContactsController;
_background = transform.Find("headBackground/image").GetComponent<Image>();
_backgroundName = transform.Find("headBackground/Name").GetComponent<Text>();
///头像赋值
if (string.IsNullOrEmpty(item.avatar))
{
var randomColor = WebRTCUtil.GetRandomColor();
_background = transform.Find("headBackground");
if (_background != null)
{
var image = _background.GetComponent<Image>();
if (image != null) image.color = randomColor;
}
_backgroundName = _background.transform.Find("Name");
if (_background != null) _background.color = randomColor;
if (_backgroundName != null)
{
var textComponent = _backgroundName.GetComponent<Text>();
if (textComponent != null && !string.IsNullOrEmpty(item.name))
textComponent.text = item.name.Substring(0, 1);
}
if (!string.IsNullOrEmpty(item.name))
_backgroundName.text = item.name.Substring(0, 1);
}
else
{
_background = transform.Find("headBackground");
if (_background != null)
{
var imageComponent = _background.GetComponent<Image>();
if (imageComponent != null) WebRTCUtil.DownloadAndSetAvatar(item.avatar, imageComponent);
}
_backgroundName = _background.transform.Find("Name");
if (_backgroundName != null) _backgroundName.GetComponent<Text>().text = "";
if (_background != null)
WebRTCUtil.DownloadAndSetAvatar(item.avatar, _background);
if (_backgroundName != null) _backgroundName.text = "";
}
if (!string.IsNullOrEmpty(item.name))