public void SetUpItem(GeneralInfoItemType type, object param, bool showText = true) { this.type = type; if (type == GeneralInfoItemType.Camp_Creed) { try { CampCreedInfo info = (CampCreedInfo)param; keyParam = info.creedID; iconTrans.sprite = Utility.LoadSprite(info.creedIconPath); textTrans.text = showText ? info.creedName : ""; } catch { return; } } else if (type == GeneralInfoItemType.Camp_Attribute) { try { CampAttributeInfo info = (CampAttributeInfo)param; keyParam = info.attributeID; iconTrans.sprite = Utility.LoadSprite(info.iconPath); textTrans.text = showText ? info.attributeName : ""; } catch { return; } } else if (type == GeneralInfoItemType.Leader_Skill) { try { LeaderSkillInfo info = (LeaderSkillInfo)param; keyParam = info.skillID; iconTrans.sprite = Utility.LoadSprite(info.skillIconPath); textTrans.text = showText ? info.skillName : ""; } catch { return; } } else if (type == GeneralInfoItemType.Leader_Attribute) { try { LeaderAttributeInfo info = (LeaderAttributeInfo)param; keyParam = info.attributeID; iconTrans.sprite = Utility.LoadSprite(info.attributeIconPath); textTrans.text = showText ? info.attributeName : ""; } catch { return; } } RefrehsContentSize(); //FadeAnim var canvas = transform.SafeGetComponent <CanvasGroup>(); canvas.alpha = 0; canvas.DoCanvasFade(1, 0.8f); }
public static LeaderAttributeInfo InitAttributeInfo(int attributeID) { LeaderAttributeInfo info = new LeaderAttributeInfo(); var meta = LeaderModule.GetLeaderAttributeDataByKey(attributeID); if (meta == null) { DebugPlus.LogError("Init LeaderAttribute Error! attributeID=" + attributeID); return(null); } info.attributeID = meta.AttributeID; info.attributeName = MultiLanguage.Instance.GetTextValue(meta.Name); info.attributeDesc = MultiLanguage.Instance.GetTextValue(meta.Desc); info.attributeIconPath = meta.IconPath; return(info); }
public static List <LeaderAttributeInfo> GetLeaderAttributePreset(int leaderID) { List <LeaderAttributeInfo> result = new List <LeaderAttributeInfo>(); var leaderMeta = GetLeaderPresetDataByKey(leaderID); if (leaderMeta != null) { var list = Utility.TryParseIntList(leaderMeta.AttributeIDList, ','); for (int i = 0; i < list.Count; i++) { LeaderAttributeInfo info = LeaderAttributeInfo.InitAttributeInfo(list[i]); if (info != null) { result.Add(info); } } } return(result); }