少年修仙传客户端代码仓库
hch
3 天以前 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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Monday, January 28, 2019
//--------------------------------------------------------
 
using System;
using UnityEngine;
using UnityEngine.UI;
using vnxbqy.UI;
using System.Collections.Generic;
 
public class CrossServerBattleFieldBuyWin : ILWindow
{
    Button close;
    Button cancle;
    Button okBtn;
    List<ItemCell> itemsCell = new List<ItemCell>();
    Text title;
 
    public static int hour;
    public static int minute;
 
    PackModel packModel = ModelCenter.Instance.GetModelEx<PackModel>();
    #region Built-in
    protected override void BindController()
    {
        close = proxy.GetWidgtEx<Button>("CloseBtn");
        cancle = proxy.GetWidgtEx<Button>("cancel");
        okBtn = proxy.GetWidgtEx<Button>("ok");
        for (int i = 0; i < 4; i++)
        {
            itemsCell.Add(proxy.GetWidgtEx<ItemCell>("itemcell" + i));
        }
        title = proxy.GetWidgtEx<Text>("title");
    }
 
    protected override void AddListeners()
    {
        close.SetListener(()=> {
            WindowCenter.Instance.CloseIL<CrossServerBattleFieldBuyWin>();
        });
 
        cancle.SetListener(() => {
            WindowCenter.Instance.CloseIL<CrossServerBattleFieldBuyWin>();
        });
 
        okBtn.SetListener(() => {
            int count = packModel.GetItemCountByID(PackType.Item, ILCrossServerModel.Instance.callItemID);
            if (count == 0)
            {
                SysNotifyMgr.Instance.ShowTip("RealmLevelUpError_3");
                return;
            }
 
            int index = ILCrossServerModel.Instance.GetCurBattleFieldIndex();
            var int3Config = ILCrossServerModel.Instance.crossBattleFieldOpenTimes[index];
            var state = ILCrossServerModel.Instance.GetActionState(index);
            if (state != 1)
            {
                SysNotifyMgr.Instance.ShowTip("CrossBattlefieldBuyLimit");
                return;
            }
 
            var pack = new IL_CC109_tagCMCrossBattlefieldBuyOpen();
            pack.Hour = (byte)hour;
            pack.Minute = (byte)minute;
            GameNetSystem.Instance.SendInfo(pack);
 
            WindowCenter.Instance.CloseIL<CrossServerBattleFieldBuyWin>();
        });
 
    }
 
    protected override void OnPreOpen()
    {
        for (int i = 0; i < itemsCell.Count; i++)
        {
            if (i < ILCrossServerModel.Instance.callAward.Length)
            {
                itemsCell[i].SetActiveIL(true);
               
                var itemId = ILCrossServerModel.Instance.callAward[i][0];
                var model = new ItemCellModel(itemId, false, (ulong)ILCrossServerModel.Instance.callAward[i][1]);
                itemsCell[i].Init(model);
                itemsCell[i].auctionIcon.SetActiveIL(ILCrossServerModel.Instance.callAward[i][2] != 0);
                itemsCell[i].button.SetListener(() =>
                {
                    ItemTipUtility.Show(itemId);
                });
            }
            else
            {
                itemsCell[i].SetActiveIL(false);
            }
        }
        title.text = Language.Get("CrossBattleField53");
    }
 
    #endregion
 
 
}