#include "stdafx.h" #include "UI.h" #include "UIScene_HowToPlayMenu.h" // strings for buttons in the list unsigned int UIScene_HowToPlayMenu::m_uiHTPButtonNameA[]= { IDS_HOW_TO_PLAY_MENU_BASICS, // eHTPButton_Basics, IDS_HOW_TO_PLAY_MENU_HUD, // eHTPButton_Hud, IDS_HOW_TO_PLAY_MENU_INVENTORY, // eHTPButton_Inventory, IDS_HOW_TO_PLAY_MENU_CHESTS, // eHTPButton_Chest, IDS_HOW_TO_PLAY_MENU_CRAFTING, // eHTPButton_Crafting, IDS_HOW_TO_PLAY_MENU_FURNACE, // eHTPButton_Furnace, IDS_HOW_TO_PLAY_MENU_DISPENSER, // eHTPButton_Dispenser, IDS_HOW_TO_PLAY_MENU_NETHERPORTAL, // eHTPButton_NetherPortal, }; // mapping the buttons to a scene value unsigned int UIScene_HowToPlayMenu::m_uiHTPSceneA[]= { eHowToPlay_Basics, eHowToPlay_HUD, eHowToPlay_Inventory, eHowToPlay_Chest, eHowToPlay_InventoryCrafting, eHowToPlay_Furnace, eHowToPlay_Dispenser, eHowToPlay_NetherPortal, }; UIScene_HowToPlayMenu::UIScene_HowToPlayMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { // Setup all the Iggy references we need for this scene initialiseMovie(); m_buttonListHowTo.init(eControl_Buttons); for(unsigned int i = 0; i < eHTPButton_Max; ++i) { m_buttonListHowTo.addItem( app.GetString(m_uiHTPButtonNameA[i]) , i);//iCount++); } } wstring UIScene_HowToPlayMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) { return L"HowToPlayMenuSplit"; } else { return L"HowToPlayMenu"; } } void UIScene_HowToPlayMenu::updateTooltips() { ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK); } void UIScene_HowToPlayMenu::updateComponents() { bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(bNotInGame) { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); } else { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,false); if( app.GetLocalPlayerCount() == 1 ) m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); else m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false); } } void UIScene_HowToPlayMenu::handleReload() { for(unsigned int i = 0; i < eHTPButton_Max; ++i) { m_buttonListHowTo.addItem( app.GetString(m_uiHTPButtonNameA[i]) , i); } } void UIScene_HowToPlayMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { //app.DebugPrintf("UIScene_DebugOverlay handling input for pad %d, key %d, down- %s, pressed- %s, released- %s\n", iPad, key, down?"TRUE":"FALSE", pressed?"TRUE":"FALSE", released?"TRUE":"FALSE"); ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); switch(key) { case ACTION_MENU_CANCEL: if(pressed) { navigateBack(); } break; case ACTION_MENU_OK: #ifdef __ORBIS__ case ACTION_MENU_TOUCHPAD_PRESS: #endif sendInputToMovie(key, repeat, pressed, released); break; case ACTION_MENU_UP: case ACTION_MENU_DOWN: case ACTION_MENU_PAGEUP: case ACTION_MENU_PAGEDOWN: sendInputToMovie(key, repeat, pressed, released); break; } } void UIScene_HowToPlayMenu::handlePress(F64 controlId, F64 childId) { if( (int)controlId == eControl_Buttons) { //CD - Added for audio ui.PlayUISFX(eSFX_Press); unsigned int uiInitData; uiInitData = ( ( 1 << 31 ) | ( m_uiHTPSceneA[(int)childId] << 16 ) | ( short )( m_iPad ) ); ui.NavigateToScene(m_iPad, eUIScene_HowToPlay, ( void* )( uiInitData ) ); } }