少年修仙传客户端代码仓库
hch
2 天以前 600733c8f592cb9e65f2b7a3e110ac1d686e6bfe
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Friday, March 01, 2019
//--------------------------------------------------------
 
using LitJson;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace vnxbqy.UI
{
 
    public class SuperPushWin : Window
    {
        [SerializeField] Button closeBtn;
        [SerializeField] Button buyBtn;
        [SerializeField] Text priceText;
        [SerializeField] Image buyYetImg;
        [SerializeField] Text infoText;
        [SerializeField] List<ItemCell> awardObjs = new List<ItemCell>();
 
        TextEx orgPrice;
 
        VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
        PushCoinModel model { get { return ModelCenter.Instance.GetModel<PushCoinModel>(); } }
 
 
        #region Built-in
 
        protected override void BindController()
        {
            var obj = buyBtn.FindComponent("Text", "Txt_orgPrice");
            if (obj != null)
                orgPrice = obj as TextEx;
        }
 
        protected override void AddListeners()
        {
            closeBtn.AddListener(() => { CloseImmediately(); });
 
            buyBtn.AddListener(() => {
                vipModel.CTG(model.ctgID);
            });
        }
 
        protected override void OnPreOpen()
        {
            vipModel.rechargeCountEvent += VipModel_rechargeCountEvent;
            ShowBtn();
            infoText.text = Language.Get("PushCoinRule1", model.superPushGiftGoinInfo[0], model.superPushGiftGoinInfo[1]);
 
            List<Item> itemList;
            vipModel.TryGetRechargeItem(model.ctgID, out itemList);
            for (int i = 0; i < awardObjs.Count; i++)
            {
                if (i < itemList.Count)
                {
                    awardObjs[i].SetActive(true);
                    var itemId = itemList[i].id;
                    var model = new ItemCellModel(itemId, false, (ulong)itemList[i].count);
                    awardObjs[i].Init(model);
                    awardObjs[i].button.SetListener(() =>
                    {
                        ItemTipUtility.Show(itemId);
                    });
                }
                else
                {
                    awardObjs[i].SetActiveIL(false);
                }
            }
        }
 
        private void VipModel_rechargeCountEvent(int obj)
        {
            ShowBtn();
            if (obj == model.ctgID)
            {
                Clock.AlarmAfter(0.5f, () =>
                {
                    CloseImmediately();
                    WindowCenter.Instance.Open<PushCoinWin>();
                    SysNotifyMgr.Instance.ShowTip("SuperPush");
                });
            }
        }
 
        protected override void OnActived()
        {
 
        }
 
        protected override void OnAfterOpen()
        {
        }
 
        protected override void OnPreClose()
        {
            vipModel.rechargeCountEvent -= VipModel_rechargeCountEvent;
        }
 
        protected override void OnAfterClose()
        {
        }
 
 
        #endregion
 
 
        void ShowBtn()
        {
            VipModel.RechargeCount rechargeCount;
            vipModel.TryGetRechargeCount(model.ctgID, out rechargeCount);
            if (rechargeCount.totalCount > 0)
            {
                buyBtn.SetActive(false);
                buyYetImg.SetActive(true);
            }
            else
            {
                buyBtn.SetActive(true);
                buyYetImg.SetActive(false);
 
                OrderInfoConfig config;
                vipModel.TryGetOrderInfo(model.ctgID, out config);
                priceText.text = Language.Get("PayMoneyNum", config.PayRMBNum);
                if (orgPrice != null)
                {
                    orgPrice.SetActiveIL(PlayerDatas.Instance.baseData.IsActive90Off);
                    orgPrice.text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat(config.m_PayRMBNum));
                }
            }
        }
    }
 
}