Add 2x2 classic crafting

This commit is contained in:
GabsPuNs
2026-04-01 01:24:32 -04:00
parent 04ff325a8a
commit 3523e3450c
9 changed files with 349 additions and 192 deletions

View File

@@ -409,15 +409,11 @@ bool CMinecraftApp::LoadInventoryMenu(int iPad,shared_ptr<LocalPlayer> player,bo
initData->iPad = iPad;
if(app.GetLocalPlayerCount()>1)
{
initData->bSplitscreen=true;
success = ui.NavigateToScene(iPad,eUIScene_InventoryMenu,initData);
}
else
{
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_InventoryMenu,initData);
}
success = ui.NavigateToScene(iPad,eUIScene_InventoryMenu,initData);
return success;
}
@@ -432,15 +428,11 @@ bool CMinecraftApp::LoadCreativeMenu(int iPad,shared_ptr<LocalPlayer> player,boo
initData->iPad = iPad;
if(app.GetLocalPlayerCount()>1)
{
initData->bSplitscreen=true;
success = ui.NavigateToScene(iPad,eUIScene_CreativeMenu,initData);
}
else
{
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_CreativeMenu,initData);
}
success = ui.NavigateToScene(iPad,eUIScene_CreativeMenu,initData);
return success;
}
@@ -458,15 +450,11 @@ bool CMinecraftApp::LoadCrafting2x2Menu(int iPad,shared_ptr<LocalPlayer> player)
initData->z = 0;
if(app.GetLocalPlayerCount()>1)
{
initData->bSplitscreen=true;
success = ui.NavigateToScene(iPad,eUIScene_Crafting2x2Menu, initData);
}
else
{
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_Crafting2x2Menu, initData);
}
success = ui.NavigateToScene(iPad,eUIScene_Crafting2x2Menu, initData);
return success;
}
@@ -483,24 +471,15 @@ bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,shared_ptr<LocalPlayer> player,
initData->y = y;
initData->z = z;
if(app.GetLocalPlayerCount()>1)
{
initData->bSplitscreen=true;
}
else
{
initData->bSplitscreen=false;
}
if(app.GetGameSettings(iPad,eGameSetting_ClassicCrafting))
{
success = ui.NavigateToScene(iPad,eUIScene_ClassicCraftingMenu, initData);
}
else
{
success = ui.NavigateToScene(iPad,eUIScene_Crafting3x3Menu, initData);
}
return success;
}
@@ -517,15 +496,11 @@ bool CMinecraftApp::LoadFireworksMenu(int iPad,shared_ptr<LocalPlayer> player, i
initData->z = z;
if(app.GetLocalPlayerCount()>1)
{
initData->bSplitscreen=true;
success = ui.NavigateToScene(iPad,eUIScene_FireworksMenu, initData);
}
else
{
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_FireworksMenu, initData);
}
success = ui.NavigateToScene(iPad,eUIScene_FireworksMenu, initData);
return success;
}
@@ -544,15 +519,11 @@ bool CMinecraftApp::LoadEnchantingMenu(int iPad,shared_ptr<Inventory> inventory,
initData->name = name;
if(app.GetLocalPlayerCount()>1)
{
initData->bSplitscreen=true;
success = ui.NavigateToScene(iPad,eUIScene_EnchantingMenu, initData);
}
else
{
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_EnchantingMenu, initData);
}
success = ui.NavigateToScene(iPad,eUIScene_EnchantingMenu, initData);
return success;
}
@@ -569,15 +540,11 @@ bool CMinecraftApp::LoadFurnaceMenu(int iPad,shared_ptr<Inventory> inventory, sh
// Load the scene.
if(app.GetLocalPlayerCount()>1)
{
initData->bSplitscreen=true;
success = ui.NavigateToScene(iPad,eUIScene_FurnaceMenu, initData);
}
else
{
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_FurnaceMenu, initData);
}
success = ui.NavigateToScene(iPad,eUIScene_FurnaceMenu, initData);
return success;
}
@@ -594,15 +561,11 @@ bool CMinecraftApp::LoadBrewingStandMenu(int iPad,shared_ptr<Inventory> inventor
// Load the scene.
if(app.GetLocalPlayerCount()>1)
{
initData->bSplitscreen=true;
success = ui.NavigateToScene(iPad,eUIScene_BrewingStandMenu, initData);
}
else
{
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_BrewingStandMenu, initData);
}
success = ui.NavigateToScene(iPad,eUIScene_BrewingStandMenu, initData);
return success;
}
@@ -624,14 +587,11 @@ bool CMinecraftApp::LoadContainerMenu(int iPad,shared_ptr<Container> inventory,
initData->bSplitscreen=true;
bool bLargeChest = (initData->container->getContainerSize() > 3*9)?true:false;
if(bLargeChest)
{
success = ui.NavigateToScene(iPad,eUIScene_LargeContainerMenu,initData);
}
else
{
success = ui.NavigateToScene(iPad,eUIScene_ContainerMenu,initData);
}
}
else
{
@@ -654,15 +614,11 @@ bool CMinecraftApp::LoadTrapMenu(int iPad,shared_ptr<Container> inventory, share
// Load the scene.
if(app.GetLocalPlayerCount()>1)
{
initData->bSplitscreen=true;
success = ui.NavigateToScene(iPad,eUIScene_DispenserMenu, initData);
}
else
{
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_DispenserMenu, initData);
}
success = ui.NavigateToScene(iPad,eUIScene_DispenserMenu, initData);
return success;
}
@@ -694,8 +650,11 @@ bool CMinecraftApp::LoadRepairingMenu(int iPad,shared_ptr<Inventory> inventory,
initData->y = y;
initData->z = z;
initData->iPad = iPad;
if(app.GetLocalPlayerCount()>1) initData->bSplitscreen=true;
else initData->bSplitscreen=false;
if(app.GetLocalPlayerCount()>1)
initData->bSplitscreen=true;
else
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_AnvilMenu, initData);
@@ -711,8 +670,11 @@ bool CMinecraftApp::LoadTradingMenu(int iPad, shared_ptr<Inventory> inventory, s
initData->trader = trader;
initData->level = level;
initData->iPad = iPad;
if(app.GetLocalPlayerCount()>1) initData->bSplitscreen=true;
else initData->bSplitscreen=false;
if(app.GetLocalPlayerCount()>1)
initData->bSplitscreen=true;
else
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_TradingMenu, initData);
@@ -727,8 +689,11 @@ bool CMinecraftApp::LoadHopperMenu(int iPad ,shared_ptr<Inventory> inventory, sh
initData->inventory = inventory;
initData->hopper = hopper;
initData->iPad = iPad;
if(app.GetLocalPlayerCount()>1) initData->bSplitscreen=true;
else initData->bSplitscreen=false;
if(app.GetLocalPlayerCount()>1)
initData->bSplitscreen=true;
else
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_HopperMenu, initData);
@@ -743,8 +708,11 @@ bool CMinecraftApp::LoadHopperMenu(int iPad ,shared_ptr<Inventory> inventory, sh
initData->inventory = inventory;
initData->hopper = dynamic_pointer_cast<Container>(hopper);
initData->iPad = iPad;
if(app.GetLocalPlayerCount()>1) initData->bSplitscreen=true;
else initData->bSplitscreen=false;
if(app.GetLocalPlayerCount()>1)
initData->bSplitscreen=true;
else
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_HopperMenu, initData);
@@ -761,8 +729,11 @@ bool CMinecraftApp::LoadHorseMenu(int iPad ,shared_ptr<Inventory> inventory, sha
initData->container = container;
initData->horse = horse;
initData->iPad = iPad;
if(app.GetLocalPlayerCount()>1) initData->bSplitscreen=true;
else initData->bSplitscreen=false;
if(app.GetLocalPlayerCount()>1)
initData->bSplitscreen=true;
else
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_HorseMenu, initData);
@@ -777,8 +748,11 @@ bool CMinecraftApp::LoadBeaconMenu(int iPad ,shared_ptr<Inventory> inventory, sh
initData->inventory = inventory;
initData->beacon = beacon;
initData->iPad = iPad;
if(app.GetLocalPlayerCount()>1) initData->bSplitscreen=true;
else initData->bSplitscreen=false;
if(app.GetLocalPlayerCount()>1)
initData->bSplitscreen=true;
else
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_BeaconMenu, initData);

View File

@@ -43,6 +43,8 @@ protected:
eSectionInventoryUsing,
eSectionInventoryInventory,
eSectionInventoryArmor,
eSectionInventoryCraftingGrid,
eSectionInventoryCraftingResult,
eSectionInventoryMax,
eSectionTrapUsing,

View File

@@ -109,17 +109,17 @@ int IUIScene_ClassicCraftingMenu::getSectionStartOffset(ESceneSection eSection)
switch( eSection )
{
case eSectionClassicCraftingHotbar:
offset = CraftingMenu::INV_SLOT_START + 27;
break;
offset = CraftingMenu::INV_SLOT_START + 27;
break;
case eSectionClassicCraftingInventory:
offset = CraftingMenu::INV_SLOT_START;
break;
offset = CraftingMenu::INV_SLOT_START;
break;
case eSectionClassicCraftingGrid:
offset = CraftingMenu::CRAFT_SLOT_START;
break;
offset = CraftingMenu::CRAFT_SLOT_START;
break;
case eSectionClassicCraftingResult:
offset = CraftingMenu::RESULT_SLOT;
break;
offset = CraftingMenu::RESULT_SLOT;
break;
default:
assert( false );
break;

View File

@@ -1,53 +1,144 @@
#include "stdafx.h"
#include "IUIScene_InventoryMenu.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
#include "..\..\Minecraft.h"
#include "..\..\MultiPlayerLocalPlayer.h"
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_InventoryMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY )
{
ESceneSection newSection = eSection;
Minecraft *pMinecraft = Minecraft::GetInstance();
// Find the new section if there is one
switch( eSection )
{
case eSectionInventoryArmor:
if(eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryInventory;
}
else if(eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryUsing;
}
break;
case eSectionInventoryInventory:
if(eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryUsing;
}
else if(eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryArmor;
}
break;
case eSectionInventoryUsing:
if(eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryArmor;
}
else if(eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryInventory;
}
break;
ESceneSection newSection = eSection;
int xOffset = 0;
int yOffset = 0;
//auto containerData = this->m_containerData;
switch( eSection )
{
case eSectionInventoryInventory:
if(eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryUsing;
}
else if(eTapDirection == eTapStateUp)
{
if (app.GetGameSettings(getPad(),eGameSetting_ClassicCrafting) && *piTargetX >= 3)
{
if (*piTargetX < 7) {
newSection = eSectionInventoryCraftingGrid;
xOffset = 5;
} else {
newSection = eSectionInventoryCraftingResult;
}
}
else
{
newSection = eSectionInventoryArmor;
}
}
break;
case eSectionInventoryUsing:
if(eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryInventory;
}
else if(eTapDirection == eTapStateDown)
{
if (app.GetGameSettings(getPad(),eGameSetting_ClassicCrafting) && *piTargetX >= 3)
{
if (*piTargetX < 7) {
newSection = eSectionInventoryCraftingGrid;
xOffset = 5;
} else {
newSection = eSectionInventoryCraftingResult;
}
}
else
{
newSection = eSectionInventoryArmor;
}
}
break;
case eSectionInventoryArmor:
if(eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryInventory;
}
else if(eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryUsing;
}
else if(eTapDirection == eTapStateLeft && app.GetGameSettings(getPad(),eGameSetting_ClassicCrafting))
{
newSection = eSectionInventoryCraftingResult;
}
else if(eTapDirection == eTapStateRight && app.GetGameSettings(getPad(),eGameSetting_ClassicCrafting))
{
newSection = eSectionInventoryCraftingGrid;
xOffset = 1;
yOffset = 1;
}
break;
case eSectionInventoryCraftingGrid:
if (app.GetGameSettings(getPad(),eGameSetting_ClassicCrafting))
{
if(eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryUsing;
xOffset = -5;
}
else if(eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryInventory;
xOffset = -5;
}
else if(eTapDirection == eTapStateLeft)
{
newSection = eSectionInventoryArmor;
yOffset = -1;
}
else if(eTapDirection == eTapStateRight)
{
newSection = eSectionInventoryCraftingResult;
}
}
break;
case eSectionInventoryCraftingResult:
if (app.GetGameSettings(getPad(),eGameSetting_ClassicCrafting))
{
if(eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryUsing;
xOffset = -8;
}
else if(eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryInventory;
xOffset = -8;
}
else if(eTapDirection == eTapStateLeft)
{
newSection = eSectionInventoryCraftingGrid;
//*piTargetX = containerData->getSectionColumns(eSectionInventoryCraftingGrid);
}
else if(eTapDirection == eTapStateRight)
{
newSection = eSectionInventoryArmor;
}
}
break;
default:
assert( false );
break;
}
}
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, 0);
IUIScene_AbstractContainerMenu::updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset, yOffset);
return newSection;
return newSection;
}
int IUIScene_InventoryMenu::getSectionStartOffset(ESceneSection eSection)
@@ -64,6 +155,12 @@ int IUIScene_InventoryMenu::getSectionStartOffset(ESceneSection eSection)
case eSectionInventoryUsing:
offset = InventoryMenu::INV_SLOT_START + 27;
break;
case eSectionInventoryCraftingGrid:
offset = InventoryMenu::CRAFT_SLOT_START;
break;
case eSectionInventoryCraftingResult:
offset = InventoryMenu::RESULT_SLOT;
break;
default:
assert( false );
break;

View File

@@ -23,6 +23,7 @@ UIScene_ClassicCraftingMenu::UIScene_ClassicCraftingMenu(int iPad, void *_initDa
gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_3x3Crafting_Menu, this);
}
//TODO: Add Fireworks check
CraftingMenu *m_menu = new CraftingMenu(initData->player->inventory, initData->player->level, initData->x, initData->y, initData->z);
Initialize( initData->iPad, m_menu, true, CraftingMenu::INV_SLOT_START, eSectionClassicCraftingHotbar, eSectionClassicCraftingMax );
@@ -38,13 +39,9 @@ UIScene_ClassicCraftingMenu::UIScene_ClassicCraftingMenu(int iPad, void *_initDa
wstring UIScene_ClassicCraftingMenu::getMoviePath()
{
if(app.GetLocalPlayerCount() > 1)
{
return L"ClassicCraftingMenuSplit";
}
else
{
return L"ClassicCraftingMenu";
}
}
void UIScene_ClassicCraftingMenu::handleReload()
@@ -60,21 +57,21 @@ int UIScene_ClassicCraftingMenu::getSectionColumns(ESceneSection eSection)
int cols = 0;
switch( eSection )
{
case eSectionClassicCraftingHotbar:
cols = 9;
break;
case eSectionClassicCraftingInventory:
cols = 9;
break;
case eSectionClassicCraftingGrid:
cols = 3;
break;
case eSectionClassicCraftingResult:
cols = 1;
break;
default:
assert( false );
break;
case eSectionClassicCraftingHotbar:
cols = 9;
break;
case eSectionClassicCraftingInventory:
cols = 9;
break;
case eSectionClassicCraftingGrid:
cols = 3;
break;
case eSectionClassicCraftingResult:
cols = 1;
break;
default:
assert( false );
break;
}
return cols;
}
@@ -84,21 +81,21 @@ int UIScene_ClassicCraftingMenu::getSectionRows(ESceneSection eSection)
int rows = 0;
switch( eSection )
{
case eSectionClassicCraftingHotbar:
rows = 1;
break;
case eSectionClassicCraftingInventory:
rows = 3;
break;
case eSectionClassicCraftingGrid:
rows = 3;
break;
case eSectionClassicCraftingResult:
rows = 1;
break;
default:
assert( false );
break;
case eSectionClassicCraftingHotbar:
rows = 1;
break;
case eSectionClassicCraftingInventory:
rows = 3;
break;
case eSectionClassicCraftingGrid:
rows = 3;
break;
case eSectionClassicCraftingResult:
rows = 1;
break;
default:
assert( false );
break;
}
return rows;
}
@@ -107,25 +104,25 @@ void UIScene_ClassicCraftingMenu::GetPositionOfSection( ESceneSection eSection,
{
switch( eSection )
{
case eSectionClassicCraftingHotbar:
pPosition->x = m_slotListHotbar.getXPos();
pPosition->y = m_slotListHotbar.getYPos();
break;
case eSectionClassicCraftingInventory:
pPosition->x = m_slotListInventory.getXPos();
pPosition->y = m_slotListInventory.getYPos();
break;
case eSectionClassicCraftingGrid:
pPosition->x = m_slotListCrafting.getXPos();
pPosition->y = m_slotListCrafting.getYPos();
break;
case eSectionClassicCraftingResult:
pPosition->x = m_slotListResult.getXPos();
pPosition->y = m_slotListResult.getYPos();
break;
default:
assert( false );
break;
case eSectionClassicCraftingHotbar:
pPosition->x = m_slotListHotbar.getXPos();
pPosition->y = m_slotListHotbar.getYPos();
break;
case eSectionClassicCraftingInventory:
pPosition->x = m_slotListInventory.getXPos();
pPosition->y = m_slotListInventory.getYPos();
break;
case eSectionClassicCraftingGrid:
pPosition->x = m_slotListCrafting.getXPos();
pPosition->y = m_slotListCrafting.getYPos();
break;
case eSectionClassicCraftingResult:
pPosition->x = m_slotListResult.getXPos();
pPosition->y = m_slotListResult.getYPos();
break;
default:
assert( false );
break;
}
}

View File

@@ -25,6 +25,19 @@ UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void *_initData, UILayer
InventoryScreenInput *initData = static_cast<InventoryScreenInput *>(_initData);
if (app.GetGameSettings(iPad,eGameSetting_ClassicCrafting))
{
m_slotListCrafting.addSlots(InventoryMenu::CRAFT_SLOT_START, 4);
m_slotListResult.addSlots(InventoryMenu::RESULT_SLOT, 1);
m_labelCrafting.init(L"Crafting");
this->m_bIsClassicCrafting = true;
}
else
this->m_bIsClassicCrafting = false;
SetClassicCrafting(this->m_bIsClassicCrafting);
Minecraft *pMinecraft = Minecraft::GetInstance();
if( pMinecraft->localgameModes[initData->iPad] != nullptr )
{
@@ -37,16 +50,17 @@ UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void *_initData, UILayer
initData->player->awardStat(GenericStats::openInventory(),GenericStats::param_openInventory());
Initialize( initData->iPad, menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, initData->bNavigateBack );
if (this->m_bIsClassicCrafting)
Initialize( initData->iPad, menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, initData->bNavigateBack );
else
Initialize( initData->iPad, menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryCraftingGrid, initData->bNavigateBack );
m_slotListArmor.addSlots(InventoryMenu::ARMOR_SLOT_START, InventoryMenu::ARMOR_SLOT_END - InventoryMenu::ARMOR_SLOT_START);
if(initData) delete initData;
for(unsigned int i = 0; i < MobEffect::NUM_EFFECTS; ++i)
{
m_bEffectTime[i] = 0;
}
updateEffectsDisplay();
addTimer(INVENTORY_UPDATE_EFFECTS_TIMER_ID,INVENTORY_UPDATE_EFFECTS_TIMER_TIME);
@@ -55,25 +69,27 @@ UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void *_initData, UILayer
wstring UIScene_InventoryMenu::getMoviePath()
{
if(app.GetLocalPlayerCount() > 1)
{
return L"InventoryMenuSplit";
}
else
{
return L"InventoryMenu";
}
}
void UIScene_InventoryMenu::handleReload()
{
Initialize( m_iPad, m_menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, m_bNavigateBack );
SetClassicCrafting(this->m_bIsClassicCrafting);
m_slotListArmor.addSlots(InventoryMenu::ARMOR_SLOT_START, InventoryMenu::ARMOR_SLOT_END - InventoryMenu::ARMOR_SLOT_START);
if (this->m_bIsClassicCrafting)
{
m_slotListCrafting.addSlots(InventoryMenu::CRAFT_SLOT_START, 4);
m_slotListResult.addSlots(InventoryMenu::RESULT_SLOT, 1);
}
for(unsigned int i = 0; i < MobEffect::NUM_EFFECTS; ++i)
{
m_bEffectTime[i] = 0;
}
}
int UIScene_InventoryMenu::getSectionColumns(ESceneSection eSection)
@@ -90,6 +106,12 @@ int UIScene_InventoryMenu::getSectionColumns(ESceneSection eSection)
case eSectionInventoryUsing:
cols = 9;
break;
case eSectionInventoryCraftingGrid:
cols = 2;
break;
case eSectionInventoryCraftingResult:
cols = 1;
break;
default:
assert( false );
break;
@@ -111,6 +133,12 @@ int UIScene_InventoryMenu::getSectionRows(ESceneSection eSection)
case eSectionInventoryUsing:
rows = 1;
break;
case eSectionInventoryCraftingGrid:
rows = 2;
break;
case eSectionInventoryCraftingResult:
rows = 1;
break;
default:
assert( false );
break;
@@ -134,6 +162,14 @@ void UIScene_InventoryMenu::GetPositionOfSection( ESceneSection eSection, UIVec2
pPosition->x = m_slotListHotbar.getXPos();
pPosition->y = m_slotListHotbar.getYPos();
break;
case eSectionInventoryCraftingGrid:
pPosition->x = m_slotListCrafting.getXPos();
pPosition->y = m_slotListCrafting.getYPos();
break;
case eSectionInventoryCraftingResult:
pPosition->x = m_slotListResult.getXPos();
pPosition->y = m_slotListResult.getYPos();
break;
default:
assert( false );
break;
@@ -158,6 +194,14 @@ void UIScene_InventoryMenu::GetItemScreenData( ESceneSection eSection, int iItem
sectionSize.x = m_slotListHotbar.getWidth();
sectionSize.y = m_slotListHotbar.getHeight();
break;
case eSectionInventoryCraftingGrid:
sectionSize.x = m_slotListCrafting.getWidth();
sectionSize.y = m_slotListCrafting.getHeight();
break;
case eSectionInventoryCraftingResult:
sectionSize.x = m_slotListResult.getWidth();
sectionSize.y = m_slotListResult.getHeight();
break;
default:
assert( false );
break;
@@ -194,6 +238,15 @@ void UIScene_InventoryMenu::setSectionSelectedSlot(ESceneSection eSection, int x
case eSectionInventoryUsing:
slotList = &m_slotListHotbar;
break;
case eSectionInventoryCraftingGrid:
slotList = &m_slotListCrafting;
break;
case eSectionInventoryCraftingResult:
slotList = &m_slotListResult;
break;
default:
assert( false );
break;
}
slotList->setHighlightSlot(index);
@@ -213,6 +266,15 @@ UIControl *UIScene_InventoryMenu::getSection(ESceneSection eSection)
case eSectionInventoryUsing:
control = &m_slotListHotbar;
break;
case eSectionInventoryCraftingGrid:
control = &m_slotListCrafting;
break;
case eSectionInventoryCraftingResult:
control = &m_slotListResult;
break;
default:
assert( false );
break;
}
return control;
}
@@ -234,9 +296,7 @@ void UIScene_InventoryMenu::customDraw(IggyCustomDrawCallbackRegion *region)
ui.endCustomDraw(region);
}
else
{
UIScene_AbstractContainerMenu::customDraw(region);
}
}
void UIScene_InventoryMenu::handleTimerComplete(int id)
@@ -330,3 +390,19 @@ void UIScene_InventoryMenu::updateEffectsDisplay()
delete activeEffects;
}
void UIScene_InventoryMenu::SetClassicCrafting(bool m_bIsClassicCrafting)
{
IggyDataValue result;
IggyDataValue arg;
arg.type = IGGY_DATATYPE_boolean;
arg.boolval = m_bIsClassicCrafting;
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetClassicCrafting , 1 , &arg );
if (!m_bIsClassicCrafting)
{
m_slotListArmor.UpdateControl();
m_playerPreview.UpdateControl();
}
}

View File

@@ -12,20 +12,32 @@ class UIScene_InventoryMenu : public UIScene_AbstractContainerMenu, public IUISc
friend class UIControl_MinecraftPlayer;
private:
int m_bEffectTime[MobEffect::NUM_EFFECTS];
int m_bIsClassicCrafting;
void updateEffectsDisplay();
void SetClassicCrafting(bool m_bIsClassicCrafting);
public:
UIScene_InventoryMenu(int iPad, void *initData, UILayer *parentLayer);
virtual EUIScene getSceneType() { return eUIScene_InventoryMenu;}
virtual EUIScene getSceneType() { return eUIScene_InventoryMenu; }
protected:
UIControl_SlotList m_slotListArmor;
UIControl_SlotList m_slotListArmor, m_slotListCrafting, m_slotListResult;
UIControl_MinecraftPlayer m_playerPreview;
IggyName m_funcUpdateEffects, m_funcAddEffect;
UIControl_Label m_labelCrafting;
IggyName m_funcSetClassicCrafting, m_funcUpdateEffects, m_funcAddEffect;
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene_AbstractContainerMenu)
UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlMainPanel )
UI_MAP_ELEMENT( m_slotListArmor, "armorList")
UI_MAP_ELEMENT( m_playerPreview, "iggy_player")
UI_MAP_ELEMENT( m_slotListCrafting, "craftingList")
UI_MAP_ELEMENT( m_slotListResult, "Result")
UI_MAP_ELEMENT( m_labelCrafting, "craftingLabel")
UI_MAP_NAME( m_funcSetClassicCrafting, L"SetClassicCrafting")
UI_MAP_NAME( m_funcUpdateEffects, L"UpdateEffects")
UI_MAP_NAME( m_funcAddEffect, L"AddEffect")
UI_END_MAP_CHILD_ELEMENTS()
@@ -45,7 +57,4 @@ protected:
virtual void customDraw(IggyCustomDrawCallbackRegion *region);
virtual void handleTimerComplete(int id);
private:
void updateEffectsDisplay();
};

View File

@@ -3796,7 +3796,11 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
else
{
ui.PlayUISFX(eSFX_Press);
app.LoadCrafting2x2Menu(iPad,player);
if(app.GetGameSettings(iPad,eGameSetting_ClassicCrafting))
app.LoadInventoryMenu(iPad,player);
else
app.LoadCrafting2x2Menu(iPad,player);
}
}

View File

@@ -1667,8 +1667,6 @@ void PlayerConnection::handleCraftItem(shared_ptr<CraftItemPacket> packet)
}
else
{
Recipy::INGREDIENTS_REQUIRED &req = pRecipeIngredientsRequired[iRecipe];
if (req.iType == RECIPE_TYPE_3x3 && dynamic_cast<CraftingMenu *>(player->containerMenu) == nullptr)
{