98 lines
2.9 KiB
C#
98 lines
2.9 KiB
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using System.Collections;
|
|
using Games.Item;
|
|
using GCGame.Table;
|
|
using GCGame;
|
|
using Games.Fellow;
|
|
using Games.GlobeDefine;
|
|
|
|
public class FellowListItem : UIItemSelect
|
|
{
|
|
public GameObject PetItem;
|
|
public GameObject AddItem;
|
|
public GameObject AddMaxItem;
|
|
|
|
public Text Level;
|
|
public Image QuilityIcon;
|
|
public Image HeadIcon;
|
|
public GameObject ZhanIcon;
|
|
public GameObject ZhuIcon;
|
|
public GameObject AttachIcon;
|
|
|
|
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;
|
|
}
|
|
Tab_FellowBase fellowBase = TableManager.GetFellowBaseByID(m_Fellow.DataId, 0);
|
|
if(fellowBase!=null)
|
|
{
|
|
LoadAssetBundle.Instance.SetImageSprite(QuilityIcon, GCGame.Utils.GetFellowQuilityIcon(m_Fellow.Quality));
|
|
}
|
|
|
|
PetItem.SetActive(m_Fellow.IsValid() && m_Fellow.Guid!= GlobeVar.INVALID_GUID);
|
|
AddItem.SetActive(m_Fellow.Guid == GlobeVar.INVALID_GUID && m_Fellow.DataId == -1);
|
|
AddMaxItem.SetActive(m_Fellow.Guid == GlobeVar.INVALID_GUID && m_Fellow.DataId == -2);
|
|
Level.text = m_Fellow.Level.ToString();
|
|
if (m_Fellow.DataId == -2 && m_Fellow.Guid == GlobeVar.INVALID_GUID)
|
|
{
|
|
Tab_AddFellowCarryNum cost = TableManager.GetAddFellowCarryNumByID(GameManager.gameManager.PlayerDataPool.FellowContainer.ContainerSize + 1, 0);
|
|
if(cost==null)
|
|
{
|
|
AddMaxItem.SetActive(false);
|
|
}
|
|
else
|
|
{
|
|
AddMaxItem.SetActive(true);
|
|
}
|
|
}
|
|
|
|
if (m_Fellow.Guid == GlobeVar.INVALID_GUID || m_Fellow.IsValid() == false)
|
|
return;
|
|
LoadAssetBundle.Instance.SetImageSprite(HeadIcon, m_Fellow.GetIcon());
|
|
if (m_Fellow.Quality >= (int)FELLOWQUALITY.ORANGE)
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(true, 8001, HeadIcon.transform);
|
|
}
|
|
else
|
|
{
|
|
CommonItemContainerItem.ShowQualityEffect(false, 8001, HeadIcon.transform);
|
|
}
|
|
ZhanIcon.SetActive(m_Fellow.Called);
|
|
ZhuIcon.gameObject.SetActive(m_Fellow.Helped);
|
|
AttachIcon.gameObject.SetActive(m_Fellow.Attached);
|
|
}
|
|
|
|
}
|