提交 | 用户 | age
|
a27c7f
|
1 |
using vnxbqy.UI;
|
H |
2 |
using System.Collections.Generic;
|
|
3 |
using System.Linq;
|
|
4 |
|
|
5 |
|
|
6 |
/// <summary>
|
|
7 |
/// 天星塔
|
|
8 |
/// </summary>
|
|
9 |
public class CelestialStarTowerWin : ILWindow
|
|
10 |
{
|
|
11 |
ScrollerController scroller;
|
|
12 |
TextEx txtBuy;
|
|
13 |
TextEx txtProfitRatio;
|
|
14 |
ButtonEx btnClose;
|
|
15 |
ButtonEx btnBuy;
|
|
16 |
ImageEx imgBuy;
|
0bd288
|
17 |
TextEx orgPrice;
|
H |
18 |
|
|
19 |
|
a27c7f
|
20 |
VipModel vipModel { get { return ModelCenter.Instance.GetModelEx<VipModel>(); } }
|
H |
21 |
protected override void BindController()
|
|
22 |
{
|
|
23 |
scroller = proxy.GetWidgtEx<ScrollerController>("scroller");
|
|
24 |
txtBuy = proxy.GetWidgtEx<TextEx>("txtBuy");
|
|
25 |
txtProfitRatio = proxy.GetWidgtEx<TextEx>("txtProfitRatio");
|
|
26 |
btnClose = proxy.GetWidgtEx<ButtonEx>("btnClose");
|
|
27 |
btnBuy = proxy.GetWidgtEx<ButtonEx>("btnBuy");
|
|
28 |
imgBuy = proxy.GetWidgtEx<ImageEx>("imgBuy");
|
0bd288
|
29 |
|
H |
30 |
var obj = btnBuy.FindComponent("TextEx", "Txt_orgPrice");
|
|
31 |
if (obj != null)
|
|
32 |
orgPrice = obj as TextEx;
|
a27c7f
|
33 |
}
|
H |
34 |
|
|
35 |
protected override void AddListeners()
|
|
36 |
{
|
|
37 |
btnClose.SetListener(() =>
|
|
38 |
{
|
|
39 |
CloseWin<CelestialStarTowerWin>();
|
|
40 |
});
|
|
41 |
|
|
42 |
btnBuy.SetListener(() =>
|
|
43 |
{
|
|
44 |
vipModel.CTG(CelestialStarTowerModel.Instance.ctgIdDict[3]);
|
|
45 |
});
|
|
46 |
}
|
|
47 |
|
|
48 |
protected override void OnPreOpen()
|
|
49 |
{
|
|
50 |
CelestialStarTowerModel.Instance.UpdateGiftStateEvent += UpdateGiftStateEvent;
|
|
51 |
ModelCenter.Instance.GetModel<SkyTowerModel>().OnChallengeState += OnFloorChangeEvent;
|
|
52 |
scroller.OnRefreshCell += OnScrollerRefreshCell;
|
|
53 |
|
|
54 |
bool isBuyZhanLing = CelestialStarTowerModel.Instance.zhanLingInfoDict[3].isActivite > 0;
|
|
55 |
btnBuy.SetActiveIL(isBuyZhanLing ? false : true);
|
|
56 |
imgBuy.SetActiveIL(isBuyZhanLing);
|
|
57 |
OrderInfoConfig orderCfg;
|
|
58 |
vipModel.TryGetOrderInfo(CelestialStarTowerModel.Instance.ctgIdDict[3], out orderCfg);
|
|
59 |
txtBuy.text = Language.Get("PayMoneyNum", orderCfg.PayRMBNum);
|
0bd288
|
60 |
if (orgPrice != null)
|
H |
61 |
{
|
|
62 |
orgPrice.SetActiveIL(PlayerDatas.Instance.baseData.IsActive90Off);
|
47f4a5
|
63 |
orgPrice.text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat((int)orderCfg.m_PayRMBNum));
|
0bd288
|
64 |
}
|
H |
65 |
|
424eaa
|
66 |
txtProfitRatio.text = Language.Get("BlessedLand039", CTGConfig.Get(CelestialStarTowerModel.Instance.ctgIdDict[3]).Percentage);
|
a27c7f
|
67 |
}
|
H |
68 |
|
|
69 |
protected override void OnAfterOpen()
|
|
70 |
{
|
|
71 |
Initialize();
|
|
72 |
}
|
|
73 |
|
|
74 |
|
|
75 |
protected override void OnPreClose()
|
|
76 |
{
|
|
77 |
CelestialStarTowerModel.Instance.UpdateGiftStateEvent -= UpdateGiftStateEvent;
|
|
78 |
ModelCenter.Instance.GetModel<SkyTowerModel>().OnChallengeState -= OnFloorChangeEvent;
|
|
79 |
scroller.OnRefreshCell -= OnScrollerRefreshCell;
|
|
80 |
}
|
|
81 |
|
|
82 |
private void OnFloorChangeEvent()
|
|
83 |
{
|
|
84 |
if (CelestialStarTowerModel.Instance.zhanLingInfoDict == null ||!CelestialStarTowerModel.Instance.zhanLingInfoDict.ContainsKey(3))
|
|
85 |
return;
|
|
86 |
scroller.m_Scorller.RefreshActiveCellViews();
|
|
87 |
CelestialStarTowerModel.Instance.IsPlayAnimation = true;
|
|
88 |
}
|
|
89 |
|
|
90 |
private void UpdateGiftStateEvent()
|
|
91 |
{
|
|
92 |
scroller.m_Scorller.RefreshActiveCellViews();
|
|
93 |
bool isBuyZhanLing = CelestialStarTowerModel.Instance.zhanLingInfoDict[3].isActivite > 0;
|
|
94 |
btnBuy.SetActiveIL(!isBuyZhanLing);
|
|
95 |
imgBuy.SetActiveIL(isBuyZhanLing);
|
|
96 |
CelestialStarTowerModel.Instance.IsPlayAnimation = true;
|
|
97 |
}
|
|
98 |
|
|
99 |
private void OnScrollerRefreshCell(ScrollerDataType type, CellView cell)
|
|
100 |
{
|
|
101 |
var _cell = cell.GetILBehaviour<CelestialStarTowerCell>();
|
|
102 |
_cell.Display(cell.index);
|
|
103 |
CelestialStarTowerModel.Instance.IsPlayAnimation = true;
|
|
104 |
}
|
|
105 |
void Initialize()
|
|
106 |
{
|
|
107 |
List<int> cellList = ILZhanlingConfig.GetTypeToIDDict(3).Keys.ToList();
|
|
108 |
scroller.Refresh();
|
|
109 |
for (int i = 0; i < cellList.Count; i++)
|
|
110 |
{
|
|
111 |
scroller.AddCell(ScrollerDataType.Header, cellList[i]);
|
|
112 |
}
|
|
113 |
scroller.Restart();
|
|
114 |
scroller.JumpIndex(CelestialStarTowerModel.Instance.GetJumpStartIndex(3));
|
|
115 |
CelestialStarTowerModel.Instance.IsPlayAnimation = true;
|
|
116 |
}
|
|
117 |
|
|
118 |
}
|