少年修仙传客户端代码仓库
hch
1 天以前 a698ff62441e3c89b26d825921ef6b031bf864d4
提交 | 用户 | age
b0181f 1 //--------------------------------------------------------
H 2 //    [Author]:           第二世界
3 //    [  Date ]:           Tuesday, June 11, 2019
4 //--------------------------------------------------------
5
6 using System;
7 using System.Collections;
8 using System.Collections.Generic;
9 using System.Reflection;
10 using UnityEngine;
11 using UnityEngine.UI;
12
13 namespace vnxbqy.UI
14 {
15
16     public class ForeverCardWin : Window
17     {
18         [SerializeField] Button m_Invest;
19         [SerializeField] Text m_Price;
da57a0 20         [SerializeField] Text m_Process;
b0181f 21         [SerializeField] Button m_Get;
H 22         [SerializeField] Image m_State;
23         [SerializeField] Button m_Close;
24
77f18d 25         [SerializeField] List<ItemCell> itemCellList;
b0181f 26
da57a0 27         VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
H 28         
b0181f 29         #region Built-in
H 30         protected override void BindController()
31         {
32         }
33
34         protected override void AddListeners()
35         {
36             m_Invest.AddListener(OnInvest);
37             m_Close.AddListener(CloseClick);
38             m_Get.AddListener(() => {
39                 var ids = InvestModel.Instance.GetIdsByType(InvestModel.foreverCardType);
40                 InvestModel.Instance.SendGetReward(InvestModel.foreverCardType, ids[0]);
41             });
42         }
43
44         protected override void OnPreOpen()
45         {
46             InvestModel.Instance.onInvestUpdate += Display;
47         }
48
49         protected override void OnActived()
50         {
51             Display();
52
53         }
54
55         protected override void OnAfterOpen()
56         {
57         }
58
59         protected override void OnPreClose()
60         {
61             InvestModel.Instance.onInvestUpdate -= Display;
62         }
63
64         protected override void OnAfterClose()
65         {
66         }
67         #endregion
68
69         void Display()
70         {
71             var ids = InvestModel.Instance.GetIdsByType(InvestModel.foreverCardType);
72             var state = InvestModel.Instance.GetSingleInvestState(InvestModel.foreverCardType, ids[0]);
73
74             m_Invest.SetActive(state == 0);
75             m_Get.SetActive(state == 2);
76             m_State.SetActive(state == 3);
da57a0 77             int needMoney = InvestModel.Instance.rechargeSumDict[InvestModel.foreverCardType] / 10000;
H 78             m_Price.text = Language.Get("ForeverCard6", needMoney);
a698ff 79             m_Process.text = Language.Get("ForeverCard7", UIHelper.GetMoneyFormat( vipModel.realRecharge / 10000.0), needMoney);
b0181f 80
77f18d 81             for (int i = 0; i < itemCellList.Count; i++)
H 82             {
83                 List<ItemEx> awards = new List<ItemEx>();
84                 InvestModel.Instance.TryGetItems(12, 1200, out awards);
85                 if (i < awards.Count)
86                 {
87                     itemCellList[i].SetActiveIL(true);
88                     var itemId = awards[i].id;
89                     var model = new ItemCellModel(itemId, false, (ulong)awards[i].count);
90                     itemCellList[i].Init(model);
91                     itemCellList[i].auctionIcon.SetActiveIL(awards[i].bind != 0);
92                     itemCellList[i].button.SetListener(() =>
93                     {
94                         ItemTipUtility.Show(itemId);
95                     });
96                 }
97                 else
98                 {
99                     itemCellList[i].SetActiveIL(false);
100                 }
101             }
b0181f 102         }
H 103
104  
105         private void OnInvest()
106         {
a698ff 107             if (vipModel.realRecharge < InvestModel.Instance.rechargeSumDict[InvestModel.foreverCardType])
H 108             {
109                 WindowJumpMgr.Instance.WindowJumpToEx("VipRechargeWin");
110                 return;
111             }
112
da57a0 113             CA540_tagCMGoldInvest investGold = new CA540_tagCMGoldInvest();
H 114             investGold.InvestType = 12;
115             GameNetSystem.Instance.SendInfo(investGold);
b0181f 116         }
H 117
118
119  
120
121
122     }
123 }
124
125
126
127