ict.lixian.three/Assets/Scripts/UIManager/UserInfo.cs

53 lines
1.1 KiB
C#

using AFeijia.UI;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using static InterfaceManager;
/// <summary>
/// Óû§ÐÅÏ¢
/// </summary>
public class UserInfo : UITool, IPointerEnterHandler, IPointerExitHandler
{
public Button logout_button;
public Image user_avatar;
public void OnPointerEnter(PointerEventData eventData)
{
logout_button.gameObject.SetActive(true);
}
public void OnPointerExit(PointerEventData eventData)
{
logout_button.gameObject.SetActive(false);
}
protected override void Awake()
{
base.Awake();
}
// Start is called before the first frame update
void Start()
{
Init();
}
void Init()
{
if(!string.IsNullOrEmpty(CallForTest.instance.user.avatar))
{
StartCoroutine(InterfaceManager.GetSprite(CallForTest.instance.user.avatar, (_sprite) =>
{
user_avatar.sprite = _sprite;
}));
}
}
private void OnEnable()
{
logout_button.gameObject.SetActive(false);
}
}