the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 596 lines 18 kB view raw
1#include "stdafx.h" 2#include "UI.h" 3#include "UIScene_JoinMenu.h" 4#include "..\..\Minecraft.h" 5#include "..\..\TexturePackRepository.h" 6#include "..\..\Options.h" 7#include "..\..\MinecraftServer.h" 8#include "..\..\..\Minecraft.World\net.minecraft.world.level.h" 9#include "..\..\..\Minecraft.World\net.minecraft.world.h" 10 11#define UPDATE_PLAYERS_TIMER_ID 0 12#define UPDATE_PLAYERS_TIMER_TIME 30000 13 14UIScene_JoinMenu::UIScene_JoinMenu(int iPad, void *_initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) 15{ 16 // Setup all the Iggy references we need for this scene 17 initialiseMovie(); 18 19 JoinMenuInitData *initData = (JoinMenuInitData *)_initData; 20 m_selectedSession = initData->selectedSession; 21 m_friendInfoUpdatedOK = false; 22 m_friendInfoUpdatedERROR = false; 23 m_friendInfoRequestIssued = false; 24} 25 26void UIScene_JoinMenu::updateTooltips() 27{ 28 int iA = -1; 29 int iY = -1; 30 if (getControlFocus() == eControl_GamePlayers) 31 { 32#ifdef _DURANGO 33 iY = IDS_TOOLTIPS_VIEW_GAMERCARD; 34#endif 35 } 36 else 37 { 38 iA = IDS_TOOLTIPS_SELECT; 39 } 40 41 ui.SetTooltips( DEFAULT_XUI_MENU_USER, iA, IDS_TOOLTIPS_BACK, -1, iY ); 42 43} 44 45void UIScene_JoinMenu::tick() 46{ 47 if( !m_friendInfoRequestIssued ) 48 { 49 ui.NavigateToScene(m_iPad, eUIScene_Timer); 50 g_NetworkManager.GetFullFriendSessionInfo(m_selectedSession, &friendSessionUpdated, this); 51 m_friendInfoRequestIssued = true; 52 } 53 54 if( m_friendInfoUpdatedOK ) 55 { 56 m_friendInfoUpdatedOK = false; 57 58 m_buttonJoinGame.init(app.GetString(IDS_JOIN_GAME),eControl_JoinGame); 59 60 m_buttonListPlayers.init(eControl_GamePlayers); 61 62#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ 63 for( int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++ ) 64 { 65 if( m_selectedSession->data.players[i] != NULL ) 66 { 67 #ifndef _CONTENT_PACKAGE 68 if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_DebugLeaderboards))) 69 { 70 m_buttonListPlayers.addItem(L"WWWWWWWWWWWWWWWW"); 71 } 72 else 73 #endif 74 { 75 string playerName(m_selectedSession->data.players[i].getOnlineID()); 76 77 #ifndef __PSVITA__ 78 // Append guest number (any players in an online game not signed into PSN are guests) 79 if( m_selectedSession->data.players[i].isSignedIntoPSN() == false ) 80 { 81 char suffix[5]; 82 sprintf(suffix, " (%d)", m_selectedSession->data.players[i].getQuadrant() + 1); 83 playerName.append(suffix); 84 } 85 #endif 86 m_buttonListPlayers.addItem(playerName); 87 } 88 } 89 else 90 { 91 // Leave the loop when we hit the first NULL player 92 break; 93 } 94 } 95#elif defined(_DURANGO) 96 for( int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; i++ ) 97 { 98 if ( m_selectedSession->searchResult.m_playerNames[i].size() ) 99 { 100 m_buttonListPlayers.addItem(m_selectedSession->searchResult.m_playerNames[i]); 101 } 102 else 103 { 104 // Leave the loop when we hit the first empty player name 105 break; 106 } 107 } 108#endif 109 110 m_labelLabels[eLabel_Difficulty].init(app.GetString(IDS_LABEL_DIFFICULTY)); 111 m_labelLabels[eLabel_GameType].init(app.GetString(IDS_LABEL_GAME_TYPE)); 112 m_labelLabels[eLabel_GamertagsOn].init(app.GetString(IDS_LABEL_GAMERTAGS)); 113 m_labelLabels[eLabel_Structures].init(app.GetString(IDS_LABEL_STRUCTURES)); 114 m_labelLabels[eLabel_LevelType].init(app.GetString(IDS_LABEL_LEVEL_TYPE)); 115 m_labelLabels[eLabel_PVP].init(app.GetString(IDS_LABEL_PvP)); 116 m_labelLabels[eLabel_Trust].init(app.GetString(IDS_LABEL_TRUST)); 117 m_labelLabels[eLabel_TNTOn].init(app.GetString(IDS_LABEL_TNT)); 118 m_labelLabels[eLabel_FireOn].init(app.GetString(IDS_LABEL_FIRE_SPREADS)); 119 120 unsigned int uiGameHostSettings = m_selectedSession->data.m_uiGameHostSettings; 121 switch(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_Difficulty)) 122 { 123 case Difficulty::EASY: 124 m_labelValues[eLabel_Difficulty].init( app.GetString(IDS_DIFFICULTY_TITLE_EASY) ); 125 break; 126 case Difficulty::NORMAL: 127 m_labelValues[eLabel_Difficulty].init( app.GetString(IDS_DIFFICULTY_TITLE_NORMAL) ); 128 break; 129 case Difficulty::HARD: 130 m_labelValues[eLabel_Difficulty].init( app.GetString(IDS_DIFFICULTY_TITLE_HARD) ); 131 break; 132 case Difficulty::PEACEFUL: 133 default: 134 m_labelValues[eLabel_Difficulty].init( app.GetString(IDS_DIFFICULTY_TITLE_PEACEFUL) ); 135 break; 136 } 137 138 int option = app.GetGameHostOption(uiGameHostSettings,eGameHostOption_GameType); 139 if(option == GameType::CREATIVE->getId()) 140 { 141 m_labelValues[eLabel_GameType].init( app.GetString(IDS_CREATIVE) ); 142 } 143 else if(option == GameType::ADVENTURE->getId()) 144 { 145 m_labelValues[eLabel_GameType].init( app.GetString(IDS_ADVENTURE) ); 146 } 147 else 148 { 149 m_labelValues[eLabel_GameType].init( app.GetString(IDS_SURVIVAL) ); 150 } 151 152 if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_Gamertags)) m_labelValues[eLabel_GamertagsOn].init( app.GetString(IDS_ON) ); 153 else m_labelValues[eLabel_GamertagsOn].init( app.GetString(IDS_OFF) ); 154 155 if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_Structures)) m_labelValues[eLabel_Structures].init( app.GetString(IDS_ON) ); 156 else m_labelValues[eLabel_Structures].init( app.GetString(IDS_OFF) ); 157 158 if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_LevelType)) m_labelValues[eLabel_LevelType].init( app.GetString(IDS_LEVELTYPE_SUPERFLAT) ); 159 else m_labelValues[eLabel_LevelType].init( app.GetString(IDS_LEVELTYPE_NORMAL) ); 160 161 if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_PvP))m_labelValues[eLabel_PVP].init( app.GetString(IDS_ON) ); 162 else m_labelValues[eLabel_PVP].init( app.GetString(IDS_OFF) ); 163 164 if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_TrustPlayers)) m_labelValues[eLabel_Trust].init( app.GetString(IDS_ON) ); 165 else m_labelValues[eLabel_Trust].init( app.GetString(IDS_OFF) ); 166 167 if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_TNT)) m_labelValues[eLabel_TNTOn].init( app.GetString(IDS_ON) ); 168 else m_labelValues[eLabel_TNTOn].init( app.GetString(IDS_OFF) ); 169 170 if(app.GetGameHostOption(uiGameHostSettings,eGameHostOption_FireSpreads)) m_labelValues[eLabel_FireOn].init( app.GetString(IDS_ON) ); 171 else m_labelValues[eLabel_FireOn].init( app.GetString(IDS_OFF) ); 172 173 m_bIgnoreInput = false; 174 175 // Alert the app the we want to be informed of ethernet connections 176 app.SetLiveLinkRequired( true ); 177 178 TelemetryManager->RecordMenuShown(m_iPad, eUIScene_JoinMenu, 0); 179 180 addTimer(UPDATE_PLAYERS_TIMER_ID,UPDATE_PLAYERS_TIMER_TIME); 181 } 182 183 if( m_friendInfoUpdatedERROR ) 184 { 185 m_buttonJoinGame.init(app.GetString(IDS_JOIN_GAME),eControl_JoinGame); 186 187 m_buttonListPlayers.init(eControl_GamePlayers); 188 189 m_labelLabels[eLabel_Difficulty].init(app.GetString(IDS_LABEL_DIFFICULTY)); 190 m_labelLabels[eLabel_GameType].init(app.GetString(IDS_LABEL_GAME_TYPE)); 191 m_labelLabels[eLabel_GamertagsOn].init(app.GetString(IDS_LABEL_GAMERTAGS)); 192 m_labelLabels[eLabel_Structures].init(app.GetString(IDS_LABEL_STRUCTURES)); 193 m_labelLabels[eLabel_LevelType].init(app.GetString(IDS_LABEL_LEVEL_TYPE)); 194 m_labelLabels[eLabel_PVP].init(app.GetString(IDS_LABEL_PvP)); 195 m_labelLabels[eLabel_Trust].init(app.GetString(IDS_LABEL_TRUST)); 196 m_labelLabels[eLabel_TNTOn].init(app.GetString(IDS_LABEL_TNT)); 197 m_labelLabels[eLabel_FireOn].init(app.GetString(IDS_LABEL_FIRE_SPREADS)); 198 199 m_labelValues[eLabel_Difficulty].init(app.GetString(IDS_DIFFICULTY_TITLE_PEACEFUL)); 200 m_labelValues[eLabel_GameType].init( app.GetString(IDS_CREATIVE) ); 201 m_labelValues[eLabel_GamertagsOn].init( app.GetString(IDS_OFF) ); 202 m_labelValues[eLabel_Structures].init( app.GetString(IDS_OFF) ); 203 m_labelValues[eLabel_LevelType].init( app.GetString(IDS_LEVELTYPE_NORMAL) ); 204 m_labelValues[eLabel_PVP].init( app.GetString(IDS_OFF) ); 205 m_labelValues[eLabel_Trust].init( app.GetString(IDS_OFF) ); 206 m_labelValues[eLabel_TNTOn].init( app.GetString(IDS_OFF) ); 207 m_labelValues[eLabel_FireOn].init( app.GetString(IDS_OFF) ); 208 209 m_friendInfoUpdatedERROR = false; 210 211 // Show a generic network error message, not always safe to assume the error was host quitting 212 // without bubbling more info up from the network manager so this is the best we can do 213 UINT uiIDA[1]; 214 uiIDA[0] = IDS_CONFIRM_OK; 215#ifdef _XBOX_ONE 216 ui.RequestErrorMessage( IDS_CONNECTION_FAILED, IDS_DISCONNECTED_SERVER_QUIT, uiIDA,1,m_iPad,ErrorDialogReturned,this); 217#else 218 ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA,1,m_iPad,ErrorDialogReturned,this); 219#endif 220 } 221 222 UIScene::tick(); 223} 224 225void UIScene_JoinMenu::friendSessionUpdated(bool success, void *pParam) 226{ 227 UIScene_JoinMenu *scene = (UIScene_JoinMenu *)pParam; 228 ui.NavigateBack(scene->m_iPad); 229 if( success ) 230 { 231 scene->m_friendInfoUpdatedOK = true; 232 } 233 else 234 { 235 scene->m_friendInfoUpdatedERROR = true; 236 } 237} 238 239int UIScene_JoinMenu::ErrorDialogReturned(void *pParam, int iPad, const C4JStorage::EMessageResult) 240{ 241 UIScene_JoinMenu *scene = (UIScene_JoinMenu *)pParam; 242 ui.NavigateBack(scene->m_iPad); 243 244 return 0; 245} 246 247void UIScene_JoinMenu::updateComponents() 248{ 249 m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); 250 m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); 251} 252 253wstring UIScene_JoinMenu::getMoviePath() 254{ 255 return L"JoinMenu"; 256} 257 258void UIScene_JoinMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) 259{ 260 if(m_bIgnoreInput) return; 261 262 ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); 263 264 switch(key) 265 { 266 case ACTION_MENU_CANCEL: 267 if(pressed) 268 { 269 navigateBack(); 270 handled = true; 271 } 272 break; 273#ifdef _DURANGO 274 case ACTION_MENU_Y: 275 if(m_selectedSession != NULL && getControlFocus() == eControl_GamePlayers && m_buttonListPlayers.getItemCount() > 0) 276 { 277 PlayerUID uid = m_selectedSession->searchResult.m_playerXuids[m_buttonListPlayers.getCurrentSelection()]; 278 if( uid != INVALID_XUID ) ProfileManager.ShowProfileCard(ProfileManager.GetLockedProfile(),uid); 279 } 280 break; 281#endif 282 case ACTION_MENU_OK: 283 if (getControlFocus() != eControl_GamePlayers) 284 { 285 sendInputToMovie(key, repeat, pressed, released); 286 } 287 handled = true; 288 break; 289#ifdef __ORBIS__ 290 case ACTION_MENU_TOUCHPAD_PRESS: 291#endif 292 case ACTION_MENU_UP: 293 case ACTION_MENU_DOWN: 294 case ACTION_MENU_PAGEUP: 295 case ACTION_MENU_PAGEDOWN: 296 sendInputToMovie(key, repeat, pressed, released); 297 handled = true; 298 break; 299 } 300} 301 302void UIScene_JoinMenu::handlePress(F64 controlId, F64 childId) 303{ 304 switch((int)controlId) 305 { 306 case eControl_JoinGame: 307 { 308 m_bIgnoreInput = true; 309 310 //CD - Added for audio 311 ui.PlayUISFX(eSFX_Press); 312 313#ifdef _DURANGO 314 ProfileManager.CheckMultiplayerPrivileges(m_iPad, true, &checkPrivilegeCallback, (LPVOID)GetCallbackUniqueId()); 315#else 316 StartSharedLaunchFlow(); 317#endif 318 } 319 break; 320 case eControl_GamePlayers: 321 break; 322 }; 323} 324 325void UIScene_JoinMenu::handleFocusChange(F64 controlId, F64 childId) 326{ 327 switch((int)controlId) 328 { 329 case eControl_GamePlayers: 330 m_buttonListPlayers.updateChildFocus( (int) childId ); 331 }; 332 updateTooltips(); 333} 334 335#ifdef _DURANGO 336void UIScene_JoinMenu::checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad) 337{ 338 UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); 339 340 if(pClass) 341 { 342 if(hasPrivilege) 343 { 344 pClass->StartSharedLaunchFlow(); 345 } 346 else 347 { 348 pClass->m_bIgnoreInput = false; 349 } 350 } 351} 352#endif 353 354void UIScene_JoinMenu::StartSharedLaunchFlow() 355{ 356 if(!app.IsLocalMultiplayerAvailable()) 357 { 358 JoinGame(this); 359 } 360 else 361 { 362 //ProfileManager.RequestSignInUI(false, false, false, true, false,&UIScene_JoinMenu::StartGame_SignInReturned, this,ProfileManager.GetPrimaryPad()); 363 SignInInfo info; 364 info.Func = &UIScene_JoinMenu::StartGame_SignInReturned; 365 info.lpParam = (LPVOID)GetCallbackUniqueId(); 366 info.requireOnline = true; 367 ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_QuadrantSignin,&info); 368 } 369} 370 371int UIScene_JoinMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad) 372{ 373 UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)ui.GetSceneFromCallbackId((size_t)pParam); 374 375 if(pClass) 376 { 377 if(bContinue==true) 378 { 379 // It's possible that the player has not signed in - they can back out 380 if(ProfileManager.IsSignedIn(iPad)) 381 { 382 JoinGame(pClass); 383 } 384 else 385 { 386 pClass->m_bIgnoreInput=false; 387 } 388 } 389 else 390 { 391 pClass->m_bIgnoreInput=false; 392 } 393 } 394 return 0; 395} 396 397// Shared function to join the game that is the same whether we used the sign-in UI or not 398void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) 399{ 400 DWORD dwSignedInUsers = 0; 401 bool noPrivileges = false; 402 DWORD dwLocalUsersMask = 0; 403 bool isSignedInLive = true; 404 int iPadNotSignedInLive = -1; 405 406 ProfileManager.SetLockedProfile(0); // TEMP! 407 408 // If we're in SD mode, then only the primary player gets to play 409 if (app.IsLocalMultiplayerAvailable()) 410 { 411 for(unsigned int index = 0; index < XUSER_MAX_COUNT; ++index) 412 { 413 if(ProfileManager.IsSignedIn(index)) 414 { 415 if (isSignedInLive && !ProfileManager.IsSignedInLive(index)) 416 { 417 // Record the first non signed in live pad 418 iPadNotSignedInLive = index; 419 } 420 421 if( !ProfileManager.AllowedToPlayMultiplayer(index) ) noPrivileges = true; 422 dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(index); 423 isSignedInLive = isSignedInLive && ProfileManager.IsSignedInLive(index); 424 } 425 } 426 } 427 else 428 { 429 if(ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) 430 { 431 if( !ProfileManager.AllowedToPlayMultiplayer(ProfileManager.GetPrimaryPad()) ) noPrivileges = true; 432 dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); 433 434 isSignedInLive = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()); 435#ifdef __PSVITA__ 436 if(CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) 437 isSignedInLive = true; 438#endif 439 440 } 441 } 442 443 // If this is an online game but not all players are signed in to Live, stop! 444 if (!isSignedInLive) 445 { 446#ifdef __ORBIS__ 447 // Check if PSN is unavailable because of age restriction 448 int npAvailability = ProfileManager.getNPAvailability(iPadNotSignedInLive); 449 if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) 450 { 451 pClass->m_bIgnoreInput = false; 452 // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK 453 UINT uiIDA[1]; 454 uiIDA[0]=IDS_OK; 455 ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPadNotSignedInLive); 456 } 457 else 458#endif 459 { 460 pClass->m_bIgnoreInput=false; 461 UINT uiIDA[1]; 462 uiIDA[0]=IDS_CONFIRM_OK; 463 ui.RequestErrorMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad()); 464 } 465 return; 466 } 467 468 // Check if user-created content is allowed, as we cannot play multiplayer if it's not 469 bool noUGC = false; 470 BOOL pccAllowed = TRUE; 471 BOOL pccFriendsAllowed = TRUE; 472 473#if defined(__PS3__) || defined(__PSVITA__) 474 if(isSignedInLive) 475 { 476 ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&noUGC,NULL,NULL); 477 } 478#else 479 ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); 480 if(!pccAllowed && !pccFriendsAllowed) noUGC = true; 481#endif 482 483 484#ifdef __PSVITA__ 485 if( CGameNetworkManager::usingAdhocMode() ) 486 { 487 noPrivileges = false; 488 noUGC = false; 489 } 490#endif 491 492 if(noUGC) 493 { 494 pClass->setVisible( true ); 495 pClass->m_bIgnoreInput=false; 496 497 int messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_SINGLE_LOCAL; 498 if(dwSignedInUsers > 1) messageText = IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_ALL_LOCAL; 499 500 ui.RequestUGCMessageBox(IDS_CONNECTION_FAILED, messageText); 501 } 502 else if(noPrivileges) 503 { 504 pClass->setVisible( true ); 505 pClass->m_bIgnoreInput=false; 506 UINT uiIDA[1]; 507 uiIDA[0]=IDS_CONFIRM_OK; 508 ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad()); 509 } 510 else 511 { 512#if defined(__ORBIS__) || defined(__PSVITA__) 513 bool chatRestricted = false; 514 ProfileManager.GetChatAndContentRestrictions(ProfileManager.GetPrimaryPad(),false,&chatRestricted,NULL,NULL); 515 if(chatRestricted) 516 { 517 ProfileManager.DisplaySystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, ProfileManager.GetPrimaryPad() ); 518 } 519#endif 520 CGameNetworkManager::eJoinGameResult result = g_NetworkManager.JoinGame( pClass->m_selectedSession, dwLocalUsersMask ); 521 522 // Alert the app the we no longer want to be informed of ethernet connections 523 app.SetLiveLinkRequired( false ); 524 525 if( result != CGameNetworkManager::JOINGAME_SUCCESS ) 526 { 527 int exitReasonStringId = -1; 528 switch(result) 529 { 530 case CGameNetworkManager::JOINGAME_FAIL_SERVER_FULL: 531 exitReasonStringId = IDS_DISCONNECTED_SERVER_FULL; 532 break; 533 } 534 535 if( exitReasonStringId == -1 ) 536 { 537 ui.NavigateBack(pClass->m_iPad); 538 } 539 else 540 { 541 UINT uiIDA[1]; 542 uiIDA[0]=IDS_CONFIRM_OK; 543 ui.RequestErrorMessage( IDS_CONNECTION_FAILED, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad()); 544 exitReasonStringId = -1; 545 546 ui.NavigateToHomeMenu(); 547 } 548 } 549 } 550} 551 552void UIScene_JoinMenu::handleTimerComplete(int id) 553{ 554 switch(id) 555 { 556 case UPDATE_PLAYERS_TIMER_ID: 557 { 558#if TO_BE_IMPLEMENTED 559 PlayerUID selectedPlayerXUID = m_selectedSession->data.players[playersList.GetCurSel()]; 560 561 bool success = g_NetworkManager.GetGameSessionInfo(m_iPad, m_selectedSession->sessionId,m_selectedSession); 562 563 if( success ) 564 { 565 playersList.DeleteItems(0, playersList.GetItemCount()); 566 int selectedIndex = 0; 567 for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) 568 { 569 if( m_selectedSession->data.players[i] != NULL ) 570 { 571 if(m_selectedSession->data.players[i] == selectedPlayerXUID) selectedIndex = i; 572 playersList.InsertItems(i,1); 573#ifndef _CONTENT_PACKAGE 574 if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_DebugLeaderboards))) 575 { 576 playersList.SetText(i, L"WWWWWWWWWWWWWWWW" ); 577 } 578 else 579#endif 580 { 581 playersList.SetText(i, convStringToWstring( m_selectedSession->data.szPlayers[i] ).c_str() ); 582 } 583 } 584 else 585 { 586 // Leave the loop when we hit the first NULL player 587 break; 588 } 589 } 590 playersList.SetCurSel(selectedIndex); 591 } 592#endif 593 } 594 break; 595 }; 596}