少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-25 cdb0198fb8e85811ec1e06b15f36df9cbe0fdb9a
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
 
using UnityEngine;
using UnityEngine.UI;
 
namespace Snxxz.UI
{
    public class FairyTreasureCollectPanelPattern3 : FairyTreasureCollect
    {
        [SerializeField] Text m_AddedEffect;
        [SerializeField] Button m_UnlockTreasureBtn;
        [SerializeField] PositionTween m_SkillTween;
 
        TreasureFindHostModel findHostModel
        {
            get
            {
                return ModelCenter.Instance.GetModel<TreasureFindHostModel>();
            }
        }
 
        private bool show = false;
 
        public override void Display(int _treasureId, bool _tween = false)
        {
            base.Display(_treasureId, _tween);
 
            if (model.fairyTreasureGetDict.ContainsKey(treasure.id))
            {
                m_LockedDescription.text = Language.Get("FairyTreasure_1", model.fairyTreasureGetDict[_treasureId]);
            }
            else
            {
                m_LockedDescription.text = string.Empty;
            }
 
            show = false;
 
            var _progress = 0;
            m_UnlockTreasureBtn.onClick.RemoveAllListeners();
            if (treasureId != 302 && findHostModel.IsReachUnlock(treasureId, out _progress)
                && treasure.state != TreasureState.Collected)
            {
                m_UnlockTreasureBtn.gameObject.SetActive(true);
                m_GotoGet.gameObject.SetActive(false);
                m_UnlockTreasureBtn.onClick.AddListener(() =>
                {
                    show = true;
                    CA50E_tagCMOpenMagicWeapon _pak = new CA50E_tagCMOpenMagicWeapon();
                    _pak.MWID = (uint)treasureId;
                    GameNetSystem.Instance.SendInfo(_pak);
                });
            }
            else
            {
                m_UnlockTreasureBtn.gameObject.SetActive(false);
            }
 
            switch (treasureId)
            {
                case 302:
                    m_GotoBtnText.text = Language.Get("FairyTreasureGotoBuy");
                    if (treasure.treasureStages.Count > 0 &&
                        treasure.treasureStages[0].unlockType == TreasureStageUnlock.Skill)
                    {
                        var _skillId = treasure.unlockSkill;
                        var skillConfig = SkillConfig.Get(_skillId);
                        m_AddedEffect.text = skillConfig.Description;
                    }
                    break;
                case 305:
                case 306:
                case 307:
                case 308:
                    m_GotoBtnText.text = Language.Get("FairyTreasureGot");
                    m_ContainerLocked.gameObject.SetActive(false);
                    if (treasure.treasureStages[0].unlockType == TreasureStageUnlock.Property)
                    {
                        var _property = treasure.treasureStages[0].propertyDict.First();
                        switch (_property.Key)
                        {
                            case (int)AttrEnum.KillMonsExpPrecent:
                                m_AddedEffect.text = Language.Get("FairyTreasure_2", _property.Value / 100);
                                break;
                            case (int)AttrEnum.AddHurt:
                                m_AddedEffect.text = Language.Get("FairyTreasure_3", _property.Value / 100);
                                break;
                            case 60:
                                m_AddedEffect.text = Language.Get("FairyTreasure_4", _property.Value / 100);
                                break;
                            case 18:
                                m_AddedEffect.text = Language.Get("FairyTreasure_9", _property.Value / 100);
                                break;
                        }
                    }
                    break;
            }
 
            if (_tween && m_SkillTween.gameObject.activeInHierarchy)
            {
                m_SkillTween.Play();
            }
            else
            {
                m_SkillTween.SetEndState();
            }
 
            var _fightPower = model.GetTreasureFightPower(_treasureId);
            m_FightPower.text = _fightPower.ToString();
            m_ContainerFight.gameObject.SetActive(_fightPower > 0 && treasure.state == TreasureState.Collected);
        }
 
        protected sealed override void GotoGet()
        {
            switch (treasureId)
            {
                case 302:
                    ModelCenter.Instance.GetModel<VipModel>().gotoVipLv = model.fairyTreasureGetDict[treasureId];
                    WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.VipRechargeFunc4);
                    break;
                case 305:
                case 306:
                case 307:
                case 308:
                    if (!FuncOpen.Instance.IsFuncOpen(124))
                    {
                        FuncOpen.Instance.ProcessorFuncErrorTip(124);
                        return;
                    }
                    WindowCenter.Instance.Close<TreasureBaseWin>();
                    WindowCenter.Instance.Open<TreasureFindHostWin>();
                    break;
            }
        }
 
        protected sealed override void OnTreasureStateChange(int _id)
        {
            base.OnTreasureStateChange(_id);
            if (_id != treasureId)
            {
                return;
            }
            if (show)
            {
                WindowCenter.Instance.Close<TreasureBaseWin>();
                WindowCenter.Instance.Open<MainInterfaceWin>();
            }
            show = false;
            var _fightPower = model.GetTreasureFightPower(_id);
            m_FightPower.text = _fightPower.ToString();
            m_ContainerFight.gameObject.SetActive(_fightPower > 0 && treasure.state == TreasureState.Collected);
        }
 
        public override void Dispose()
        {
            base.Dispose();
            m_UnlockTreasureBtn.onClick.RemoveAllListeners();
        }
    }
}