using UnityEngine; namespace vnxbqy.UI { public class FairySiegeBattleReportAtkCell : CellView { [SerializeField] ButtonEx btnGo; [SerializeField] EmblemCell emblemCell; [SerializeField] ImageEx imgRank; [SerializeField] TextEx txtFairyName; [SerializeField] TextEx txtHealthLoss; [SerializeField] TextEx txtLeaderName; [SerializeField] TextEx txtRank; FairySiegeActModel model { get { return ModelCenter.Instance.GetModel(); } } public void Display(int index, CellView cellView) { int rankNum = index + 1; int tagFamilyID = cellView.info.Value.infoInt1; txtRank.text = rankNum.ToString(); var isRankImageDisplay = model.IsRankImageDisplay(rankNum); imgRank.SetActive(isRankImageDisplay); if (isRankImageDisplay) { var key = model.GetRankNumImage(rankNum); imgRank.SetSprite(key); } if (!model.batReportAtkDict.TryGetValue(model.nowBatReportFamilyID, out var dict)) return; if (!dict.TryGetValue((uint)tagFamilyID, out var hurtValue)) return; if (tagFamilyID == model.BossCityId) { emblemCell.InitUI(EmblemHelper.GetOtherEmblemModel(EmblemHelper.GetDefaultFamilyEmblemId())); txtFairyName.text = Language.Get("FairySiege150"); txtLeaderName.text = string.Empty; } else { if (!model.TryGetFairySiegeFamilyInfo((uint)tagFamilyID, out FairySiegeFamilyInfo familyInfo)) return; emblemCell.InitUI(EmblemHelper.GetOtherEmblemModel((int)familyInfo.EmblemID)); txtFairyName.text = familyInfo.Name; txtLeaderName.text = Language.Get("FairySiege087", familyInfo.LeaderName); } btnGo.SetListener(() => { model.JumpToCityAction?.Invoke((uint)tagFamilyID); WindowCenter.Instance.Close(); }); string rate = string.Empty; bool isBatSceneCityInfo = model.TryGetBatSceneCityInfo(model.showBatType, model.showBatGroup, (uint)tagFamilyID, out var cityInfo); if (isBatSceneCityInfo) { rate = model.CalculateDamagePercentage(hurtValue, cityInfo.HPMax); } txtHealthLoss.text = rate; } } }