少年修仙传客户端代码仓库
lcy
2025-05-08 1314c3b3c14cd520bbb8569b5f98d68933a22cd3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using UnityEngine;
 
namespace vnxbqy.UI
{
    public class FairySiegeBattleReportDefCell : 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<FairySiegeActModel>(); } }
 
        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.batReportDefDict.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<FairySiegeBattleReportWin>();
            });
 
            string rate = string.Empty;
            // 自己看自己的战报
            if (model.nowBatReportFamilyID == model.myFamilyID)
            {
                rate = model.CalculateDamagePercentage(hurtValue, model.myCityHPMax);
            }
            else
            {
                bool isBatSceneCityInfo = model.TryGetBatSceneCityInfo(model.showBatType, model.showBatGroup, model.nowBatReportFamilyID, out var cityInfo);
                if (isBatSceneCityInfo)
                {
                    rate = model.CalculateDamagePercentage(hurtValue, cityInfo.HPMax);
                }
            }
            txtHealthLoss.text = rate;
        }
    }
}