diff --git a/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenu1080.swf b/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenu1080.swf index 5eaf67fb..fc9abf52 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenu1080.swf and b/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenu1080.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenu480.swf b/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenu480.swf index 236bb593..b37ea799 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenu480.swf and b/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenu480.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenu720.swf b/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenu720.swf index 059ae199..a0abbde0 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenu720.swf and b/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenu720.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenuSplit1080.swf b/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenuSplit1080.swf index 03c532fe..75a911c4 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenuSplit1080.swf and b/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenuSplit1080.swf differ diff --git a/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenuSplit720.swf b/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenuSplit720.swf index a49f20e8..c227d66f 100644 Binary files a/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenuSplit720.swf and b/Minecraft.Client/Common/Media/MediaWindows64/SkinSelectMenuSplit720.swf differ diff --git a/Minecraft.Client/Common/UI/UIControl_MultiList.cpp b/Minecraft.Client/Common/UI/UIControl_MultiList.cpp index 6d58f662..62004d78 100644 --- a/Minecraft.Client/Common/UI/UIControl_MultiList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_MultiList.cpp @@ -32,6 +32,7 @@ bool UIControl_MultiList::setupControl(UIScene *scene, IggyValuePath *parent, co m_funcEnableItem = registerFastName(L"EnableItem"); m_funcCheckElementExists = registerFastName(L"CheckElementExists"); m_funcSetTouchFocus = registerFastName(L"SetTouchFocus"); + m_removeAllItemsFunc = registerFastName(L"removeAllItems"); return success; } @@ -316,6 +317,17 @@ void UIControl_MultiList::EnableItem(int id, bool bEnable, bool bImmediate) getIggyValuePath(), m_funcEnableItem, 2, value); } +void UIControl_MultiList::clearList() +{ + IggyDataValue result; + IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, + getIggyValuePath(), m_removeAllItemsFunc, 0, nullptr); + + m_itemIds.clear(); + m_itemCount = 0; + m_iCurrentSelection = 0; +} + bool UIControl_MultiList::CheckElementExists(int id) { IggyDataValue result; diff --git a/Minecraft.Client/Common/UI/UIControl_MultiList.h b/Minecraft.Client/Common/UI/UIControl_MultiList.h index 38129ba9..96408ee0 100644 --- a/Minecraft.Client/Common/UI/UIControl_MultiList.h +++ b/Minecraft.Client/Common/UI/UIControl_MultiList.h @@ -24,6 +24,7 @@ protected: IggyName m_funcEnableItem; IggyName m_funcCheckElementExists; IggyName m_funcSetTouchFocus; + IggyName m_removeAllItemsFunc; // stores caller-defined ids in insertion order (label = -1) // iggy uses positional index; getListIndex() converts id to index. @@ -50,6 +51,7 @@ public: void SetSliderLabel(int id, const wstring &label, bool bImmediate = true); void HighlightItem(int id, bool animate = false); void EnableItem(int id, bool bEnable, bool bImmediate = true); + void clearList(); bool CheckElementExists(int id); int getCurrentSelection() const { return m_iCurrentSelection; } void updateChildFocus(int iChild) { m_iCurrentSelection = iChild; } diff --git a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp index 39432370..3081d01d 100644 --- a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp +++ b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp @@ -120,7 +120,7 @@ void UIControl_PlayerSkinPreview::tick() ++m_framesAnimatingRotation; m_yRot = m_fOriginalRotation + m_framesAnimatingRotation * ( (m_fTargetRotation - m_fOriginalRotation) / CHANGING_SKIN_FRAMES ); - //if(m_framesAnimatingRotation == CHANGING_SKIN_FRAMES) m_bAnimatingToFacing = false; + if(m_framesAnimatingRotation == CHANGING_SKIN_FRAMES) m_bAnimatingToFacing = false; } else { diff --git a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.h b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.h index 974e5924..93d04925 100644 --- a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.h +++ b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.h @@ -12,7 +12,7 @@ private: static const int LOOK_LEFT_EXTENT = 45; static const int LOOK_RIGHT_EXTENT = -45; - static const int CHANGING_SKIN_FRAMES = 15; + static const int CHANGING_SKIN_FRAMES = 8; enum ESkinPreviewAnimations { @@ -76,6 +76,7 @@ public: void DecrementXRotation() { m_xRot = (m_xRot-2); if(m_xRot < -22) m_xRot = -22; } void SetAutoRotate(bool autoRotate) { m_bAutoRotate = autoRotate; } void SetFacing(ESkinPreviewFacing facing, bool bAnimate = false); + bool IsAnimatingToFacing() const { return m_bAnimatingToFacing; } void CycleNextAnimation(); void CyclePreviousAnimation(); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp index d3100491..9260e705 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsAudioMenu.cpp @@ -45,6 +45,7 @@ void UIScene_SettingsAudioMenu::tick() { m_bNeedsMultiListPopulate = false; m_multiList.setupControl(this, m_rootPath, "MultiList"); + m_multiList.clearList(); m_multiList.init(eControl_MultiList); WCHAR TempString[256]; diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp index 1e796091..2b0b2fca 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsGraphicsMenu.cpp @@ -100,6 +100,7 @@ void UIScene_SettingsGraphicsMenu::tick() { m_bNeedsMultiListPopulate = false; m_multiList.setupControl(this, m_rootPath, "MultiList"); + m_multiList.clearList(); m_multiList.init(eControl_MultiList); WCHAR TempString[256]; diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp index f28b92fd..f59e1de2 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp @@ -57,6 +57,7 @@ void UIScene_SettingsOptionsMenu::tick() { m_bNeedsMultiListPopulate = false; m_multiList.setupControl(this, m_rootPath, "MultiList"); + m_multiList.clearList(); m_multiList.init(eControl_MultiList); m_multiList.AddNewCheckbox(app.GetString(IDS_CHECKBOX_VERTICAL_SPLIT_SCREEN), eControl_VerticalSplitscreen, (app.GetGameSettings(m_iPad,eGameSetting_SplitScreenVertical)!=0)); diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp index 3e54e6c0..8f8ba318 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsUIMenu.cpp @@ -59,6 +59,7 @@ void UIScene_SettingsUIMenu::tick() { m_bNeedsMultiListPopulate = false; m_multiList.setupControl(this, m_rootPath, "MultiList"); + m_multiList.clearList(); m_multiList.init(eControl_MultiList); bool bPrimaryPlayer = (ProfileManager.GetPrimaryPad() == m_iPad); diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index 590de54f..5341bebd 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -2,6 +2,7 @@ #include "UI.h" #include "UIScene_SkinSelectMenu.h" #include "../../../Minecraft.World/StringHelpers.h" +#include "TexturePackRepository.h" #ifdef __ORBIS__ #include #elif defined __PSVITA__ @@ -41,7 +42,7 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer // Setup all the Iggy references we need for this scene initialiseMovie(); - m_labelSelected.init( app.GetString( IDS_SELECTED ) ); + //m_labelSelected.init( app.GetString( IDS_SELECTED ) ); #ifdef __ORBIS__ m_bErrorDialogRunning=false; @@ -63,6 +64,8 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer m_bSlidingSkins = false; m_bAnimatingMove = false; m_bSkinIndexChanged = false; + m_bFocusDirty = false; + m_bNeedButtonListRefresh = true; m_currentNavigation = eSkinNavigation_Skin; @@ -72,20 +75,16 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer m_characters[eCharacter_Next1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Left); m_characters[eCharacter_Next2].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Left); - m_characters[eCharacter_Next3].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Left); - m_characters[eCharacter_Next4].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Left); m_characters[eCharacter_Previous1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Right); m_characters[eCharacter_Previous2].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Right); - m_characters[eCharacter_Previous3].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Right); - m_characters[eCharacter_Previous4].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Right); m_labelSkinName.init(L""); - m_labelSkinOrigin.init(L""); + //m_labelSkinOrigin.init(L""); - m_leftLabel = L""; - m_centreLabel = L""; - m_rightLabel = L""; + //m_leftLabel = L""; + //m_centreLabel = L""; + //m_rightLabel = L""; #ifdef __PSVITA__ // initialise vita tab controls with ids @@ -103,7 +102,7 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer m_controlTimer.setVisible( true ); m_controlIggyCharacters.setVisible( false ); - m_controlSkinNamePlate.setVisible( false ); + //m_controlSkinNamePlate.setVisible( false ); setCharacterLocked(false); setCharacterSelected(false); @@ -112,26 +111,8 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer { m_controlTimer.setVisible( false ); - if(app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin)>0) - { - // Change to display the favorites if there are any. The current skin will be in there (probably) - need to check for it - m_currentPack = app.m_dlcManager.getPackContainingSkin(m_currentSkinPath); - bool bFound; - if(m_currentPack != nullptr) - { - m_packIndex = app.m_dlcManager.getPackIndex(m_currentPack,bFound,DLCManager::e_DLCType_Skin) + SKIN_SELECT_MAX_DEFAULTS; - } - } - - // If we have any favourites, set this to the favourites - // first validate the favorite skins - we might have uninstalled the DLC needed for them app.ValidateFavoriteSkins(m_iPad); - - if(app.GetPlayerFavoriteSkinsCount(m_iPad)>0) - { - m_packIndex = SKIN_SELECT_PACK_FAVORITES; - } - + setActivePackIndex(); handlePackIndexChanged(); } @@ -145,7 +126,47 @@ UIScene_SkinSelectMenu::UIScene_SkinSelectMenu(int iPad, void *initData, UILayer void UIScene_SkinSelectMenu::updateTooltips() { - ui.SetTooltips( m_iPad, m_bNoSkinsToShow?-1:IDS_TOOLTIPS_SELECT_SKIN,IDS_TOOLTIPS_CANCEL,-1,-1,-1,-1,-1,-1,IDS_TOOLTIPS_NAVIGATE); + int iFav = -1; + int favCount = app.GetPlayerFavoriteSkinsCount(m_iPad); + + if(m_packIndex == SKIN_SELECT_PACK_FAVORITES) + { + iFav = (favCount > 0) ? IDS_TOOLTIPS_REMOVE_FAVORITE : -1; + } + else if(m_packIndex == SKIN_SELECT_PACK_DEFAULT) + { + // check if current skin is in favorites + iFav = IDS_TOOLTIPS_ADD_FAVORITE; + for(int i = 0; i < favCount; i++) + { + if(app.GetPlayerFavoriteSkin(m_iPad, i) == (unsigned int)m_skinIndex) + { + iFav = IDS_TOOLTIPS_REMOVE_FAVORITE; + break; + } + } + } + else if(m_currentPack != nullptr) + { + // dlc pack is checked via skin ID + DLCSkinFile *skinFile = m_currentPack->getSkinFile(m_skinIndex); + if(skinFile != nullptr) + { + DWORD skinId = skinFile->getSkinID(); + iFav = IDS_TOOLTIPS_ADD_FAVORITE; + for(int i = 0; i < favCount; i++) + { + if(app.GetPlayerFavoriteSkin(m_iPad, i) == skinId) + { + iFav = IDS_TOOLTIPS_REMOVE_FAVORITE; + break; + } + } + } + } + + ui.SetTooltips(m_iPad, m_bNoSkinsToShow?-1:IDS_TOOLTIPS_SELECT_SKIN, + IDS_TOOLTIPS_CANCEL, -1, iFav, -1, -1, -1, -1, -1, IDS_TOOLTIPS_NAVIGATE); } void UIScene_SkinSelectMenu::updateComponents() @@ -169,12 +190,23 @@ void UIScene_SkinSelectMenu::tick() { UIScene::tick(); + if(m_bFocusDirty) + { + m_bFocusDirty = false; + handlePackIndexChanged(); + } + if(m_bSkinIndexChanged) { m_bSkinIndexChanged = false; handleSkinIndexChanged(); } + if(m_bAnimatingMove && !m_characters[eCharacter_Current].IsAnimatingToFacing()) + { + handleAnimationEnd(); + } + // check for new DLC installed // check for the patch error dialog @@ -224,6 +256,7 @@ void UIScene_SkinSelectMenu::handleInput(int iPad, int key, bool repeat, bool pr ui.AnimateKeyPress(iPad, key, repeat, pressed, released); app.CheckGameSettingsChanged(true,iPad); navigateBack(); + handled = true; } break; case ACTION_MENU_OK: @@ -233,46 +266,45 @@ void UIScene_SkinSelectMenu::handleInput(int iPad, int key, bool repeat, bool pr if(pressed) { InputActionOK(iPad); + handled = true; + } + break; + case ACTION_MENU_Y: + if(pressed) + { + ui.AnimateKeyPress(iPad, key, repeat, pressed, released); + InputActionFavorite(iPad); + handled = true; } break; case ACTION_MENU_UP: case ACTION_MENU_DOWN: if(pressed) { - if(m_packIndex==SKIN_SELECT_PACK_FAVORITES) - { - if(app.GetPlayerFavoriteSkinsCount(iPad)==0) - { - // ignore this, since there are no skins being displayed - break; - } - } + DWORD startingIndex = m_packIndex; + if(key == ACTION_MENU_UP) + m_packIndex = getPreviousPackIndex(m_packIndex); + else + m_packIndex = getNextPackIndex(m_packIndex); - ui.AnimateKeyPress(iPad, key, repeat, pressed, released); - ui.PlayUISFX(eSFX_Scroll); - switch(m_currentNavigation) + if(startingIndex != m_packIndex) { - case eSkinNavigation_Pack: - m_currentNavigation = eSkinNavigation_Skin; - break; - case eSkinNavigation_Skin: - m_currentNavigation = eSkinNavigation_Pack; - break; - }; - sendInputToMovie(key, repeat, pressed, released); + ui.PlayUISFX(eSFX_Scroll); + m_controlSkinButtonList.HighlightItem(m_packIndex, true); + handlePackIndexChanged(); + } + handled = true; } break; case ACTION_MENU_LEFT: if(pressed) - { - if( m_currentNavigation == eSkinNavigation_Skin ) { if(!m_bAnimatingMove) { ui.AnimateKeyPress(iPad, key, repeat, pressed, released); ui.PlayUISFX(eSFX_Scroll); - m_skinIndex = getPreviousSkinIndex(m_skinIndex); + m_skinIndex = getPreviousSkinIndex(m_skinIndex); //handleSkinIndexChanged(); m_bSlidingSkins = true; @@ -282,54 +314,30 @@ void UIScene_SkinSelectMenu::handleInput(int iPad, int key, bool repeat, bool pr m_characters[eCharacter_Previous1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Forward, true); // 4J Stu - Swapped nav buttons - sendInputToMovie(ACTION_MENU_RIGHT, repeat, pressed, released); - } - } - else if( m_currentNavigation == eSkinNavigation_Pack ) - { - ui.AnimateKeyPress(iPad, key, repeat, pressed, released); - ui.PlayUISFX(eSFX_Scroll); - DWORD startingIndex = m_packIndex; - m_packIndex = getPreviousPackIndex(m_packIndex); - if(startingIndex != m_packIndex) - { - handlePackIndexChanged(); - } + sendInputToMovie(ACTION_MENU_RIGHT, repeat, pressed, released); + handled = true; } } break; case ACTION_MENU_RIGHT: if(pressed) { - if( m_currentNavigation == eSkinNavigation_Skin ) - { - if(!m_bAnimatingMove) - { - ui.AnimateKeyPress(iPad, key, repeat, pressed, released); - ui.PlayUISFX(eSFX_Scroll); - m_skinIndex = getNextSkinIndex(m_skinIndex); - //handleSkinIndexChanged(); - - m_bSlidingSkins = true; - m_bAnimatingMove = true; - - m_characters[eCharacter_Current].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Right, true); - m_characters[eCharacter_Next1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Forward, true); - - // 4J Stu - Swapped nav buttons - sendInputToMovie(ACTION_MENU_LEFT, repeat, pressed, released); - } - } - else if( m_currentNavigation == eSkinNavigation_Pack ) + if(!m_bAnimatingMove) { ui.AnimateKeyPress(iPad, key, repeat, pressed, released); ui.PlayUISFX(eSFX_Scroll); - DWORD startingIndex = m_packIndex; - m_packIndex = getNextPackIndex(m_packIndex); - if(startingIndex != m_packIndex) - { - handlePackIndexChanged(); - } + m_skinIndex = getNextSkinIndex(m_skinIndex); + //handleSkinIndexChanged(); + + m_bSlidingSkins = true; + m_bAnimatingMove = true; + + m_characters[eCharacter_Current].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Right, true); + m_characters[eCharacter_Next1].SetFacing(UIControl_PlayerSkinPreview::e_SkinPreviewFacing_Forward, true); + + // 4J Stu - Swapped nav buttons + sendInputToMovie(ACTION_MENU_LEFT, repeat, pressed, released); + handled = true; } } break; @@ -337,23 +345,15 @@ void UIScene_SkinSelectMenu::handleInput(int iPad, int key, bool repeat, bool pr if(pressed) { ui.PlayUISFX(eSFX_Press); - if( m_currentNavigation == eSkinNavigation_Skin ) - { - m_characters[eCharacter_Current].ResetRotation(); - } + m_characters[eCharacter_Current].ResetRotation(); + handled = true; } break; case ACTION_MENU_OTHER_STICK_LEFT: if(pressed) { - if( m_currentNavigation == eSkinNavigation_Skin ) - { - m_characters[eCharacter_Current].m_incYRot = true; - } - else - { - ui.PlayUISFX(eSFX_Scroll); - } + m_characters[eCharacter_Current].m_incYRot = true; + handled = true; } else if(released) { @@ -363,14 +363,8 @@ void UIScene_SkinSelectMenu::handleInput(int iPad, int key, bool repeat, bool pr case ACTION_MENU_OTHER_STICK_RIGHT: if(pressed) { - if( m_currentNavigation == eSkinNavigation_Skin ) - { - m_characters[eCharacter_Current].m_decYRot = true; - } - else - { - ui.PlayUISFX(eSFX_Scroll); - } + m_characters[eCharacter_Current].m_decYRot = true; + handled = true; } else if(released) { @@ -380,29 +374,17 @@ void UIScene_SkinSelectMenu::handleInput(int iPad, int key, bool repeat, bool pr case ACTION_MENU_OTHER_STICK_UP: if(pressed) { - if( m_currentNavigation == eSkinNavigation_Skin ) - { //m_previewControl->m_incXRot = true; - m_characters[eCharacter_Current].CyclePreviousAnimation(); - } - else - { - ui.PlayUISFX(eSFX_Scroll); - } + m_characters[eCharacter_Current].CyclePreviousAnimation(); + handled = true; } break; case ACTION_MENU_OTHER_STICK_DOWN: if(pressed) { - if( m_currentNavigation == eSkinNavigation_Skin ) - { //m_previewControl->m_decXRot = true; - m_characters[eCharacter_Current].CycleNextAnimation(); - } - else - { - ui.PlayUISFX(eSFX_Scroll); - } + m_characters[eCharacter_Current].CycleNextAnimation(); + handled = true; } break; } @@ -429,7 +411,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) { // get the pack number from the skin id wchar_t chars[256]; - swprintf(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(iPad,m_skinIndex)); + swprintf(chars, 256, L"dlcskin%08d.png", GET_DLC_SKIN_ID_FROM_BITMASK(app.GetPlayerFavoriteSkin(iPad,m_skinIndex))); DLCPack *Pack=app.m_dlcManager.getPackContainingSkin(chars); @@ -580,7 +562,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) m_originalSkinId = app.GetPlayerSkinId(iPad); // push this onto the favorite list - AddFavoriteSkin(m_iPad,GET_DLC_SKIN_ID_FROM_BITMASK(m_originalSkinId)); + //AddFavoriteSkin(m_iPad,GET_DLC_SKIN_ID_FROM_BITMASK(m_originalSkinId)); } } else @@ -610,7 +592,7 @@ void UIScene_SkinSelectMenu::customDraw(IggyCustomDrawCallbackRegion *region) { int characterId = -1; swscanf(static_cast(region->name),L"Character%d",&characterId); - if (characterId == -1) + if (characterId == -1 || characterId >= eCharacter_COUNT || characterId == 3 || characterId == 4) { app.DebugPrintf("Invalid character to render found\n"); } @@ -653,8 +635,9 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() TEXTURE_NAME backupTexture = TN_MOB_CHAR; setCharacterSelected(false); + setCharacterBlocked(false); - m_controlSkinNamePlate.setVisible( false ); + //m_controlSkinNamePlate.setVisible( false ); if( m_currentPack != nullptr ) { @@ -677,7 +660,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() setCharacterLocked(!(bSkinIsFree || bLicensed)); m_characters[eCharacter_Current].setVisible(true); - m_controlSkinNamePlate.setVisible( true ); + //m_controlSkinNamePlate.setVisible( true ); } else { @@ -707,44 +690,71 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() setCharacterLocked(false); m_characters[eCharacter_Current].setVisible(true); - m_controlSkinNamePlate.setVisible( true ); + //m_controlSkinNamePlate.setVisible( true ); break; case SKIN_SELECT_PACK_FAVORITES: if(app.GetPlayerFavoriteSkinsCount(m_iPad)>0) - { - // get the pack number from the skin id - wchar_t chars[256]; - swprintf(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(m_iPad,m_skinIndex)); + { + unsigned int favSkinId = app.GetPlayerFavoriteSkin(m_iPad,m_skinIndex); + if(GET_IS_DLC_SKIN_FROM_BITMASK(favSkinId)) + { + wchar_t chars[256]; + swprintf(chars, 256, L"dlcskin%08d.png", GET_DLC_SKIN_ID_FROM_BITMASK(favSkinId)); - Pack=app.m_dlcManager.getPackContainingSkin(chars); - if(Pack) - { - skinFile = Pack->getSkinFile(chars); + Pack=app.m_dlcManager.getPackContainingSkin(chars); + if(Pack) + { + skinFile = Pack->getSkinFile(chars); - m_selectedSkinPath = skinFile->getPath(); - m_selectedCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape); - m_vAdditionalSkinBoxes = skinFile->getAdditionalBoxes(); + m_selectedSkinPath = skinFile->getPath(); + m_selectedCapePath = skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape); + m_vAdditionalSkinBoxes = skinFile->getAdditionalBoxes(); - skinName = skinFile->getParameterAsString( DLCManager::e_DLCParamType_DisplayName ); - skinOrigin = skinFile->getParameterAsString( DLCManager::e_DLCParamType_ThemeName ); + skinName = skinFile->getParameterAsString( DLCManager::e_DLCParamType_DisplayName ); + skinOrigin = skinFile->getParameterAsString( DLCManager::e_DLCParamType_ThemeName ); - if( m_selectedSkinPath.compare( m_currentSkinPath ) == 0 ) - { - setCharacterSelected(true); - } + if( m_selectedSkinPath.compare( m_currentSkinPath ) == 0 ) + { + setCharacterSelected(true); + } - bSkinIsFree = skinFile->getParameterAsBool( DLCManager::e_DLCParamType_Free ); - bLicensed = Pack->hasPurchasedFile( DLCManager::e_DLCType_Skin, m_selectedSkinPath ); + bSkinIsFree = skinFile->getParameterAsBool( DLCManager::e_DLCParamType_Free ); + bLicensed = Pack->hasPurchasedFile( DLCManager::e_DLCType_Skin, m_selectedSkinPath ); - setCharacterLocked(!(bSkinIsFree || bLicensed)); - m_controlSkinNamePlate.setVisible( true ); + setCharacterLocked(!(bSkinIsFree || bLicensed)); + //m_controlSkinNamePlate.setVisible( true ); + } + else + { + setCharacterSelected(false); + setCharacterBlocked(false); + setCharacterLocked(false); + } } else { - setCharacterSelected(false); + // this fix a thingy with the default skin packs + DWORD defaultSkinIndex = favSkinId; + backupTexture = getTextureId(defaultSkinIndex); + + if( defaultSkinIndex == eDefaultSkins_ServerSelected ) + { + skinName = app.GetString(IDS_DEFAULT_SKINS); + } + else + { + skinName = wchDefaultNamesA[defaultSkinIndex]; + } + + if( m_originalSkinId == defaultSkinIndex ) + { + setCharacterSelected(true); + } setCharacterLocked(false); + + m_characters[eCharacter_Current].setVisible(true); } } else @@ -860,7 +870,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() if(uiCurrentFavoriteC>0) { // get the pack number from the skin id - swprintf(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(m_iPad,nextIndex)); + swprintf(chars, 256, L"dlcskin%08d.png", GET_DLC_SKIN_ID_FROM_BITMASK(app.GetPlayerFavoriteSkin(m_iPad,nextIndex))); Pack=app.m_dlcManager.getPackContainingSkin(chars); if(Pack) @@ -931,7 +941,7 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() if(uiCurrentFavoriteC>0) { // get the pack number from the skin id - swprintf(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(m_iPad,previousIndex)); + swprintf(chars, 256, L"dlcskin%08d.png", GET_DLC_SKIN_ID_FROM_BITMASK(app.GetPlayerFavoriteSkin(m_iPad,previousIndex))); Pack=app.m_dlcManager.getPackContainingSkin(chars); if(Pack) @@ -970,6 +980,43 @@ void UIScene_SkinSelectMenu::handleSkinIndexChanged() previousIndex = getPreviousSkinIndex(previousIndex); } + setCharacterFavourite(false); + int favCount = app.GetPlayerFavoriteSkinsCount(m_iPad); + if(favCount > 0) + { + for(int i = 0; i < favCount; i++) + { + unsigned int favSkinId = app.GetPlayerFavoriteSkin(m_iPad, i); + bool bFound = false; + + if(m_currentPack != nullptr) + { + DLCSkinFile *favSkinFile = m_currentPack->getSkinFile(m_skinIndex); + if(favSkinFile != nullptr && favSkinId == favSkinFile->getSkinID()) + { + bFound = true; + } + } + else if(m_packIndex == SKIN_SELECT_PACK_DEFAULT) + { + if(favSkinId == (unsigned int)m_skinIndex) + { + bFound = true; + } + } + else if(m_packIndex == SKIN_SELECT_PACK_FAVORITES) + { + bFound = true; + } + + if(bFound) + { + setCharacterFavourite(true); + break; + } + } + } + updateTooltips(); } @@ -1113,6 +1160,12 @@ int UIScene_SkinSelectMenu::getPreviousSkinIndex(DWORD sourceIndex) void UIScene_SkinSelectMenu::handlePackIndexChanged() { + // sync m_packIndex from flash MultiList selection + if(!m_bIgnoreInput && m_controlSkinButtonList.getItemCount() > 0) + { + m_packIndex = m_controlSkinButtonList.getCurrentSelection(); + } + if(m_packIndex >= SKIN_SELECT_MAX_DEFAULTS) { m_currentPack = app.m_dlcManager.getPack(m_packIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin); @@ -1146,87 +1199,93 @@ void UIScene_SkinSelectMenu::handlePackIndexChanged() case SKIN_SELECT_PACK_FAVORITES: if(app.GetPlayerFavoriteSkinsCount(m_iPad)>0) { - bool found; - wchar_t chars[256]; - // get the pack number from the skin id - swprintf(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(m_iPad,app.GetPlayerFavoriteSkinsPos(m_iPad))); - - DLCPack *Pack=app.m_dlcManager.getPackContainingSkin(chars); - if(Pack) + unsigned int favSkinId = app.GetPlayerFavoriteSkin(m_iPad,app.GetPlayerFavoriteSkinsPos(m_iPad)); + if(GET_IS_DLC_SKIN_FROM_BITMASK(favSkinId)) { - DWORD currentSkinIndex = Pack->getSkinIndexAt(m_currentSkinPath, found); - if(found) m_skinIndex = app.GetPlayerFavoriteSkinsPos(m_iPad); + bool found; + wchar_t chars[256]; + swprintf(chars, 256, L"dlcskin%08d.png", GET_DLC_SKIN_ID_FROM_BITMASK(favSkinId)); + + DLCPack *Pack=app.m_dlcManager.getPackContainingSkin(chars); + if(Pack) + { + Pack->getSkinIndexAt(m_currentSkinPath, found); + } } + m_skinIndex = app.GetPlayerFavoriteSkinsPos(m_iPad); } break; default: break; } } + // register pack image or whatever texture and set it on the BitmapIcon + wstring textureName = L"default"; + if(m_currentPack != nullptr) + { + DWORD packId = m_currentPack->GetPackId(); + if(packId >= 1) + { + wchar_t packIdStr[16]; + swprintf(packIdStr, 16, L"%i", packId); + textureName = packIdStr; + } + } + if(!registerTexture(textureName)) + { + textureName = L"default"; + registerTexture(textureName); + } + m_controlTexturePackIcon.setTextureName(textureName); + handleSkinIndexChanged(); - updatePackDisplay(); + SetSkinPackButtonList(); + setPackLabel(); } void UIScene_SkinSelectMenu::updatePackDisplay() { m_currentPackCount = app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin) + SKIN_SELECT_MAX_DEFAULTS; - if(m_packIndex >= SKIN_SELECT_MAX_DEFAULTS) +} + +void UIScene_SkinSelectMenu::handlePress(F64 controlId, F64 childId) +{ +} + +void UIScene_SkinSelectMenu::handleFocusChange(F64 controlId, F64 childId) +{ + if((int)controlId == 0) { - DLCPack *thisPack = app.m_dlcManager.getPack(m_packIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin); - setCentreLabel(thisPack->getName().c_str()); + m_controlSkinButtonList.updateChildFocus((int)childId); + m_bFocusDirty = true; } - else +} + +int UIScene_SkinSelectMenu::relativePackIndex(DWORD base, int offset) +{ + if(offset == 0) { - switch(m_packIndex) + if(m_bHasTexturePack && base == 2) { - case SKIN_SELECT_PACK_DEFAULT: - setCentreLabel(app.GetString(IDS_NO_SKIN_PACK)); - break; - case SKIN_SELECT_PACK_FAVORITES: - setCentreLabel(app.GetString(IDS_FAVORITES_SKIN_PACK)); - break; + return m_iTexturePackIndex; } + return base; } - int nextPackIndex = getNextPackIndex(m_packIndex); - if(nextPackIndex >= SKIN_SELECT_MAX_DEFAULTS) + int packCount = app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin); + int newIndex = base + offset; + + if(packCount + SKIN_SELECT_MAX_DEFAULTS < newIndex) { - DLCPack *thisPack = app.m_dlcManager.getPack(nextPackIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin); - setRightLabel(thisPack->getName().c_str()); + newIndex = SKIN_SELECT_PACK_DEFAULT; } - else + else if(newIndex < 0) { - switch(nextPackIndex) - { - case SKIN_SELECT_PACK_DEFAULT: - setRightLabel(app.GetString(IDS_NO_SKIN_PACK)); - break; - case SKIN_SELECT_PACK_FAVORITES: - setRightLabel(app.GetString(IDS_FAVORITES_SKIN_PACK)); - break; - } - } - - int previousPackIndex = getPreviousPackIndex(m_packIndex); - if(previousPackIndex >= SKIN_SELECT_MAX_DEFAULTS) - { - DLCPack *thisPack = app.m_dlcManager.getPack(previousPackIndex - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin); - setLeftLabel(thisPack->getName().c_str()); - } - else - { - switch(previousPackIndex) - { - case SKIN_SELECT_PACK_DEFAULT: - setLeftLabel(app.GetString(IDS_NO_SKIN_PACK)); - break; - case SKIN_SELECT_PACK_FAVORITES: - setLeftLabel(app.GetString(IDS_FAVORITES_SKIN_PACK)); - break; - } + newIndex = packCount + SKIN_SELECT_MAX_DEFAULTS; } + return newIndex; } int UIScene_SkinSelectMenu::getNextPackIndex(DWORD sourceIndex) @@ -1265,6 +1324,223 @@ int UIScene_SkinSelectMenu::getPreviousPackIndex(DWORD sourceIndex) return previousPack; } +void UIScene_SkinSelectMenu::SetSkinPackButtonList() +{ + if(!m_bNeedButtonListRefresh) + return; + + m_bNeedButtonListRefresh = false; + + TexturePack *selectedTP = Minecraft::GetInstance()->skins->getSelected(); + DLCPack *texturePackDLC = nullptr; + if(selectedTP != nullptr && !Minecraft::GetInstance()->skins->isUsingDefaultSkin()) + { + texturePackDLC = selectedTP->getDLCPack(); + } + + m_controlSkinButtonList.clearList(); + + m_controlSkinButtonList.AddNewButton(app.GetString(IDS_NO_SKIN_PACK), SKIN_SELECT_PACK_DEFAULT); + + m_controlSkinButtonList.AddNewButton(app.GetString(IDS_FAVORITES_SKIN_PACK), SKIN_SELECT_PACK_FAVORITES); + + m_bHasTexturePack = false; + if(texturePackDLC != nullptr) + { + DWORD tpPackId = texturePackDLC->GetPackId(); + if(tpPackId > 0x3FF) + { + wstring tpName = texturePackDLC->getName(); + if(texturePackDLC->getSkinCount() > 0) + { + m_controlSkinButtonList.AddNewButton(tpName, SKIN_SELECT_MAX_DEFAULTS); + m_bHasTexturePack = true; + } + } + } + // dlc pack buttons + int packCount = app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin); + int highlightIdx = m_packIndex; + + for(int i = 0; i < packCount; i++) + { + DLCPack *pack = app.m_dlcManager.getPack(i, DLCManager::e_DLCType_Skin); + if(pack != nullptr) + { + // skip the pack that matches the active texture pack + if(m_bHasTexturePack && texturePackDLC != nullptr) + { + if(pack->GetPackId() == texturePackDLC->GetPackId()) + { + m_iTexturePackIndex = i + SKIN_SELECT_MAX_DEFAULTS; + continue; + } + } + + wstring displayName = pack->getName(); + m_controlSkinButtonList.AddNewButton(displayName, i + SKIN_SELECT_MAX_DEFAULTS); + + if(m_currentPack != nullptr && pack->GetPackId() == m_currentPack->GetPackId()) + { + highlightIdx = i + SKIN_SELECT_MAX_DEFAULTS; + } + } + } + + m_controlSkinButtonList.HighlightItem(highlightIdx, true); +} + +void UIScene_SkinSelectMenu::setPackLabel() +{ + int relIdx = relativePackIndex(m_packIndex, 0); + + if(relIdx == 0) + { + m_labelPackName.setLabel(app.GetString(IDS_NO_SKIN_PACK)); + } + else if(relIdx == 1) + { + m_labelPackName.setLabel(app.GetString(IDS_FAVORITES_SKIN_PACK)); + } + else if(relIdx >= SKIN_SELECT_MAX_DEFAULTS) + { + DLCPack *pack = app.m_dlcManager.getPack(relIdx - SKIN_SELECT_MAX_DEFAULTS, DLCManager::e_DLCType_Skin); + if(pack != nullptr) + { + m_labelPackName.setLabel(pack->getName()); + } + else + { + m_labelPackName.setLabel(L""); + } + } + else + { + m_labelPackName.setLabel(L""); + } + + DWORD packId = 0; + if(m_currentPack != nullptr) + { + packId = m_currentPack->GetPackId(); + } + + if(packId >= 0x400) + { + m_labelPackType.setLabel(app.GetString(IDS_TEXTURE_PACK)); + } + else + { + m_labelPackType.setLabel(app.GetString(IDS_SKIN_PACK)); + } +} + +bool UIScene_SkinSelectMenu::registerTexture(const wstring &texturePath) +{ + wchar_t texPath[64]; + swprintf(texPath, 64, L"Graphics\\PackGraphics\\%ls.png", texturePath.c_str()); + + if(app.hasArchiveFile(texPath)) + { + byteArray fileData = app.getArchiveFile(texPath); + if(fileData.data != nullptr && fileData.length > 0) + { + registerSubstitutionTexture(texturePath, fileData.data, fileData.length); + return true; + } + } + return false; +} + +void UIScene_SkinSelectMenu::setActivePackIndex() +{ + int favCount = app.GetPlayerFavoriteSkinsCount(m_iPad); + if(favCount == 0) + { + return; + } + + if(app.m_dlcManager.getPackCount(DLCManager::e_DLCType_Skin) == 0) + { + return; + } + + m_currentPack = app.m_dlcManager.getPackContainingSkin(m_currentSkinPath); + + // check if current skin is in the favorites list + for(int i = 0; i < favCount; i++) + { + unsigned int favSkinId = app.GetPlayerFavoriteSkin(m_iPad, i); + if(favSkinId == m_originalSkinId) + { + m_packIndex = SKIN_SELECT_PACK_FAVORITES; + return; + } + } +} + +void UIScene_SkinSelectMenu::InputActionFavorite(unsigned int iPad) +{ + if(m_packIndex == SKIN_SELECT_PACK_DEFAULT) + { + SetFavoriteSkin(iPad, m_skinIndex); + handleSkinIndexChanged(); + } + else if(m_packIndex == SKIN_SELECT_PACK_FAVORITES) + { + int favCount = app.GetPlayerFavoriteSkinsCount(iPad); + if(favCount == 0) return; + + unsigned int skinId = app.GetPlayerFavoriteSkin(iPad, m_skinIndex); + + SetFavoriteSkin(iPad, skinId); + + int newCount = app.GetPlayerFavoriteSkinsCount(iPad); + if(newCount > 0 && newCount <= m_skinIndex) + m_skinIndex = newCount - 1; + + handleSkinIndexChanged(); + } + else if(m_currentPack != nullptr) + { + DLCSkinFile *skinFile = m_currentPack->getSkinFile(m_skinIndex); + if(skinFile == nullptr) return; + + SetFavoriteSkin(iPad, skinFile->getSkinID()); + m_bSkinIndexChanged = true; + return; + } + + unsigned int pos = app.GetPlayerFavoriteSkinsPos(iPad); + app.SetPlayerFavoriteSkinsPos(iPad, pos); +} + +void UIScene_SkinSelectMenu::SetFavoriteSkin(unsigned int pad, int skinId) +{ + int favCount = app.GetPlayerFavoriteSkinsCount(pad); + + for(int i = 0; i < favCount; i++) + { + if(app.GetPlayerFavoriteSkin(pad, i) == (unsigned int)skinId) + { + for(int j = i; j < favCount - 1; j++) + { + app.SetPlayerFavoriteSkin(pad, j, app.GetPlayerFavoriteSkin(pad, j + 1)); + } + app.SetPlayerFavoriteSkin(pad, favCount - 1, 0xFFFFFFFF); + setCharacterFavourite(false); + return; + } + } + + if(favCount < MAX_FAVORITE_SKINS) + { + app.SetPlayerFavoriteSkin(pad, favCount, skinId); + app.SetPlayerFavoriteSkinsPos(pad, favCount); + setCharacterFavourite(true); + } +} + void UIScene_SkinSelectMenu::setCharacterSelected(bool selected) { IggyDataValue result; @@ -1283,61 +1559,22 @@ void UIScene_SkinSelectMenu::setCharacterLocked(bool locked) IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetCharacterLocked , 1 , value ); } -void UIScene_SkinSelectMenu::setLeftLabel(const wstring &label) +void UIScene_SkinSelectMenu::setCharacterFavourite(bool favourite) { - if(label.compare(m_leftLabel) != 0) - { - m_leftLabel = label; - - IggyDataValue result; - IggyDataValue value[1]; - - IggyStringUTF16 stringVal; - stringVal.string = (IggyUTF16*)label.c_str(); - stringVal.length = label.length(); - - value[0].type = IGGY_DATATYPE_string_UTF16; - value[0].string16 = stringVal; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetLeftLabel , 1 , value ); - } + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_boolean; + value[0].boolval = favourite; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetCharacterFavourite , 1 , value ); } -void UIScene_SkinSelectMenu::setCentreLabel(const wstring &label) +void UIScene_SkinSelectMenu::setCharacterBlocked(bool blocked) { - if(label.compare(m_centreLabel) != 0) - { - m_centreLabel = label; - - IggyDataValue result; - IggyDataValue value[1]; - - IggyStringUTF16 stringVal; - stringVal.string = (IggyUTF16*)label.c_str(); - stringVal.length = label.length(); - - value[0].type = IGGY_DATATYPE_string_UTF16; - value[0].string16 = stringVal; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetCentreLabel , 1 , value ); - } -} - -void UIScene_SkinSelectMenu::setRightLabel(const wstring &label) -{ - if(label.compare(m_rightLabel) != 0) - { - m_rightLabel = label; - - IggyDataValue result; - IggyDataValue value[1]; - - IggyStringUTF16 stringVal; - stringVal.string = (IggyUTF16*)label.c_str(); - stringVal.length = label.length(); - - value[0].type = IGGY_DATATYPE_string_UTF16; - value[0].string16 = stringVal; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetRightLabel , 1 , value ); - } + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_boolean; + value[0].boolval = blocked; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetCharacterBlocked , 1 , value ); } #ifdef __PSVITA__ @@ -1498,7 +1735,7 @@ void UIScene_SkinSelectMenu::HandleDLCInstalled() m_bIgnoreInput=true; m_controlTimer.setVisible( true ); m_controlIggyCharacters.setVisible( false ); - m_controlSkinNamePlate.setVisible( false ); + //m_controlSkinNamePlate.setVisible( false ); } // this will send a CustomMessage_DLCMountingComplete when done @@ -1518,7 +1755,7 @@ void UIScene_SkinSelectMenu::HandleDLCMountingComplete() app.DebugPrintf(4,"UIScene_SkinSelectMenu::HandleDLCMountingComplete\n"); m_controlTimer.setVisible( false ); m_controlIggyCharacters.setVisible( true ); - m_controlSkinNamePlate.setVisible( true ); + //m_controlSkinNamePlate.setVisible( true ); m_packIndex = SKIN_SELECT_PACK_DEFAULT; @@ -1712,16 +1949,12 @@ void UIScene_SkinSelectMenu::handleReload() // Reinitialise a few values to prevent problems on reload m_bIgnoreInput=false; - m_currentNavigation = eSkinNavigation_Skin; + //m_currentNavigation = eSkinNavigation_Skin; m_currentPackCount = 0; m_labelSkinName.init(L""); m_labelSkinOrigin.init(L""); - m_leftLabel = L""; - m_centreLabel = L""; - m_rightLabel = L""; - handlePackIndexChanged(); } diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h index f75494a8..c7f0ad43 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h @@ -2,6 +2,8 @@ #include "../../../Minecraft.World/Definitions.h" #include "UIScene.h" #include "UIControl_PlayerSkinPreview.h" +#include "UIControl_MultiList.h" +#include "UIControl_BitmapIcon.h" class UIScene_SkinSelectMenu : public UIScene { @@ -9,7 +11,7 @@ private: static const WCHAR *wchDefaultNamesA[eDefaultSkins_Count]; // 4J Stu - How many to show on each side of the main control - static const BYTE sidePreviewControls = 4; + static const BYTE sidePreviewControls = 2; #ifdef __PSVITA__ enum ETouchInput @@ -33,45 +35,37 @@ private: enum ECharacters { - eCharacter_Current, - eCharacter_Next1, - eCharacter_Next2, - eCharacter_Next3, - eCharacter_Next4, - eCharacter_Previous1, - eCharacter_Previous2, - eCharacter_Previous3, - eCharacter_Previous4, + eCharacter_Current = 0, + eCharacter_Next1 = 1, + eCharacter_Next2 = 2, + eCharacter_Previous1 = 5, + eCharacter_Previous2 = 6, - eCharacter_COUNT, + eCharacter_COUNT = 7, }; UIControl_PlayerSkinPreview m_characters[eCharacter_COUNT]; UIControl_Label m_labelSkinName, m_labelSkinOrigin; - UIControl_Label m_labelSelected; - UIControl m_controlSkinNamePlate, m_controlSelectedPanel, m_controlIggyCharacters, m_controlTimer; -#ifdef __PSVITA__ - UIControl_Touch m_TouchTabLeft, m_TouchTabRight, m_TouchTabCenter, m_TouchIggyCharacters; -#endif + UIControl m_controlBlocked, m_controlFavourite, m_controlLocked, m_controlSelected; + UIControl_Label m_labelPackName, m_labelPackType; + UIControl_MultiList m_controlSkinButtonList; + UIControl_BitmapIcon m_controlTexturePackIcon; + UIControl m_controlIggyCharacters, m_controlTimer; IggyName m_funcSetPlayerCharacterSelected, m_funcSetCharacterLocked; - IggyName m_funcSetLeftLabel, m_funcSetRightLabel, m_funcSetCentreLabel; + IggyName m_funcSetCharacterFavourite, m_funcSetCharacterBlocked; UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) -#ifdef __PSVITA__ - UI_MAP_ELEMENT( m_TouchTabLeft, "TouchTabLeft" ) - UI_MAP_ELEMENT( m_TouchTabRight, "TouchTabRight" ) - UI_MAP_ELEMENT( m_TouchTabCenter, "TouchTabCenter" ) - UI_MAP_ELEMENT( m_TouchIggyCharacters, "TouchIggyCharacters" ) -#endif - UI_MAP_ELEMENT( m_controlSkinNamePlate, "SkinNamePlate") - UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlSkinNamePlate ) - UI_MAP_ELEMENT( m_labelSkinName, "SkinTitle1") - UI_MAP_ELEMENT( m_labelSkinOrigin, "SkinTitle2") - UI_END_MAP_CHILD_ELEMENTS() - - UI_MAP_ELEMENT( m_controlSelectedPanel, "SelectedPanel" ) - UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlSelectedPanel ) - UI_MAP_ELEMENT( m_labelSelected, "SelectedPanelLabel" ) - UI_END_MAP_CHILD_ELEMENTS() + UI_MAP_ELEMENT( m_controlBlocked, "Blocked" ) + UI_MAP_ELEMENT( m_controlFavourite, "Favourite" ) + UI_MAP_ELEMENT( m_controlLocked, "Locked" ) + UI_MAP_ELEMENT( m_controlSelected, "Selected" ) + + UI_MAP_ELEMENT( m_labelSkinName, "SkinTitle1" ) + UI_MAP_ELEMENT( m_labelSkinOrigin, "SkinTitle2" ) + UI_MAP_ELEMENT( m_labelPackName, "Pack_Name" ) + UI_MAP_ELEMENT( m_labelPackType, "Pack_Type" ) + + UI_MAP_ELEMENT( m_controlTexturePackIcon, "TexturePackIcon" ) + UI_MAP_ELEMENT( m_controlSkinButtonList, "SkinButtonList" ) UI_MAP_ELEMENT( m_controlTimer, "Timer" ) @@ -82,21 +76,17 @@ private: UI_MAP_ELEMENT( m_characters[eCharacter_Next1], "iggy_Character1" ) UI_MAP_ELEMENT( m_characters[eCharacter_Next2], "iggy_Character2" ) - UI_MAP_ELEMENT( m_characters[eCharacter_Next3], "iggy_Character3" ) - UI_MAP_ELEMENT( m_characters[eCharacter_Next4], "iggy_Character4" ) + UI_MAP_ELEMENT( m_characters[3], "iggy_Character3" ) + UI_MAP_ELEMENT( m_characters[4], "iggy_Character4" ) UI_MAP_ELEMENT( m_characters[eCharacter_Previous1], "iggy_Character5" ) UI_MAP_ELEMENT( m_characters[eCharacter_Previous2], "iggy_Character6" ) - UI_MAP_ELEMENT( m_characters[eCharacter_Previous3], "iggy_Character7" ) - UI_MAP_ELEMENT( m_characters[eCharacter_Previous4], "iggy_Character8" ) UI_END_MAP_CHILD_ELEMENTS() UI_MAP_NAME( m_funcSetPlayerCharacterSelected, L"SetPlayerCharacterSelected" ) UI_MAP_NAME( m_funcSetCharacterLocked, L"SetCharacterLocked" ) - - UI_MAP_NAME( m_funcSetLeftLabel, L"SetLeftLabel" ) - UI_MAP_NAME( m_funcSetCentreLabel, L"SetCenterLabel" ) - UI_MAP_NAME( m_funcSetRightLabel, L"SetRightLabel" ) + UI_MAP_NAME( m_funcSetCharacterFavourite, L"SetCharacterFavourite" ) + UI_MAP_NAME( m_funcSetCharacterBlocked, L"SetCharacterBlocked" ) UI_END_MAP_ELEMENTS_AND_NAMES() DLCPack *m_currentPack; @@ -112,7 +102,10 @@ private: DWORD m_currentPackCount; bool m_bIgnoreInput; bool m_bSkinIndexChanged; - wstring m_leftLabel, m_centreLabel, m_rightLabel; + bool m_bFocusDirty; + bool m_bNeedButtonListRefresh; + bool m_bHasTexturePack; + int m_iTexturePackIndex; S32 m_iTouchXStart; bool m_bTouchScrolled; @@ -131,6 +124,7 @@ public: virtual void handleAnimationEnd(); + virtual void handleFocusChange(F64 controlId, F64 childId); protected: // TODO: This should be pure virtual in this class @@ -156,10 +150,14 @@ private: void setCharacterSelected(bool selected); void setCharacterLocked(bool locked); - - void setLeftLabel(const wstring &label); - void setCentreLabel(const wstring &label); - void setRightLabel(const wstring &label); + void setCharacterFavourite(bool favourite); + void setCharacterBlocked(bool blocked); + void SetSkinPackButtonList(); + void setPackLabel(); + int relativePackIndex(DWORD base, int offset); + void handlePress(F64 controlId, F64 childId); + void setActivePackIndex(); + bool registerTexture(const wstring &texturePath); virtual void HandleDLCMountingComplete(); virtual void HandleDLCInstalled(); @@ -174,6 +172,8 @@ private: void AddFavoriteSkin(int iPad,int iSkinID); void InputActionOK(unsigned int iPad); + void InputActionFavorite(unsigned int iPad); + void SetFavoriteSkin(unsigned int pad, int skinId); #ifdef __PSVITA__ virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased); #endif //__PSVITA__ diff --git a/Minecraft.Client/Windows64Media/loc/stringsGeneric.xml b/Minecraft.Client/Windows64Media/loc/stringsGeneric.xml index 7286bfb9..e82cdd02 100644 --- a/Minecraft.Client/Windows64Media/loc/stringsGeneric.xml +++ b/Minecraft.Client/Windows64Media/loc/stringsGeneric.xml @@ -9646,4 +9646,20 @@ All Ender Chests in a world are linked. Items placed into an Ender Chest are acc Copying Save + + + Texture Pack + + + + Skin Pack + + + + Add Favorite + + + + Remove Favorite +