aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/UIControl_LeaderboardList.cpp
blob: 3920e00400690d7dd5355b9a901b3f9cc189515a (plain)
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
#include "stdafx.h"
#include "UI.h"
#include "UIControl_LeaderboardList.h"

UIControl_LeaderboardList::UIControl_LeaderboardList()
{
}

bool UIControl_LeaderboardList::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName)
{
	UIControl::setControlType(UIControl::eLeaderboardList);
	bool success = UIControl_Base::setupControl(scene,parent,controlName);

	//UIControl_LeaderboardList specific initialisers
	m_funcInitLeaderboard = registerFastName(L"InitLeaderboard");
	m_funcAddDataSet = registerFastName(L"AddDataSet");
	m_funcResetLeaderboard = registerFastName(L"ResetLeaderboard");
	m_funcSetupTitles = registerFastName(L"SetupTitles");
	m_funcSetColumnIcon = registerFastName(L"SetColumnIcon");
#ifdef __PSVITA__
	m_funcSetTouchFocus = registerFastName(L"SetTouchFocus");
	m_bTouchInitialised = false;
#endif

	return success;
}

void UIControl_LeaderboardList::init(int id)
{
	m_id = id;

	IggyDataValue result;
	IggyDataValue value[1];
	value[0].type = IGGY_DATATYPE_number;
	value[0].number = id;
	IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 1 , value );
}

void UIControl_LeaderboardList::ReInit()
{
	UIControl_Base::ReInit();
	init(m_id);
}

void UIControl_LeaderboardList::clearList()
{
	IggyDataValue result;
	IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcResetLeaderboard , 0 , nullptr );
}

void UIControl_LeaderboardList::setupTitles(const wstring &rank, const wstring &gamertag)
{
	IggyDataValue result;
	IggyDataValue value[2];

	IggyStringUTF16 stringVal0;
	stringVal0.string = (IggyUTF16*)rank.c_str();
	stringVal0.length = rank.length();
	value[0].type = IGGY_DATATYPE_string_UTF16;
	value[0].string16 = stringVal0;

	IggyStringUTF16 stringVal1;
	stringVal1.string = (IggyUTF16*)gamertag.c_str();
	stringVal1.length = gamertag.length();
	value[1].type = IGGY_DATATYPE_string_UTF16;
	value[1].string16 = stringVal1;

	IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSetupTitles , 2 , value );
}

void UIControl_LeaderboardList::initLeaderboard(int iFirstFocus, int iTotalEntries, int iNumColumns)
{
	IggyDataValue result;
	IggyDataValue value[3];
	value[0].type = IGGY_DATATYPE_number;
	value[0].number = iFirstFocus;

	value[1].type = IGGY_DATATYPE_number;
	value[1].number = iTotalEntries;

	value[2].type = IGGY_DATATYPE_number;
	value[2].number = iNumColumns;
	IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcInitLeaderboard , 3 , value );

#ifdef __PSVITA__
	// 4J-PB - add this button to the vita touch box list
	if(!m_bTouchInitialised)
	{
		switch(m_parentScene->GetParentLayer()->m_iLayer)
		{
		case eUILayer_Fullscreen:
		case eUILayer_Scene:
			ui.TouchBoxAdd(this,m_parentScene);
			break;
		}
		m_bTouchInitialised = true;
	}
#endif
}

void UIControl_LeaderboardList::setColumnIcon(int iColumn, int iType)
{
	IggyDataValue result;
	IggyDataValue value[2];
	value[0].type = IGGY_DATATYPE_number;
	value[0].number = iColumn;

	value[1].type = IGGY_DATATYPE_number;
	value[1].number = (iType<=32000)?0:(iType-32000);

	IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSetColumnIcon , 2 , value );
}

void UIControl_LeaderboardList::addDataSet(bool bLast, int iId, int iRank, const wstring &gamertag, bool bDisplayMessage, const wstring &col0, const wstring &col1, const wstring &col2, const wstring &col3, const wstring &col4, const wstring &col5, const wstring &col6)
{
	IggyDataValue result;
	IggyDataValue value[12];

	value[0].type = IGGY_DATATYPE_boolean;
	value[0].boolval = bLast;

	value[1].type = IGGY_DATATYPE_number;
	value[1].number = iId;

	value[2].type = IGGY_DATATYPE_number;
	value[2].number = iRank;

	IggyStringUTF16 stringVal0;
	stringVal0.string = (IggyUTF16*)gamertag.c_str();
	stringVal0.length = gamertag.length();
	value[3].type = IGGY_DATATYPE_string_UTF16;
	value[3].string16 = stringVal0;

	value[4].type = IGGY_DATATYPE_boolean;
	value[4].boolval = bDisplayMessage;

	IggyStringUTF16 stringVal1;
	stringVal1.string = (IggyUTF16*)col0.c_str();
	stringVal1.length = col0.length();
	value[5].type = IGGY_DATATYPE_string_UTF16;
	value[5].string16 = stringVal1;

	if(col1.empty())
	{
		value[6].type = IGGY_DATATYPE_null;
	}
	else
	{
		IggyStringUTF16 stringVal2;
		stringVal2.string = (IggyUTF16*)col1.c_str();
		stringVal2.length = col1.length();
		value[6].type = IGGY_DATATYPE_string_UTF16;
		value[6].string16 = stringVal2;
	}

	if(col2.empty())
	{
		value[7].type = IGGY_DATATYPE_null;
	}
	else
	{
		IggyStringUTF16 stringVal3;
		stringVal3.string = (IggyUTF16*)col2.c_str();
		stringVal3.length = col2.length();
		value[7].type = IGGY_DATATYPE_string_UTF16;
		value[7].string16 = stringVal3;
	}

	if(col3.empty())
	{
		value[8].type = IGGY_DATATYPE_null;
	}
	else
	{
		IggyStringUTF16 stringVal4;
		stringVal4.string = (IggyUTF16*)col3.c_str();
		stringVal4.length = col3.length();
		value[8].type = IGGY_DATATYPE_string_UTF16;
		value[8].string16 = stringVal4;
	}

	if(col4.empty())
	{
		value[9].type = IGGY_DATATYPE_null;
	}
	else
	{
		IggyStringUTF16 stringVal5;
		stringVal5.string = (IggyUTF16*)col4.c_str();
		stringVal5.length = col4.length();
		value[9].type = IGGY_DATATYPE_string_UTF16;
		value[9].string16 = stringVal5;
	}

	if(col5.empty())
	{
		value[10].type = IGGY_DATATYPE_null;
	}
	else
	{
		IggyStringUTF16 stringVal6;
		stringVal6.string = (IggyUTF16*)col5.c_str();
		stringVal6.length = col5.length();
		value[10].type = IGGY_DATATYPE_string_UTF16;
		value[10].string16 = stringVal6;
	}

	if(col6.empty())
	{
		value[11].type = IGGY_DATATYPE_null;
	}
	else
	{
		IggyStringUTF16 stringVal7;
		stringVal7.string = (IggyUTF16*)col6.c_str();
		stringVal7.length = col6.length();
		value[11].type = IGGY_DATATYPE_string_UTF16;
		value[11].string16 = stringVal7;
	}
	IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcAddDataSet , 12 , value );
}

#ifdef __PSVITA__
void UIControl_LeaderboardList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat)
{
	IggyDataValue result;
	IggyDataValue value[3];

	value[0].type = IGGY_DATATYPE_number;
	value[0].number = iX;
	value[1].type = IGGY_DATATYPE_number;
	value[1].number = iY;
	value[2].type = IGGY_DATATYPE_boolean;
	value[2].boolval = bRepeat;

	IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetTouchFocus, 3 , value );
}
#endif