少年修仙传客户端代码仓库
xingchen Qiu
2019-04-10 b45f84d1a84cb768d0b136fe37ad18364d74af1f
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Thursday, November 15, 2018
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
namespace Snxxz.UI
{
    [XLua.Hotfix]
    public class DemonTreasureDungeonVictoryWin : DungeonVictoryWin
    {
        [SerializeField] PropertyBehaviour[] m_Propertys;
        [SerializeField] Button m_ChallengeNextLevel;
        [SerializeField] Text m_ChallengeNextTimer;
 
        TreasureModel model
        {
            get { return ModelCenter.Instance.GetModel<TreasureModel>(); }
        }
 
        protected override void AddListeners()
        {
            base.AddListeners();
            m_ChallengeNextLevel.onClick.AddListener(ChallengeNext);
        }
 
        protected override void Display()
        {
            m_ContainerPoivt.gameObject.SetActive(true);
            base.DrawPassTime();
            base.RequireDungeonExit();
            DisplayDemonTreasureProperty();
        }
 
        protected override void DrawExitTimer(int seconds)
        {
            m_ExitTimer.text = Language.Get("DemonDungeonExit");
            m_ChallengeNextTimer.text = Language.Get("RuneDungeonVictory_Btn_Next_1", Mathf.Clamp(seconds, 0, int.MaxValue));
        }
 
        private void DisplayDemonTreasureProperty()
        {
            var result = dungeonModel.dungeonResult;
            TreasureDungeon treasureDungeon;
            Dictionary<int, int> propertyDict = null;
            if (model.TryGetTreasureDungeon(41110, result.lineID, out treasureDungeon))
            {
                propertyDict = treasureDungeon.GetUpperProperty(result.wheel);
            }
            var index = 0;
            if (propertyDict != null)
            {
                foreach (var key in propertyDict.Keys)
                {
                    if (index < m_Propertys.Length)
                    {
                        m_Propertys[index].gameObject.SetActive(true);
                        m_Propertys[index].Display(key, propertyDict[key]);
                        index++;
                    }
                }
            }
            for (int i = index; i < m_Propertys.Length; i++)
            {
                m_Propertys[i].gameObject.SetActive(false);
            }
        }
 
        private void ChallengeNext()
        {
            TreasureDungeon treasureDungeon;
            var result = dungeonModel.dungeonResult;
            if (model.TryGetTreasureDungeon(41110, result.lineID, out treasureDungeon))
            {
                var dungeonInfo = treasureDungeon.Get(result.wheel + 1);
                if (!dungeonInfo.Equals(default(TreasureDungeonInfo)))
                {
                    if (PlayerDatas.Instance.baseData.FightPoint >= dungeonInfo.fightPower)
                    {
                        model.DemonDungeonChallengeNext(result.lineID);
                    }
                    else
                    {
                        ConfirmCancel.ShowRuneTowerPopConfirm(
                             Language.Get("DemonLackPowerTitle"),
                             Language.Get("DemonLackFightPower", dungeonInfo.fightPower),
                             (bool ok) =>
                             {
                                 if (ok)
                                 {
                                     model.DemonDungeonChallengeNext(result.lineID);
                                 }
                                 else
                                 {
                                     dungeonModel.ExitCurrentDungeon();
                                 }
                             }
                             );
                    }
                }
            }
        }
 
    }
 
}