少年修仙传客户端代码仓库
client_Hale
2019-04-15 f99a0cd6ed9f5df666b19549e6a7de9bf9b9e9c8
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
165
166
167
168
169
170
171
172
173
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Thursday, May 24, 2018
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
 
using UnityEngine;
using UnityEngine.UI;
 
namespace Snxxz.UI
{
 
    public class StoveUpgradWin : Window
    {
        [SerializeField] UIAlphaTween m_DisplayAlphaTween;
        [SerializeField] RawImage m_ModelRawImage;
        [SerializeField] Image m_TitleIcon;
        [SerializeField] Text m_PowerUpper;
        [SerializeField] Button m_CloseBtn;
        [SerializeField] RectTransform m_ContainerLv;
        [SerializeField] Text m_LvBeforeValue;
        [SerializeField] Text m_LvNowValue;
        [SerializeField] RectTransform m_ContainerProperty;
        [SerializeField] PropertyCompareBehaviour[] m_Properties;
        [SerializeField] RectTransform m_ContainerSkill;
        [SerializeField] StoveRecipeCell[] m_Recipes;
 
        DateTime openTime = DateTime.Now;
        #region Built-in
        protected override void BindController()
        {
 
        }
 
        protected override void AddListeners()
        {
            m_CloseBtn.onClick.AddListener(OnClickClose);
        }
 
        protected override void OnPreOpen()
        {
            m_ModelRawImage.gameObject.SetActive(true);
            m_ContainerSkill.gameObject.SetActive(false);
            m_ContainerProperty.gameObject.SetActive(false);
            m_ContainerLv.gameObject.SetActive(false);
            m_DisplayAlphaTween.SetStartState();
 
            openTime = DateTime.Now;
            Display();
        }
 
        protected override void OnActived()
        {
            base.OnActived();
            m_TitleIcon.SetSprite(ActivateShow.titleIconKey);
            m_TitleIcon.SetNativeSize();
            DisplayModel();
        }
 
        protected override void OnAfterOpen()
        {
        }
 
        protected override void OnPreClose()
        {
            UI3DModelExhibition.Instance.StopShow();
            UI3DTreasureExhibition.Instance.StopShow();
        }
 
        protected override void OnAfterClose()
        {
        }
 
        #endregion
 
        void Display()
        {
            switch (ActivateShow.activateType)
            {
                case ActivateShow.ActivateFunc.Stove:
                    DisplayFightPower();
                    DisplayLv();
                    DisplayProperty();
                    DisplaySkill();
                    break;
            }
        }
 
        void DisplayFightPower()
        {
            m_PowerUpper.text = ActivateShow.fightPower.ToString();
        }
 
        void DisplayLv()
        {
            m_ContainerLv.gameObject.SetActive(true);
            m_LvBeforeValue.text = ActivateShow.beforeLv.ToString();
            m_LvNowValue.text = ActivateShow.currentLv.ToString();
        }
 
        void DisplayProperty()
        {
            m_ContainerProperty.gameObject.SetActive(true);
            for (int i = 0; i < m_Properties.Length; i++)
            {
                if (i < ActivateShow.propertyCompares.Count)
                {
                    m_Properties[i].gameObject.SetActive(true);
                    switch (ActivateShow.activateType)
                    {
                        case ActivateShow.ActivateFunc.Stove:
                            m_Properties[i].Display(ActivateShow.propertyCompares[i].key
                        , ActivateShow.propertyCompares[i].beforeValue, ActivateShow.propertyCompares[i].currentValue);
                            break;
                    }
                }
                else
                {
                    m_Properties[i].gameObject.SetActive(false);
                }
            }
        }
 
        void DisplaySkill()
        {
            m_ContainerSkill.gameObject.SetActive(ActivateShow.skills.Count > 0);
            if (ActivateShow.skills.Count == 0)
            {
                return;
            }
            for (int i = 0; i < m_Recipes.Length; i++)
            {
                if (i < ActivateShow.skills.Count)
                {
                    m_Recipes[i].gameObject.SetActive(true);
                    m_Recipes[i].SetDisplayModel(ActivateShow.skills[i]);
                }
                else
                {
                    m_Recipes[i].gameObject.SetActive(false);
                }
            }
        }
 
        void DisplayModel()
        {
            switch (ActivateShow.activateType)
            {
                case ActivateShow.ActivateFunc.Stove:
                    m_ModelRawImage.rectTransform.sizeDelta = new Vector2(600, 600);
                    UI3DTreasureExhibition.Instance.BeginShowTreasure(301, m_ModelRawImage);
                    break;
            }
        }
 
        private void OnClickClose()
        {
            if ((DateTime.Now - openTime).TotalSeconds < 3f)
            {
                return;
            }
            CloseClick();
        }
    }
 
}