using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using GCGame.Table; public class TitleActiveItem : UIItemBase{ public Text _TitleName; public Image _TitleIcon; public Vector2 _TitleIconMaxSize; public List _PropName; public List _PropValue; public Text _CombatDesc; public Text _CombatVal; public int _titleId; public override void Show(Hashtable hash) { base.Show(hash); _titleId = (int)hash["InitObj"]; var titleData = TableManager.GetTitleDataByID(_titleId, 0); if(titleData == null) { gameObject.SetActive(false); return; } if (!titleData.TitleIconPath.Equals("-1")) { _TitleName.gameObject.SetActive(false); _TitleIcon.gameObject.SetActive(true); LoadAssetBundle.Instance.SetImageSprite(_TitleIcon, titleData.TitleIconPath, delegate (bool bSucess, GameObject obj) { _TitleIcon.SetNativeSize(); if (_TitleIcon.rectTransform.sizeDelta.y > _TitleIconMaxSize.y) { float delta = _TitleIconMaxSize.y / _TitleIcon.rectTransform.sizeDelta.y; _TitleIcon.rectTransform.sizeDelta = _TitleIcon.rectTransform.sizeDelta * delta; } }); }else { _TitleIcon.gameObject.SetActive(false); _TitleName.gameObject.SetActive(true); _TitleName.text = titleData.Name; } for(int index = 0; index < _PropName.Count; index++) { _PropName[index].gameObject.SetActive(titleData.GetAttrValbyIndex(index) != -1); } for (int index = 0; index < titleData.getAttrIdCount(); index++) { if(titleData.GetAttrValbyIndex(index) != -1) { _PropName[index].gameObject.SetActive(true); var strDicId = "#{" + (10000 + titleData.GetAttrIdbyIndex(index)) + "}"; _PropName[index].text = StrDictionary.GetClientDictionaryString(strDicId) + ":"; _PropValue[index].text = "+" + titleData.GetAttrValbyIndex(index).ToString(); }else { _PropName[index].gameObject.SetActive(false); } } _CombatDesc.text = StrDictionary.GetClientDictionaryString("#{10400}") + ":"; _CombatVal.text = "+" + titleData.CombatPower.ToString(); } }