少年修仙传客户端代码仓库
client_linchunjie
2018-09-21 edfd535734a7adab6d0f24c863149ed63bcd37c8
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
using System.Collections;
using System.Collections.Generic;
using Snxxz.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.gameObject.SetActive(_index > 2);
            m_RankImg.gameObject.SetActive(_index < 3);
            m_RankBG.SetSprite(_index % 2 == 0 ? "RankList_SingleBottom" : "RankList_QuanTouMing");
            m_FirstRankSign.gameObject.SetActive(_index == model.GetBattleFirstPlayer());
            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.gameObject.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);
            m_ContainChampion.gameObject.SetActive(model.fairyLeagueGroupId == 5 && _index == model.GetBattleFirstPlayer());
            m_ChampionAwardBtn.onClick.RemoveAllListeners();
            if (model.fairyLeagueGroupId == 5 && _index == model.GetBattleFirstPlayer())
            {
                var _dict = (model.fairyLeagueSession == 1 && model.fairyLeagueHelp.fairyWarEnter.IsFinalMatch == 1) ?
                    model.finalWarChampionAwardDict : model.finalWarAwardDict;
                if (_dict != null)
                {
                    _rankKey = UIHelper.GetIntervalAward(_dict.Keys, (int)PlayerDatas.Instance.worldLv);
                    var _Award = _dict[_rankKey][0];
                    m_ChampionAward.Init(_Award.item.id, Mathf.Min(1, _Award.item.count), _Award.isBind);
                    m_ChampionAwardBtn.onClick.AddListener(() =>
                    {
                        ItemAttrData _itemData = new ItemAttrData(_Award.item.id, false, (ulong)_Award.item.count, -1, _Award.isBind);
                        ModelCenter.Instance.GetModel<ItemTipsModel>().SetItemTipsModel(_itemData);
                    });
                }
            }
        }
    }
}