少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
using System.Collections;
using System.Collections.Generic;
using vnxbqy.UI;
using UnityEngine;
using UnityEngine.UI;
namespace EnhancedUI.EnhancedScroller
{
    public class FairyLeagueRankCell : ScrollerUI
    {
        [SerializeField] Image m_RankBG;
        [SerializeField] Text m_RankTxt;
        [SerializeField] Image m_RankImg;
        [SerializeField] Image m_FirstRankSign;
        [SerializeField] Text m_PlayerNameTxt;
        [SerializeField] Text m_CrystalTxt;
        [SerializeField] Text m_KillNumTxt;
        [SerializeField] Text m_BuffNumTxt;
        [SerializeField] Text m_FightTimeTxt;
        [SerializeField] Text m_IntegralTxt;
        [SerializeField] Image m_WinImg;
        [SerializeField] AwardItemUI m_IntegralAward;
        [SerializeField] RectTransform m_ContainChampion;
        [SerializeField] AwardItemUI m_ChampionAward;
        [SerializeField] Button m_ChampionAwardBtn;
 
        FairyLeagueModel m_Model;
        FairyLeagueModel model
        {
            get
            {
                return m_Model ?? (m_Model = ModelCenter.Instance.GetModel<FairyLeagueModel>());
            }
        }
        public override void Refresh(CellView cell)
        {
            var _list = model.fairyLeagueResults;
            var _index = cell.index;
            m_RankTxt.SetActive(_index > 2);
            m_RankImg.SetActive(_index < 3);
            m_RankBG.SetSprite(_index % 2 == 0 ? "RankList_SingleBottom" : "RankList_QuanTouMing");
            if (_index < 3)
            {
                m_RankImg.SetSprite(_index == 0 ? "Rank_First" : _index == 1 ? "Rank_Second" : "Rank_Third");
            }
            else
            {
                m_RankTxt.text = (_index + 1).ToString();
            }
            FairyLeagueResultData _data = model.fairyLeagueResults[_index];
            m_PlayerNameTxt.text = _data.PlayerName;
            m_BuffNumTxt.text = _data.TakeBuffs.ToString();
            m_CrystalTxt.text = _data.TakeCrystals.ToString();
            m_KillNumTxt.text = _data.KillNums.ToString();
            m_IntegralTxt.text = _data.Integral.ToString();
            m_FightTimeTxt.text = TimeUtility.SecondsToHMS(_data.FightTime);
            m_WinImg.SetActive(_data.IsWin);
            var _rankKey = UIHelper.GetIntervalAward(model.integralRankAwardDict.Keys, _index + 1);
            var _item = model.integralRankAwardDict[_rankKey][0];
            var _per = 100;
            if ((model.fairyLeagueGroupId - 1) >= 0
                && (model.fairyLeagueGroupId - 1) < model.integralRankAwardPer.Length)
            {
                _per = model.integralRankAwardPer[model.fairyLeagueGroupId - 1];
            }
            var _count = (int)Mathf.Max(_item.count * (_item.isPer == 1 ? ((float)_per / 100) : 1), 1);
            m_IntegralAward.Init(_item.id, _count, _item.bind);
            m_IntegralAward.itemCnt.text = StringUtility.Contact("X", _count);
            bool winChampion = _index == model.GetBattleWinFirstPlayer();
            bool defeatChampion = _index == model.GetBattleDefeatFirstPlayer();
            m_FirstRankSign.SetActive(winChampion || defeatChampion);
            if (winChampion || defeatChampion)
            {
                m_FirstRankSign.SetSprite(winChampion ? "UnionMatchNo1" : "UnionMatchNo2");
                m_FirstRankSign.SetNativeSize();
            }
            m_ContainChampion.SetActive(model.fairyLeagueGroupId == 5 && (winChampion || defeatChampion));
            m_ChampionAwardBtn.onClick.RemoveAllListeners();
            if (model.fairyLeagueGroupId == 5 && (winChampion || defeatChampion))
            {
                Dictionary<int, List<Item>> _dict = null;
                if (winChampion)
                {
                    _dict = (model.fairyLeagueSession == 1 && model.fairyLeagueHelp.fairyWarEnter.IsFinalMatch == 1) ?
                          model.finalWarChampionWinAwardDict : model.finalWarWinAwardDict;
                }
                else
                {
                    _dict = (model.fairyLeagueSession == 1 && model.fairyLeagueHelp.fairyWarEnter.IsFinalMatch == 1) ?
                          model.finalWarChampionDefeatAwardDict : model.finalWarDefeatAwardDict;
                }
                if (_dict != null && _dict.Count > 0)
                {
                    _rankKey = UIHelper.GetIntervalAward(_dict.Keys, (int)PlayerDatas.Instance.worldLv);
                    var _Award = _dict[_rankKey][0];
                    m_ChampionAward.Init(_Award.id, Mathf.Min(1, _Award.count));
                    m_ChampionAwardBtn.onClick.AddListener(() =>
                    {
                        ItemTipUtility.Show(_Award.id);
                    });
                }
            }
        }
    }
}