using UnityEngine; using UnityEngine.UI; using System.Collections; using Games.Item; using GCGame.Table; using GCGame; using Games.Fellow; using Games.GlobeDefine; public class FellowInfoList : UIItemSelect { public Image QuilityIcon; public Image HeadIcon; public Text Level; public Text Name; public GameObject RedTip; int m_PetId; public override void Show(Hashtable hash) { m_PetId = (int)hash["InitObj"]; if (InitData() == false) return; base.Show(); } public override void Refresh() { base.Refresh(); InitData(); } private bool InitData() { string state = ""; PetsHoldBookInfo bookInfo = GameManager.gameManager.PlayerDataPool.FellowBookData.GetPetBookInfo(m_PetId); if (bookInfo == null) return false; int TurnToType = GameManager.gameManager.PlayerDataPool.FellowBookData.FightType(m_PetId); if ((TurnToType & 1) != 0 && (TurnToType & 2) != 0) state = string.Format(" ({0})", StrDictionary.GetClientDictionaryString("#{20170}")); else if((TurnToType & 2) != 0) state = string.Format(" ({0})", StrDictionary.GetClientDictionaryString("#{20168}")); else if((TurnToType & 1) != 0) state = string.Format(" ({0})", StrDictionary.GetClientDictionaryString("#{20167}")); Level.text = bookInfo.BookLevel == 0 ?string.Format("<color=#D61515ff>{0}</color>", StrDictionary.GetClientDictionaryString("#{42654}")) : StrDictionary.GetClientDictionaryString("#{46518}", bookInfo.BookLevel) + state; Name.text = bookInfo.Name; int hasCount = 0; Tab_FellowHandBook handBookNext = TableManager.GetFellowHandBookByID(bookInfo.PetID * 100 + bookInfo.BookLevel + 1, 0); if (handBookNext != null) { hasCount = GameManager.gameManager.PlayerDataPool.BackPack.GetItemCountByDataId(handBookNext.ConstPetSoulID); Tab_FellowBase tab_FellowBase = TableManager.GetFellowBaseByID(handBookNext.ConstPetSoulID, 0); if (tab_FellowBase == null || tab_FellowBase.Quility > 3) { hasCount = 0; } } RedTip.SetActive(hasCount > 0); LoadAssetBundle.Instance.SetImageSprite(QuilityIcon, Utils.GetItemQualityFrame(bookInfo.Quility)); LoadAssetBundle.Instance.SetImageSprite(HeadIcon, bookInfo.headIcon); return true; } }