Files
JJBB/Assets/Project/Script/GUI/PlayerInfo/OtherPlayerPetItem.cs

65 lines
1.7 KiB
C#
Raw Normal View History

2024-08-23 15:49:34 +08:00
using System.Collections;
using UnityEngine;
using Games.Fellow;
using UnityEngine.UI;
using GCGame;
using Games.GlobeDefine;
using GCGame.Table;
public class OtherPlayerPetItem : UIItemSelect {
public Text Level;
public Image QuilityIcon;
public Image HeadIcon;
public GameObject ZhanIcon;
public GameObject ZhuIcon;
Fellow m_Fellow = null;
public override void Show(Hashtable hash)
{
m_Fellow = hash["InitObj"] as Fellow;
Refresh();
base.Show();
}
public override void Refresh(Hashtable hash)
{
base.Refresh(hash);
if (m_Fellow == null || m_Fellow.IsValid() == false)
return;
if (hash == null)
return;
if (hash.ContainsKey("guid") == false)
{
return;
}
ulong guid = (ulong)hash["guid"];
if (m_Fellow.Guid != guid)
return;
Refresh();
}
public override void Refresh()
{
base.Refresh();
if (m_Fellow == null)
{
gameObject.transform.SetParent(null);
gameObject.SetActive(false);
GameObject.Destroy(gameObject);
return;
}
int quility = (int)Utils.GetQualityIndex(m_Fellow.Quality);
LoadAssetBundle.Instance.SetImageSprite(QuilityIcon, GCGame.Utils.GetItemQualityFrame(quility));
Level.text = m_Fellow.Level.ToString();
if (m_Fellow.Guid == GlobeVar.INVALID_GUID || m_Fellow.IsValid() == false)
return;
LoadAssetBundle.Instance.SetImageSprite(HeadIcon, m_Fellow.GetIcon());
ZhanIcon.SetActive(m_Fellow.Called);
ZhuIcon.gameObject.SetActive(m_Fellow.Helped);
}
}