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
|
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XUpdater;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class XWelfareGrowthFundHandler : DlgHandlerBase
{
protected override string FileName
{
get
{
return "GameSystem/Welfare/GrowthFund";
}
}
private IXUIScrollView m_ScrollView;
private IXUIList m_ItemGrid;
private List<WelfareGrowthFundItem> m_ItemList;
private Transform m_ItemTemp;
private IXUISprite m_hasBuySprite;
private IXUIButton m_rechargeBtn;
private XWelfareDocument _Doc;
protected override void Init()
{
base.Init();
this._Doc = XDocuments.GetSpecificDocument<XWelfareDocument>(XWelfareDocument.uuID);
this.m_ScrollView = (base.FindInChild("XUIScrollView", "ScrollView") as IXUIScrollView);
this.m_ItemGrid = (base.FindInChild("XUIList", "ScrollView/Grid") as IXUIList);
this.m_ItemTemp = base.FindChild("ScrollView/Grid/ItemTpl");
this.m_ItemTemp.gameObject.SetActive(false);
this.m_rechargeBtn = (base.FindInChild("XUIButton", "ScrollView/Grid/Recharge/Recharge") as IXUIButton);
this.m_hasBuySprite = (base.FindInChild("XUISprite", "ScrollView/Grid/Recharge/HasBuy") as IXUISprite);
this.m_rechargeBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickRechargeHandler));
this.InitWelfreGrowthList();
}
private bool OnClickRechargeHandler(IXUIButton btn)
{
RechargeTable.RowData rowData;
bool flag = this._Doc.TryGetGrowthFundConf(XSysDefine.XSys_Welfare_StarFund, out rowData);
if (flag)
{
XRechargeDocument specificDocument = XDocuments.GetSpecificDocument<XRechargeDocument>(XRechargeDocument.uuID);
bool flag2 = XSingleton<XUpdater.XUpdater>.singleton.XPlatform.Platfrom() == XPlatformType.Android;
if (flag2)
{
specificDocument.SDKSubscribe(rowData.Price, 1, rowData.ServiceCode, rowData.Name, rowData.ParamID, PayParamType.PAY_PARAM_GROWTH_FUND);
}
else
{
bool flag3 = XSingleton<XUpdater.XUpdater>.singleton.XPlatform.Platfrom() == XPlatformType.IOS;
if (flag3)
{
int @int = XSingleton<XGlobalConfig>.singleton.GetInt("WelfareGrowthFundDays");
specificDocument.SDKSubscribe(rowData.Price, @int, rowData.ServiceCode, rowData.Name, rowData.ParamID, PayParamType.PAY_PARAM_GROWTH_FUND);
}
}
}
return true;
}
private void InitWelfreGrowthList()
{
this.m_ItemList = new List<WelfareGrowthFundItem>();
RechargeTable.RowData rowData;
bool flag = this._Doc.TryGetGrowthFundConf(XSysDefine.XSys_Welfare_StarFund, out rowData);
if (flag)
{
WelfareGrowthFundItem welfareGrowthFundItem = this.CreateGrowthFundItem();
welfareGrowthFundItem.Set(0, 0, rowData.Diamond);
int i = 0;
int count = rowData.RoleLevels.Count;
while (i < count)
{
welfareGrowthFundItem = this.CreateGrowthFundItem();
welfareGrowthFundItem.Set(1, rowData.RoleLevels[i, 0], rowData.RoleLevels[i, 1]);
i++;
}
i = 0;
count = rowData.LoginDays.Count;
while (i < count)
{
welfareGrowthFundItem = this.CreateGrowthFundItem();
welfareGrowthFundItem.Set(2, rowData.LoginDays[i, 0], rowData.LoginDays[i, 1]);
i++;
}
}
}
private WelfareGrowthFundItem CreateGrowthFundItem()
{
GameObject gameObject = XCommon.Instantiate<GameObject>(this.m_ItemTemp.gameObject);
gameObject.transform.parent = this.m_ItemGrid.gameObject.transform;
gameObject.transform.localScale = Vector2.one;
gameObject.name = this.m_ItemList.Count.ToString();
WelfareGrowthFundItem welfareGrowthFundItem = new WelfareGrowthFundItem();
gameObject.SetActive(true);
welfareGrowthFundItem.Init(gameObject.transform);
this.m_ItemList.Add(welfareGrowthFundItem);
return welfareGrowthFundItem;
}
public override void RefreshData()
{
base.RefreshData();
this.RefreshRechargeHandler();
bool flag = this.m_ItemList == null;
if (!flag)
{
int i = 0;
int count = this.m_ItemList.Count;
while (i < count)
{
this.m_ItemList[i].Refresh();
i++;
}
}
}
private void RefreshRechargeHandler()
{
this.m_rechargeBtn.SetVisible(!this._Doc.HasBuyGrowthFund);
this.m_hasBuySprite.SetVisible(this._Doc.HasBuyGrowthFund);
}
}
}
|