the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 603 lines 18 kB view raw
1#include "stdafx.h" 2#include "..\..\Common\Tutorial\Tutorial.h" 3#include "..\..\MultiplayerLocalPlayer.h" 4#include "..\..\..\Minecraft.World\StringHelpers.h" 5#include "..\..\..\Minecraft.World\Tile.h" 6#include "..\..\..\Minecraft.World\Item.h" 7#include "XUI_Ctrl_CraftIngredientSlot.h" 8#include "XUI_XZP_Icons.h" 9 10//---------------------------------------------------------------------------------- 11// Performs initialization tasks - retrieves controls. 12//---------------------------------------------------------------------------------- 13HRESULT CScene_TutorialPopup::OnInit( XUIMessageInit* pInitData, BOOL& bHandled ) 14{ 15 HRESULT hr = S_OK; 16 17 tutorial = (Tutorial *)pInitData->pvInitData; 18 m_iPad = tutorial->getPad(); 19 20 MapChildControls(); 21 22 // splitscreen? 23 // if we are in splitscreen, then we need to figure out if we want to move this scene 24 if(app.GetLocalPlayerCount()>1) 25 { 26 app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad); 27 } 28 29 m_textFontSize = _fromString<int>( m_fontSizeControl.GetText() ); 30 m_fontSizeControl.SetShow(false); 31 32 m_interactScene = NULL; 33 m_lastSceneMovedLeft = false; 34 m_bAllowFade = false; 35 36 SetShow(false); 37 XuiSetTimer(m_hObj,TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID,TUTORIAL_POPUP_MOVE_SCENE_TIME); 38 39 return hr; 40} 41 42HRESULT CScene_TutorialPopup::OnDestroy() 43{ 44 return S_OK; 45} 46 47HRESULT CScene_TutorialPopup::OnTimer(XUIMessageTimer *pData,BOOL& rfHandled) 48{ 49 if( pData->nId == TUTORIAL_POPUP_FADE_TIMER_ID ) 50 { 51 XuiKillTimer(m_hObj,TUTORIAL_POPUP_FADE_TIMER_ID); 52 SetShow( false ); 53 XuiSetTimer(m_hObj,TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID,TUTORIAL_POPUP_MOVE_SCENE_TIME); 54 } 55 else if( pData->nId == TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID ) 56 { 57 UpdateInteractScenePosition(IsShown() == TRUE); 58 XuiKillTimer(m_hObj,TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID); 59 } 60 61 return S_OK; 62} 63 64void CScene_TutorialPopup::UpdateInteractScenePosition(bool visible) 65{ 66 if( m_interactScene == NULL ) return; 67 68 // 4J-PB - check this players screen section to see if we should allow the animation 69 bool bAllowAnim=false; 70 HXUICLASS sceneClass = XuiGetObjectClass( m_interactScene->m_hObj ); 71 72 HXUICLASS inventoryClass = XuiFindClass( L"CXuiSceneInventory" ); 73 HXUICLASS furnaceClass = XuiFindClass( L"CXuiSceneFurnace" ); 74 HXUICLASS craftingClass = XuiFindClass( L"CXuiSceneCraftingPanel" ); 75 HXUICLASS trapClass = XuiFindClass( L"CXuiSceneTrap" ); 76 HXUICLASS containerClass = XuiFindClass( L"CXuiSceneContainer" ); 77 HXUICLASS creativeInventoryClass = XuiFindClass( L"CXuiSceneInventoryCreative" ); 78 HXUICLASS enchantingClass = XuiFindClass( L"CXuiSceneEnchant" ); 79 HXUICLASS brewingClass = XuiFindClass( L"CXuiSceneBrewingStand" ); 80 HXUICLASS anvilClass = XuiFindClass( L"CXuiSceneAnvil" ); 81 HXUICLASS tradingClass = XuiFindClass( L"CXuiSceneTrading" ); 82 BOOL isCraftingScene = XuiClassDerivesFrom( sceneClass, craftingClass ); 83 BOOL isCreativeScene = XuiClassDerivesFrom( sceneClass, creativeInventoryClass ); 84 85 switch(Minecraft::GetInstance()->localplayers[m_iPad]->m_iScreenSection) 86 { 87 case C4JRender::VIEWPORT_TYPE_FULLSCREEN: 88 case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: 89 case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: 90 bAllowAnim=true; 91 break; 92 default: 93 // anim allowed for everything except the crafting 2x2 and 3x3, and the creative menu 94 if(!isCraftingScene && !isCreativeScene) 95 { 96 bAllowAnim=true; 97 } 98 break; 99 } 100 101 if(bAllowAnim) 102 { 103 104 XUITimeline *timeline; 105 XUINamedFrame *startFrame; 106 XUINamedFrame *endFrame; 107 bool movingLeft = false; 108 // Also returns TRUE if they are the same (which is what we want) 109 if( XuiClassDerivesFrom( sceneClass, inventoryClass ) || 110 XuiClassDerivesFrom( sceneClass, furnaceClass ) || 111 XuiClassDerivesFrom( sceneClass, trapClass ) || 112 XuiClassDerivesFrom( sceneClass, containerClass ) || 113 XuiClassDerivesFrom( sceneClass, enchantingClass ) || 114 XuiClassDerivesFrom( sceneClass, brewingClass ) || 115 XuiClassDerivesFrom( sceneClass, anvilClass ) || 116 XuiClassDerivesFrom( sceneClass, tradingClass ) || 117 isCreativeScene || 118 isCraftingScene == TRUE ) 119 { 120 XuiElementGetTimeline( m_interactScene->m_hObj, &timeline); 121 if(visible) 122 { 123 startFrame = timeline->FindNamedFrame( L"MoveLeft" ); 124 endFrame = timeline->FindNamedFrame( L"EndMoveLeft" ); 125 movingLeft = true; 126 } 127 else 128 { 129 startFrame = timeline->FindNamedFrame( L"MoveRight" ); 130 endFrame = timeline->FindNamedFrame( L"EndMoveRight" ); 131 } 132 133 if( (m_lastInteractSceneMoved != m_interactScene && movingLeft) || ( m_lastInteractSceneMoved == m_interactScene && m_lastSceneMovedLeft != movingLeft ) ) 134 { 135 timeline->Play( startFrame->m_dwFrame, startFrame->m_dwFrame, endFrame->m_dwFrame, FALSE, FALSE ); 136 137 m_lastInteractSceneMoved = m_interactScene; 138 m_lastSceneMovedLeft = movingLeft; 139 } 140 } 141 } 142 143} 144 145HRESULT CScene_TutorialPopup::_SetDescription(CXuiScene *interactScene, LPCWSTR desc, LPCWSTR title, bool allowFade, bool isReminder) 146{ 147 HRESULT hr = S_OK; 148 m_interactScene = interactScene; 149 if( interactScene != m_lastInteractSceneMoved ) m_lastInteractSceneMoved = NULL; 150 if(desc == NULL) 151 { 152 SetShow( false ); 153 XuiSetTimer(m_hObj,TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID,TUTORIAL_POPUP_MOVE_SCENE_TIME); 154 XuiKillTimer(m_hObj,TUTORIAL_POPUP_FADE_TIMER_ID); 155 } 156 else 157 { 158 SetShow( true ); 159 XuiSetTimer(m_hObj,TUTORIAL_POPUP_MOVE_SCENE_TIMER_ID,TUTORIAL_POPUP_MOVE_SCENE_TIME); 160 161 if( allowFade ) 162 { 163 //Initialise a timer to fade us out again 164 XuiSetTimer(m_hObj,TUTORIAL_POPUP_FADE_TIMER_ID,tutorial->GetTutorialDisplayMessageTime()); 165 } 166 else 167 { 168 XuiKillTimer(m_hObj,TUTORIAL_POPUP_FADE_TIMER_ID); 169 } 170 m_bAllowFade = allowFade; 171 172 if(isReminder) 173 { 174 wstring text(app.GetString( IDS_TUTORIAL_REMINDER )); 175 text.append( desc ); 176 // set the text colour 177 wchar_t formatting[40]; 178 swprintf(formatting, 40, L"<font color=\"#%08x\" size=\"%d\">",app.GetHTMLColour(eHTMLColor_White),m_textFontSize); 179 text = formatting + text; 180 181 hr = m_description.SetText( text.c_str() ); 182 } 183 else 184 { 185 wstring text(desc); 186 // set the text colour 187 wchar_t formatting[40]; 188 swprintf(formatting, 40, L"<font color=\"#%08x\" size=\"%d\">",app.GetHTMLColour(eHTMLColor_White),m_textFontSize); 189 text = formatting + text; 190 191 hr = m_description.SetText( text.c_str() ); 192 } 193 194 D3DXVECTOR3 titlePos; 195 hr = XuiElementGetPosition( m_title, &titlePos ); 196 197 BOOL titleShowAtStart = m_title.IsShown(); 198 if( title != NULL && title[0] != 0 ) 199 { 200 m_title.SetText( title ); 201 m_title.SetShow(TRUE); 202 } 203 else 204 { 205 m_title.SetText( L"" ); 206 m_title.SetShow(FALSE); 207 } 208 BOOL titleShowAtEnd = m_title.IsShown(); 209 if(titleShowAtStart != titleShowAtEnd) 210 { 211 float fHeight, fWidth, fTitleHeight, fDescHeight, fDescWidth; 212 m_title.GetBounds(&fWidth,&fTitleHeight); 213 GetBounds(&fWidth,&fHeight); 214 215 216 // 4J Stu - For some reason when we resize the scene it resets the size of the HTML control 217 // We don't want that to happen, so get it's size before and set it back after 218 m_description.GetBounds(&fDescWidth,&fDescHeight); 219 if(titleShowAtEnd) 220 { 221 titlePos.y += fTitleHeight; 222 223 SetBounds(fWidth, fHeight + fTitleHeight); 224 } 225 else 226 { 227 SetBounds(fWidth, fHeight - fTitleHeight); 228 } 229 XuiElementSetPosition( m_description, &titlePos ); 230 m_description.SetBounds(fDescWidth, fDescHeight); 231 } 232 233 // Check if we need to resize the box 234 XUIContentDims contentDims; 235 m_description.GetContentDims(&contentDims); 236 237 int heightDiff = contentDims.nContentHeight - contentDims.nPageHeight; 238 239 float fHeight, fWidth; 240 GetBounds(&fWidth,&fHeight); 241 SetBounds(fWidth, fHeight + heightDiff); 242 243 m_description.GetBounds(&fWidth,&fHeight); 244 m_description.SetBounds(fWidth, (float)(contentDims.nPageHeight + heightDiff)); 245 } 246 return hr; 247} 248 249HRESULT CScene_TutorialPopup::SetDescription(int iPad, TutorialPopupInfo *info) 250{ 251 HRESULT hr = S_OK; 252 253#ifdef _XBOX 254 HXUIOBJ hObj = app.GetCurrentTutorialScene(iPad); 255 HXUICLASS thisClass = XuiFindClass( L"CScene_TutorialPopup" ); 256 HXUICLASS objClass = XuiGetObjectClass( hObj ); 257 258 // Also returns TRUE if they are the same (which is what we want) 259 if( XuiClassDerivesFrom( objClass, thisClass ) ) 260 { 261 262 CScene_TutorialPopup *pThis; 263 hr = XuiObjectFromHandle(hObj, (void **) &pThis); 264 if (FAILED(hr)) 265 return hr; 266 267 wstring parsed = pThis->_SetIcon(info->icon, info->iAuxVal, info->isFoil, info->desc); 268 parsed = pThis->_SetImage( parsed ); 269 parsed = CScene_TutorialPopup::ParseDescription(iPad, parsed); 270 if(parsed.empty()) 271 { 272 hr = pThis->_SetDescription( info->interactScene, NULL, NULL, info->allowFade, info->isReminder ); 273 } 274 else 275 { 276 hr = pThis->_SetDescription( info->interactScene, parsed.c_str(), info->title, info->allowFade, info->isReminder ); 277 } 278 } 279#endif 280 return hr; 281} 282 283wstring CScene_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil, LPCWSTR desc) 284{ 285 wstring temp(desc); 286 287 BOOL iconShowAtStart = m_pCraftingPic->IsShown(); 288 289 if( icon != TUTORIAL_NO_ICON ) 290 { 291 bool itemIsFoil = false; 292 itemIsFoil = (shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal)))->isFoil(); 293 if(!itemIsFoil) itemIsFoil = isFoil; 294 295 m_pCraftingPic->SetIcon(m_iPad, icon,iAuxVal,1,10,31,false,itemIsFoil); 296 } 297 else 298 { 299 wstring openTag(L"{*ICON*}"); 300 wstring closeTag(L"{*/ICON*}"); 301 int iconTagStartPos = (int)temp.find(openTag); 302 int iconStartPos = iconTagStartPos + (int)openTag.length(); 303 if( iconTagStartPos > 0 && iconStartPos < (int)temp.length() ) 304 { 305 int iconEndPos = (int)temp.find( closeTag, iconStartPos ); 306 307 if(iconEndPos > iconStartPos && iconEndPos < (int)temp.length() ) 308 { 309 wstring id = temp.substr(iconStartPos, iconEndPos - iconStartPos); 310 311 vector<wstring> idAndAux = stringSplit(id,L':'); 312 313 int iconId = _fromString<int>(idAndAux[0]); 314 315 if(idAndAux.size() > 1) 316 { 317 iAuxVal = _fromString<int>(idAndAux[1]); 318 } 319 else 320 { 321 iAuxVal = 0; 322 } 323 324 bool itemIsFoil = false; 325 itemIsFoil = (shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal)))->isFoil(); 326 if(!itemIsFoil) itemIsFoil = isFoil; 327 328 m_pCraftingPic->SetIcon(m_iPad, iconId,iAuxVal,1,10,31,false,itemIsFoil); 329 330 temp.replace(iconTagStartPos, iconEndPos - iconTagStartPos + closeTag.length(), L""); 331 } 332 } 333 334 // remove any icon text 335 else if(temp.find(L"{*CraftingTableIcon*}")!=wstring::npos) 336 { 337 m_pCraftingPic->SetIcon(m_iPad, Tile::workBench->id,0,1,10,31,false); 338 } 339 else if(temp.find(L"{*SticksIcon*}")!=wstring::npos) 340 { 341 m_pCraftingPic->SetIcon(m_iPad, Item::stick->id,0,1,10,31,false); 342 } 343 else if(temp.find(L"{*PlanksIcon*}")!=wstring::npos) 344 { 345 m_pCraftingPic->SetIcon(m_iPad, Tile::wood->id,0,1,10,31,false); 346 } 347 else if(temp.find(L"{*WoodenShovelIcon*}")!=wstring::npos) 348 { 349 m_pCraftingPic->SetIcon(m_iPad, Item::shovel_wood->id,0,1,10,31,false); 350 } 351 else if(temp.find(L"{*WoodenHatchetIcon*}")!=wstring::npos) 352 { 353 m_pCraftingPic->SetIcon(m_iPad, Item::hatchet_wood->id,0,1,10,31,false); 354 } 355 else if(temp.find(L"{*WoodenPickaxeIcon*}")!=wstring::npos) 356 { 357 m_pCraftingPic->SetIcon(m_iPad, Item::pickAxe_wood->id,0,1,10,31,false); 358 } 359 else if(temp.find(L"{*FurnaceIcon*}")!=wstring::npos) 360 { 361 m_pCraftingPic->SetIcon(m_iPad, Tile::furnace_Id,0,1,10,31,false); 362 } 363 else if(temp.find(L"{*WoodenDoorIcon*}")!=wstring::npos) 364 { 365 m_pCraftingPic->SetIcon(m_iPad, Item::door_wood->id,0,1,10,31,false); 366 } 367 else if(temp.find(L"{*TorchIcon*}")!=wstring::npos) 368 { 369 m_pCraftingPic->SetIcon(m_iPad, Tile::torch_Id,0,1,10,31,false); 370 } 371 else if(temp.find(L"{*BoatIcon*}")!=wstring::npos) 372 { 373 m_pCraftingPic->SetIcon(m_iPad, Item::boat_Id,0,1,10,31,false); 374 } 375 else if(temp.find(L"{*FishingRodIcon*}")!=wstring::npos) 376 { 377 m_pCraftingPic->SetIcon(m_iPad, Item::fishingRod_Id,0,1,10,31,false); 378 } 379 else if(temp.find(L"{*FishIcon*}")!=wstring::npos) 380 { 381 m_pCraftingPic->SetIcon(m_iPad, Item::fish_raw_Id,0,1,10,31,false); 382 } 383 else if(temp.find(L"{*MinecartIcon*}")!=wstring::npos) 384 { 385 m_pCraftingPic->SetIcon(m_iPad, Item::minecart_Id,0,1,10,31,false); 386 } 387 else if(temp.find(L"{*RailIcon*}")!=wstring::npos) 388 { 389 m_pCraftingPic->SetIcon(m_iPad, Tile::rail_Id,0,1,10,31,false); 390 } 391 else if(temp.find(L"{*PoweredRailIcon*}")!=wstring::npos) 392 { 393 m_pCraftingPic->SetIcon(m_iPad, Tile::goldenRail_Id,0,1,10,31,false); 394 } 395 else if(temp.find(L"{*StructuresIcon*}")!=wstring::npos) 396 { 397 m_pCraftingPic->SetIcon(m_iPad, XZP_ICON_STRUCTURES,0,1,10,31,false); 398 } 399 else if(temp.find(L"{*ToolsIcon*}")!=wstring::npos) 400 { 401 m_pCraftingPic->SetIcon(m_iPad, XZP_ICON_TOOLS,0,1,10,31,false); 402 } 403 else if(temp.find(L"{*StoneIcon*}")!=wstring::npos) 404 { 405 m_pCraftingPic->SetIcon(m_iPad, Tile::rock_Id,0,1,10,31,false); 406 } 407 else 408 { 409 // hide the icon slot 410 m_pCraftingPic->SetIcon(m_iPad, 0,0,0,0,0,false,false,FALSE); 411 } 412 } 413 414 BOOL iconShowAtEnd = m_pCraftingPic->IsShown(); 415 if(iconShowAtStart != iconShowAtEnd) 416 { 417 float fHeight, fWidth, fIconHeight, fDescHeight, fDescWidth; 418 m_pCraftingPic->GetBounds(&fWidth,&fIconHeight); 419 GetBounds(&fWidth,&fHeight); 420 421 422 // 4J Stu - For some reason when we resize the scene it resets the size of the HTML control 423 // We don't want that to happen, so get it's size before and set it back after 424 m_description.GetBounds(&fDescWidth,&fDescHeight); 425 if(iconShowAtEnd) 426 { 427 SetBounds(fWidth, fHeight + fIconHeight); 428 } 429 else 430 { 431 SetBounds(fWidth, fHeight - fIconHeight); 432 } 433 m_description.SetBounds(fDescWidth, fDescHeight); 434 } 435 436 return temp; 437} 438 439wstring CScene_TutorialPopup::_SetImage(wstring &desc) 440{ 441 442 BOOL imageShowAtStart = m_image.IsShown(); 443 444 wstring openTag(L"{*IMAGE*}"); 445 wstring closeTag(L"{*/IMAGE*}"); 446 int imageTagStartPos = (int)desc.find(openTag); 447 int imageStartPos = imageTagStartPos + (int)openTag.length(); 448 if( imageTagStartPos > 0 && imageStartPos < (int)desc.length() ) 449 { 450 int imageEndPos = (int)desc.find( closeTag, imageStartPos ); 451 452 if(imageEndPos > imageStartPos && imageEndPos < (int)desc.length() ) 453 { 454 wstring id = desc.substr(imageStartPos, imageEndPos - imageStartPos); 455 m_image.SetImagePath( id.c_str() ); 456 m_image.SetShow( TRUE ); 457 458 desc.replace(imageTagStartPos, imageEndPos - imageTagStartPos + closeTag.length(), L""); 459 } 460 } 461 else 462 { 463 // hide the icon slot 464 m_image.SetShow( FALSE ); 465 } 466 467 BOOL imageShowAtEnd = m_image.IsShown(); 468 if(imageShowAtStart != imageShowAtEnd) 469 { 470 float fHeight, fWidth, fIconHeight, fDescHeight, fDescWidth; 471 m_image.GetBounds(&fWidth,&fIconHeight); 472 GetBounds(&fWidth,&fHeight); 473 474 475 // 4J Stu - For some reason when we resize the scene it resets the size of the HTML control 476 // We don't want that to happen, so get it's size before and set it back after 477 m_description.GetBounds(&fDescWidth,&fDescHeight); 478 if(imageShowAtEnd) 479 { 480 SetBounds(fWidth, fHeight + fIconHeight); 481 } 482 else 483 { 484 SetBounds(fWidth, fHeight - fIconHeight); 485 } 486 m_description.SetBounds(fDescWidth, fDescHeight); 487 } 488 489 return desc; 490} 491 492 493wstring CScene_TutorialPopup::ParseDescription(int iPad, wstring &text) 494{ 495 text = replaceAll(text, L"{*CraftingTableIcon*}", L""); 496 text = replaceAll(text, L"{*SticksIcon*}", L""); 497 text = replaceAll(text, L"{*PlanksIcon*}", L""); 498 text = replaceAll(text, L"{*WoodenShovelIcon*}", L""); 499 text = replaceAll(text, L"{*WoodenHatchetIcon*}", L""); 500 text = replaceAll(text, L"{*WoodenPickaxeIcon*}", L""); 501 text = replaceAll(text, L"{*FurnaceIcon*}", L""); 502 text = replaceAll(text, L"{*WoodenDoorIcon*}", L""); 503 text = replaceAll(text, L"{*TorchIcon*}", L""); 504 text = replaceAll(text, L"{*MinecartIcon*}", L""); 505 text = replaceAll(text, L"{*BoatIcon*}", L""); 506 text = replaceAll(text, L"{*FishingRodIcon*}", L""); 507 text = replaceAll(text, L"{*FishIcon*}", L""); 508 text = replaceAll(text, L"{*RailIcon*}", L""); 509 text = replaceAll(text, L"{*PoweredRailIcon*}", L""); 510 text = replaceAll(text, L"{*StructuresIcon*}", L""); 511 text = replaceAll(text, L"{*ToolsIcon*}", L""); 512 text = replaceAll(text, L"{*StoneIcon*}", L""); 513 514 if( app.GetLocalPlayerCount() > 1 ) 515 { 516 // TODO TU-1 - This should really be a string as well rather than hardcoded here 517 text = replaceAll(text, L"{*EXIT_PICTURE*}", L"<div align=\"center\"><img height=\"90\" width=\"160\" src=\"TutorialExitScreenshot.png\"/></div>" ); 518 519 // TODO TU-1 - This should also be separate strings, or move these things out of a localisable file so we can add/change them at will 520 text = replaceAll(text, L"height=\"30\" width=\"30\"", L"height=\"20\" width=\"20\""); 521 } 522 else 523 { 524 text = replaceAll(text, L"{*EXIT_PICTURE*}", app.GetString( IDS_TUTORIAL_HTML_EXIT_PICTURE ) ); 525 } 526 /* 527#define MINECRAFT_ACTION_RENDER_DEBUG ACTION_INGAME_13 528#define MINECRAFT_ACTION_PAUSEMENU ACTION_INGAME_15 529#define MINECRAFT_ACTION_SNEAK_TOGGLE ACTION_INGAME_17 530 */ 531 532 return app.FormatHTMLString(iPad,text); 533} 534 535HRESULT CScene_TutorialPopup::_SetVisible(bool show) 536{ 537 HRESULT hr = this->SetShow( show ); 538 539 if( show && m_bAllowFade ) 540 { 541 //Initialise a timer to fade us out again 542 XuiSetTimer(m_hObj,TUTORIAL_POPUP_FADE_TIMER_ID,tutorial->GetTutorialDisplayMessageTime()); 543 } 544 545 return hr; 546} 547 548bool CScene_TutorialPopup::_IsSceneVisible() 549{ 550 bool isVisible = this->IsShown()==TRUE?true:false; 551 552 return isVisible; 553} 554 555HRESULT CScene_TutorialPopup::SetSceneVisible(int iPad, bool show) 556{ 557 HRESULT hr = S_OK; 558 559 HXUIOBJ hObj = app.GetCurrentTutorialScene(iPad); 560 HXUICLASS thisClass = XuiFindClass( L"CScene_TutorialPopup" ); 561 HXUICLASS objClass = XuiGetObjectClass( hObj ); 562 563 // Also returns TRUE if they are the same (which is what we want) 564 if( XuiClassDerivesFrom( objClass, thisClass ) ) 565 { 566 CScene_TutorialPopup *pThis; 567 hr = XuiObjectFromHandle(hObj, (void **) &pThis); 568 if (FAILED(hr)) 569 return hr; 570 571 hr = pThis->_SetVisible( show ); 572 } 573 return hr; 574} 575 576 577HRESULT CScene_TutorialPopup::OnCustomMessage_Splitscreenplayer(bool bJoining, BOOL& bHandled) 578{ 579 bHandled=true; 580 return app.AdjustSplitscreenScene_PlayerChanged(m_hObj,&m_OriginalPosition,m_iPad,bJoining); 581} 582 583bool CScene_TutorialPopup::IsSceneVisible(int iPad) 584{ 585 bool isVisible = false; 586 HRESULT hr; 587 588 HXUIOBJ hObj = app.GetCurrentTutorialScene(iPad); 589 HXUICLASS thisClass = XuiFindClass( L"CScene_TutorialPopup" ); 590 HXUICLASS objClass = XuiGetObjectClass( hObj ); 591 592 // Also returns TRUE if they are the same (which is what we want) 593 if( XuiClassDerivesFrom( objClass, thisClass ) ) 594 { 595 CScene_TutorialPopup *pThis; 596 hr = XuiObjectFromHandle(hObj, (void **) &pThis); 597 if (FAILED(hr)) 598 return false; 599 600 isVisible = pThis->_IsSceneVisible(); 601 } 602 return isVisible; 603}