the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 238 lines 6.6 kB view raw
1#include "stdafx.h" 2#include "UI.h" 3#include "UIControl_LeaderboardList.h" 4 5UIControl_LeaderboardList::UIControl_LeaderboardList() 6{ 7} 8 9bool UIControl_LeaderboardList::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName) 10{ 11 UIControl::setControlType(UIControl::eLeaderboardList); 12 bool success = UIControl_Base::setupControl(scene,parent,controlName); 13 14 //UIControl_LeaderboardList specific initialisers 15 m_funcInitLeaderboard = registerFastName(L"InitLeaderboard"); 16 m_funcAddDataSet = registerFastName(L"AddDataSet"); 17 m_funcResetLeaderboard = registerFastName(L"ResetLeaderboard"); 18 m_funcSetupTitles = registerFastName(L"SetupTitles"); 19 m_funcSetColumnIcon = registerFastName(L"SetColumnIcon"); 20#ifdef __PSVITA__ 21 m_funcSetTouchFocus = registerFastName(L"SetTouchFocus"); 22 m_bTouchInitialised = false; 23#endif 24 25 return success; 26} 27 28void UIControl_LeaderboardList::init(int id) 29{ 30 m_id = id; 31 32 IggyDataValue result; 33 IggyDataValue value[1]; 34 value[0].type = IGGY_DATATYPE_number; 35 value[0].number = id; 36 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 1 , value ); 37} 38 39void UIControl_LeaderboardList::ReInit() 40{ 41 UIControl_Base::ReInit(); 42 init(m_id); 43} 44 45void UIControl_LeaderboardList::clearList() 46{ 47 IggyDataValue result; 48 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcResetLeaderboard , 0 , NULL ); 49} 50 51void UIControl_LeaderboardList::setupTitles(const wstring &rank, const wstring &gamertag) 52{ 53 IggyDataValue result; 54 IggyDataValue value[2]; 55 56 IggyStringUTF16 stringVal0; 57 stringVal0.string = (IggyUTF16*)rank.c_str(); 58 stringVal0.length = rank.length(); 59 value[0].type = IGGY_DATATYPE_string_UTF16; 60 value[0].string16 = stringVal0; 61 62 IggyStringUTF16 stringVal1; 63 stringVal1.string = (IggyUTF16*)gamertag.c_str(); 64 stringVal1.length = gamertag.length(); 65 value[1].type = IGGY_DATATYPE_string_UTF16; 66 value[1].string16 = stringVal1; 67 68 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSetupTitles , 2 , value ); 69} 70 71void UIControl_LeaderboardList::initLeaderboard(int iFirstFocus, int iTotalEntries, int iNumColumns) 72{ 73 IggyDataValue result; 74 IggyDataValue value[3]; 75 value[0].type = IGGY_DATATYPE_number; 76 value[0].number = iFirstFocus; 77 78 value[1].type = IGGY_DATATYPE_number; 79 value[1].number = iTotalEntries; 80 81 value[2].type = IGGY_DATATYPE_number; 82 value[2].number = iNumColumns; 83 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcInitLeaderboard , 3 , value ); 84 85#ifdef __PSVITA__ 86 // 4J-PB - add this button to the vita touch box list 87 if(!m_bTouchInitialised) 88 { 89 switch(m_parentScene->GetParentLayer()->m_iLayer) 90 { 91 case eUILayer_Fullscreen: 92 case eUILayer_Scene: 93 ui.TouchBoxAdd(this,m_parentScene); 94 break; 95 } 96 m_bTouchInitialised = true; 97 } 98#endif 99} 100 101void UIControl_LeaderboardList::setColumnIcon(int iColumn, int iType) 102{ 103 IggyDataValue result; 104 IggyDataValue value[2]; 105 value[0].type = IGGY_DATATYPE_number; 106 value[0].number = iColumn; 107 108 value[1].type = IGGY_DATATYPE_number; 109 value[1].number = (iType<=32000)?0:(iType-32000); 110 111 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcSetColumnIcon , 2 , value ); 112} 113 114void 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) 115{ 116 IggyDataValue result; 117 IggyDataValue value[12]; 118 119 value[0].type = IGGY_DATATYPE_boolean; 120 value[0].boolval = bLast; 121 122 value[1].type = IGGY_DATATYPE_number; 123 value[1].number = iId; 124 125 value[2].type = IGGY_DATATYPE_number; 126 value[2].number = iRank; 127 128 IggyStringUTF16 stringVal0; 129 stringVal0.string = (IggyUTF16*)gamertag.c_str(); 130 stringVal0.length = gamertag.length(); 131 value[3].type = IGGY_DATATYPE_string_UTF16; 132 value[3].string16 = stringVal0; 133 134 value[4].type = IGGY_DATATYPE_boolean; 135 value[4].boolval = bDisplayMessage; 136 137 IggyStringUTF16 stringVal1; 138 stringVal1.string = (IggyUTF16*)col0.c_str(); 139 stringVal1.length = col0.length(); 140 value[5].type = IGGY_DATATYPE_string_UTF16; 141 value[5].string16 = stringVal1; 142 143 if(col1.empty()) 144 { 145 value[6].type = IGGY_DATATYPE_null; 146 } 147 else 148 { 149 IggyStringUTF16 stringVal2; 150 stringVal2.string = (IggyUTF16*)col1.c_str(); 151 stringVal2.length = col1.length(); 152 value[6].type = IGGY_DATATYPE_string_UTF16; 153 value[6].string16 = stringVal2; 154 } 155 156 if(col2.empty()) 157 { 158 value[7].type = IGGY_DATATYPE_null; 159 } 160 else 161 { 162 IggyStringUTF16 stringVal3; 163 stringVal3.string = (IggyUTF16*)col2.c_str(); 164 stringVal3.length = col2.length(); 165 value[7].type = IGGY_DATATYPE_string_UTF16; 166 value[7].string16 = stringVal3; 167 } 168 169 if(col3.empty()) 170 { 171 value[8].type = IGGY_DATATYPE_null; 172 } 173 else 174 { 175 IggyStringUTF16 stringVal4; 176 stringVal4.string = (IggyUTF16*)col3.c_str(); 177 stringVal4.length = col3.length(); 178 value[8].type = IGGY_DATATYPE_string_UTF16; 179 value[8].string16 = stringVal4; 180 } 181 182 if(col4.empty()) 183 { 184 value[9].type = IGGY_DATATYPE_null; 185 } 186 else 187 { 188 IggyStringUTF16 stringVal5; 189 stringVal5.string = (IggyUTF16*)col4.c_str(); 190 stringVal5.length = col4.length(); 191 value[9].type = IGGY_DATATYPE_string_UTF16; 192 value[9].string16 = stringVal5; 193 } 194 195 if(col5.empty()) 196 { 197 value[10].type = IGGY_DATATYPE_null; 198 } 199 else 200 { 201 IggyStringUTF16 stringVal6; 202 stringVal6.string = (IggyUTF16*)col5.c_str(); 203 stringVal6.length = col5.length(); 204 value[10].type = IGGY_DATATYPE_string_UTF16; 205 value[10].string16 = stringVal6; 206 } 207 208 if(col6.empty()) 209 { 210 value[11].type = IGGY_DATATYPE_null; 211 } 212 else 213 { 214 IggyStringUTF16 stringVal7; 215 stringVal7.string = (IggyUTF16*)col6.c_str(); 216 stringVal7.length = col6.length(); 217 value[11].type = IGGY_DATATYPE_string_UTF16; 218 value[11].string16 = stringVal7; 219 } 220 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath(), m_funcAddDataSet , 12 , value ); 221} 222 223#ifdef __PSVITA__ 224void UIControl_LeaderboardList::SetTouchFocus(S32 iX, S32 iY, bool bRepeat) 225{ 226 IggyDataValue result; 227 IggyDataValue value[3]; 228 229 value[0].type = IGGY_DATATYPE_number; 230 value[0].number = iX; 231 value[1].type = IGGY_DATATYPE_number; 232 value[1].number = iY; 233 value[2].type = IGGY_DATATYPE_boolean; 234 value[2].boolval = bRepeat; 235 236 IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcSetTouchFocus, 3 , value ); 237} 238#endif