少年修仙传客户端代码仓库
client_linchunjie
2018-09-19 aecb6a5a62d8a4cfc7b924ce957a9c7ea90c235d
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
using System.Collections;
using System.Collections.Generic;
using TableConfig;
using UnityEngine;
using UnityEngine.UI;
 
namespace Snxxz.UI
{
    public class TreasureUnlockCell : CellView
    {
        [SerializeField] Image m_Icon;
        [SerializeField] Text m_Func;
        [SerializeField] Image m_Cutline;
        [SerializeField] Button m_Button;
 
        TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } }
 
        public void Display(int id, int stage)
        {
            m_Button.RemoveAllListeners();
            Treasure treasure;
            if (model.TryGetTreasure(id, out treasure))
            {
                var treasureStage = treasure.treasureStages.Find((x) =>
                {
                    return x.stage == stage;
                });
                bool last = true;
                for (int i = 0; i < treasure.treasureStages.Count; i++)
                {
                    var _stage = treasure.treasureStages[i];
                    if (stage < _stage.stage &&
                        (_stage.unlockType == TreasureStageUnlock.Func || _stage.unlockType == TreasureStageUnlock.Skill
                        || _stage.unlockType == TreasureStageUnlock.Treasure || _stage.unlockType == TreasureStageUnlock.TreasureSoul))
                    {
                        last = false;
                        break;
                    }
                }
                m_Cutline.gameObject.SetActive(!last);
                if (treasureStage != null)
                {
                    switch (treasureStage.unlockType)
                    {
                        case TreasureStageUnlock.Skill:
                            var skillConfig = Config.Instance.Get<SkillConfig>(treasureStage.GetSkill(PlayerDatas.Instance.baseData.Job));
                            if (skillConfig != null)
                            {
                                m_Icon.SetSprite(skillConfig.IconName);
                                m_Func.text = Language.Get("TreasureUnlockNewSkill");
                            }
                            break;
                        case TreasureStageUnlock.Func:
                            var funcConfig = Config.Instance.Get<FuncOpenLVConfig>(treasureStage.func);
                            if (funcConfig != null)
                            {
                                m_Icon.SetSprite(funcConfig.Icon);
                                m_Func.text = Language.Get("TreasureUnlockNewFunc");
                            }
                            break;
                        case TreasureStageUnlock.Treasure:
                            var treasureConfig = Config.Instance.Get<TreasureConfig>(treasureStage.treasure);
                            if (treasureConfig != null)
                            {
                                m_Icon.SetSprite(treasureConfig.Icon);
                                m_Func.text = Language.Get("TreasureUnlockNewTreasure");
                            }
                            break;
                        case TreasureStageUnlock.TreasureSoul:
                            var treasureSoulConfig = Config.Instance.Get<TreasurePrivilegeConfig>(treasureStage.treasureSoul);
                            if (treasureSoulConfig != null)
                            {
                                m_Icon.SetSprite(treasureSoulConfig.Icon);
                                m_Func.text = Language.Get("TreasureUnlockNewTreasureSoul");
                            }
                            break;
                    }
                    m_Button.AddListener(() =>
                    {
                        if (model.treasureStepUpShow)
                        {
                            return;
                        }
                        model.selectedStage = treasureStage.stage;
                        if (!WindowCenter.Instance.CheckOpen<TreasureStageTipWin>())
                        {
                            TreasureStageTipWin.SetTargetPosition(m_Button.transform as RectTransform);
                            WindowCenter.Instance.Open<TreasureStageTipWin>();
                        }
                    });
                }
            }
        }
    }
}