PlayerInventoryUI: resprite inventory
This commit is contained in:
@@ -105,23 +105,23 @@ local function getCompactForm(self, playerName)
|
||||
-- Removing the inventory background color:
|
||||
:bgcolor('#00000000', 'neither')
|
||||
-- A permanent part of the inventory:
|
||||
:background(0, 0.5, 14, 12.5, 'player_inventory_compact_middle_background.png', false)
|
||||
:background(0, 9.5, 14, 3, 'player_inventory_middle_background.png', false)
|
||||
:listColors('#00000000', '#e1b69150')
|
||||
:list('current_player', 'main', 1.5,9.75, 9,1)
|
||||
:list('current_player', 'main', 1.5,11.25, 9,1, 9)
|
||||
:list('current_player', 'main', 1.5, 9.75, 9,1)
|
||||
:list('current_player', 'main', 1.5, 11.25, 9,1, 9)
|
||||
-- Inventory mode switch button (compact/full):
|
||||
:imageButton(12.75, 10, 1, 0.5, 'player_inventory_compact_mode_button_on.png', 'change_compact_mode')
|
||||
-- Tab:
|
||||
:container(leftTab(self, playerName, 'left'), 1.5, 0.5)
|
||||
:container(leftTab(self, playerName, 'left'), 0, 0.5)
|
||||
-- Selection buttons for the (left) panel:
|
||||
:imageButton(1.5,0,2,0.5, leftTabButtonTextures[1],'select_left_craft_tab', core.colorize('#e1b691','craft'))
|
||||
:imageButton(3.5,0,2,0.5, leftTabButtonTextures[2], 'select_left_equip_tab', core.colorize('#e1b691','equip'))
|
||||
:imageButton(5.5,0,2,0.5, leftTabButtonTextures[3], 'select_left_bag_tab', core.colorize('#e1b691','bags'))
|
||||
:imageButton(7.5,0,2,0.5, leftTabButtonTextures[4], 'select_left_ref_tab', core.colorize('#e1b691','refs'))
|
||||
:imageButton(0,0,2,0.5, leftTabButtonTextures[1],'select_left_craft_tab', core.colorize('#e1b691','craft'))
|
||||
:imageButton(2,0,2,0.5, leftTabButtonTextures[2], 'select_left_equip_tab', core.colorize('#e1b691','equip'))
|
||||
:imageButton(4,0,2,0.5, leftTabButtonTextures[3], 'select_left_bag_tab', core.colorize('#e1b691','bags'))
|
||||
:imageButton(6,0,2,0.5, leftTabButtonTextures[4], 'select_left_ref_tab', core.colorize('#e1b691','refs'))
|
||||
|
||||
if self:getContex(playerName, 'node_tab') ~= nil then
|
||||
InventoryForm
|
||||
:imageButton(9.5,0,2,0.5, leftTabButtonTextures[5], 'select_left_node_tab', core.colorize('#e1b691','node'))
|
||||
:imageButton(8,0,2,0.5, leftTabButtonTextures[5], 'select_left_node_tab', core.colorize('#e1b691','node'))
|
||||
end
|
||||
|
||||
return InventoryForm:toString()
|
||||
@@ -160,7 +160,7 @@ local function getFullForm(self, playerName)
|
||||
end
|
||||
|
||||
local InventoryForm = Formspec:new({
|
||||
size = {x=22, y=12.5},
|
||||
size = {x=28, y=12.5},
|
||||
position = {x=0.5, y=0.55},
|
||||
noPrepend = true,
|
||||
})
|
||||
@@ -175,30 +175,31 @@ local function getFullForm(self, playerName)
|
||||
-- Removing the inventory background color:
|
||||
:bgcolor('#00000000', 'neither')
|
||||
-- A permanent part of the inventory:
|
||||
:background(0, 9.5, 22, 3, 'player_inventory_middle_background.png', false)
|
||||
:background(0, 9.5, 28, 1.5, 'player_inventory_middle_margin_background.png', false)
|
||||
:background(7, 9.5, 14, 3, 'player_inventory_middle_background.png', false)
|
||||
:listColors('#00000000', '#e1b69150')
|
||||
:list('current_player', 'main', 5.5,9.75, 9,1)
|
||||
:list('current_player', 'main', 5.5,11.25, 9,1, 9)
|
||||
:list('current_player', 'main', 8.5, 9.75, 9,1)
|
||||
:list('current_player', 'main', 8.5, 11.25, 9,1, 9)
|
||||
-- Inventory mode switch button (compact/full):
|
||||
:imageButton(16.75, 10, 1, 0.5, 'player_inventory_compact_mode_button_off.png', 'change_compact_mode')
|
||||
:imageButton(19.75, 10, 1, 0.5, 'player_inventory_compact_mode_button_off.png', 'change_compact_mode')
|
||||
-- Tabs:
|
||||
:container(leftTab(self, playerName, 'left'), 0, 0.5)
|
||||
:container(rightTab(self, playerName, 'right'), 11, 0.5)
|
||||
:container(rightTab(self, playerName, 'right'), 14, 0.5)
|
||||
-- Selection buttons for the left panel:
|
||||
:imageButton(0,0,2,0.5, leftTabButtonTextures[1],'select_left_craft_tab', core.colorize('#e1b691','craft'))
|
||||
:imageButton(2,0,2,0.5, leftTabButtonTextures[2], 'select_left_equip_tab', core.colorize('#e1b691','equip'))
|
||||
:imageButton(4,0,2,0.5, leftTabButtonTextures[3], 'select_left_bag_tab', core.colorize('#e1b691','bags'))
|
||||
:imageButton(6,0,2,0.5, leftTabButtonTextures[4], 'select_left_ref_tab', core.colorize('#e1b691','refs'))
|
||||
-- Selection buttons for the right panel:
|
||||
:imageButton(11,0,2,0.5, rightTabButtonTextures[1],'select_right_craft_tab', core.colorize('#e1b691','craft'))
|
||||
:imageButton(13,0,2,0.5, rightTabButtonTextures[2], 'select_right_equip_tab', core.colorize('#e1b691','equip'))
|
||||
:imageButton(15,0,2,0.5, rightTabButtonTextures[3], 'select_right_bag_tab', core.colorize('#e1b691','bags'))
|
||||
:imageButton(17,0,2,0.5, rightTabButtonTextures[4], 'select_right_ref_tab', core.colorize('#e1b691','refs'))
|
||||
:imageButton(14,0,2,0.5, rightTabButtonTextures[1],'select_right_craft_tab', core.colorize('#e1b691','craft'))
|
||||
:imageButton(16,0,2,0.5, rightTabButtonTextures[2], 'select_right_equip_tab', core.colorize('#e1b691','equip'))
|
||||
:imageButton(18,0,2,0.5, rightTabButtonTextures[3], 'select_right_bag_tab', core.colorize('#e1b691','bags'))
|
||||
:imageButton(20,0,2,0.5, rightTabButtonTextures[4], 'select_right_ref_tab', core.colorize('#e1b691','refs'))
|
||||
|
||||
if self:getContex(playerName, 'node_tab') ~= nil then
|
||||
InventoryForm
|
||||
:imageButton(8,0,2,0.5, leftTabButtonTextures[5], 'select_left_node_tab', core.colorize('#e1b691','node'))
|
||||
:imageButton(19,0,2,0.5, rightTabButtonTextures[5], 'select_right_node_tab', core.colorize('#e1b691','node'))
|
||||
:imageButton(22,0,2,0.5, rightTabButtonTextures[5], 'select_right_node_tab', core.colorize('#e1b691','node'))
|
||||
end
|
||||
|
||||
return InventoryForm:toString()
|
||||
|
||||
@@ -108,7 +108,7 @@ local function getCraftTabTemplate(self, playerName, tabType, tabName, handler)
|
||||
end
|
||||
|
||||
CraftTab
|
||||
:background(0, 0, 11, 9, 'player_inventory_craft_tab_background.png')
|
||||
:background(0, 0, 14, 9, 'player_inventory_craft_tab_background.png')
|
||||
:field(0.25, 0.5, 5, 0.75, tabType..'::'..tabName..'::craft_search_field', nil, searchFieldValue)
|
||||
:fieldCloseOnEnter(tabType..'::'..tabName..'::craft_search_field', false)
|
||||
:container(craftsListForm, 0.5, 1.5)
|
||||
|
||||
@@ -68,7 +68,7 @@ local function getBagTab(self, playerName, tabType)
|
||||
end
|
||||
|
||||
BagTab
|
||||
:image(0, 0, 11, 9, 'player_inventory_tab_background.png')
|
||||
:image(0, 0, 14, 9, 'player_inventory_tab_background.png')
|
||||
:scrollContainer(BagLists, 0, 0.5, 10.5, 8, 'bag_tab_scrollbar', 'vertical')
|
||||
|
||||
if containerHeight > 8 then
|
||||
|
||||
@@ -13,19 +13,22 @@ local function getEquipTab(self, playerName, tabType)
|
||||
local equipListsX = 4.5
|
||||
|
||||
EquipTab
|
||||
:image(0, 0, 11, 9, 'player_inventory_equip_tab_background.png')
|
||||
:image(0, 0, 14, 9, 'player_inventory_equip_tab_background.png')
|
||||
-- Equipment slots:
|
||||
:list('current_player', 'equip_head', 56/16, 45/16, 1, 1)
|
||||
:list('current_player', 'equip_head', 44/16, 33/16, 1, 1, 1)
|
||||
:list('current_player', 'equip_torso', 104/16, 45/16, 1, 1)
|
||||
:list('current_player', 'equip_torso', 116/16, 33/16, 1, 1, 1)
|
||||
:list('current_player', 'equip_legs', 56/16, 65/16, 1, 1)
|
||||
:list('current_player', 'equip_legs', 44/16, 77/16, 1, 1, 1)
|
||||
:list('current_player', 'equip_feet', 104/16, 65/16, 1, 1)
|
||||
:list('current_player', 'equip_feet', 116/16, 77/16, 1, 1, 1)
|
||||
:list('current_player', 'equip_left_thigh', 60/16, 97/16, 1, 1)
|
||||
:list('current_player', 'equip_back', 80/16, 97/16, 1, 1)
|
||||
:list('current_player', 'equip_right_thigh', 100/16, 97/16, 1, 1)
|
||||
:list('current_player', 'equip_head', 80/16, 45/16, 1, 1)
|
||||
:list('current_player', 'equip_head', 68/16, 33/16, 1, 1, 1)
|
||||
:list('current_player', 'equip_torso', 128/16, 45/16, 1, 1)
|
||||
:list('current_player', 'equip_torso', 140/16, 33/16, 1, 1, 1)
|
||||
:list('current_player', 'equip_legs', 80/16, 65/16, 1, 1)
|
||||
:list('current_player', 'equip_legs', 68/16, 77/16, 1, 1, 1)
|
||||
:list('current_player', 'equip_feet', 128/16, 65/16, 1, 1)
|
||||
:list('current_player', 'equip_feet', 140/16, 77/16, 1, 1, 1)
|
||||
:list('current_player', 'equip_left_thigh', 84/16, 97/16, 1, 1)
|
||||
:list('current_player', 'equip_back', 104/16, 97/16, 1, 1)
|
||||
:list('current_player', 'equip_right_thigh', 124/16, 97/16, 1, 1)
|
||||
-- TODO: слот для щита
|
||||
-- TODO: слоты для аксессуаров?
|
||||
|
||||
-- Hidden equipment slot for correct listing
|
||||
-- (distribute equipment across its slots while holding shift):
|
||||
:list('current_player', 'listring_equip', 0, 0, 1, 1)
|
||||
@@ -50,37 +53,37 @@ local function getEquipTab(self, playerName, tabType)
|
||||
|
||||
-- If the equipment slots are empty, then we apply an overlay.
|
||||
if inv:get_stack('equip_head', 1):is_empty() then
|
||||
EquipTab:image(56/16, 45/16, 1, 1, slotsOverlayTileSheet:t(0,0))
|
||||
EquipTab:image(80/16, 45/16, 1, 1, slotsOverlayTileSheet:t(0,0))
|
||||
end
|
||||
if inv:get_stack('equip_torso', 1):is_empty() then
|
||||
EquipTab:image(104/16, 45/16, 1, 1, slotsOverlayTileSheet:t(0,1))
|
||||
EquipTab:image(128/16, 45/16, 1, 1, slotsOverlayTileSheet:t(0,1))
|
||||
end
|
||||
if inv:get_stack('equip_legs', 1):is_empty() then
|
||||
EquipTab:image(56/16, 65/16, 1, 1, slotsOverlayTileSheet:t(0,2))
|
||||
EquipTab:image(80/16, 65/16, 1, 1, slotsOverlayTileSheet:t(0,2))
|
||||
end
|
||||
if inv:get_stack('equip_feet', 1):is_empty() then
|
||||
EquipTab:image(104/16, 65/16, 1, 1, slotsOverlayTileSheet:t(0,3))
|
||||
EquipTab:image(128/16, 65/16, 1, 1, slotsOverlayTileSheet:t(0,3))
|
||||
end
|
||||
if inv:get_stack('equip_head', 2):is_empty() then
|
||||
EquipTab:image(44/16, 33/16, 1, 1, slotsOverlayTileSheet:t(1,0))
|
||||
EquipTab:image(68/16, 33/16, 1, 1, slotsOverlayTileSheet:t(1,0))
|
||||
end
|
||||
if inv:get_stack('equip_torso', 2):is_empty() then
|
||||
EquipTab:image(116/16, 33/16, 1, 1, slotsOverlayTileSheet:t(1,1))
|
||||
EquipTab:image(140/16, 33/16, 1, 1, slotsOverlayTileSheet:t(1,1))
|
||||
end
|
||||
if inv:get_stack('equip_legs', 2):is_empty() then
|
||||
EquipTab:image(44/16, 77/16, 1, 1, slotsOverlayTileSheet:t(1,2))
|
||||
EquipTab:image(68/16, 77/16, 1, 1, slotsOverlayTileSheet:t(1,2))
|
||||
end
|
||||
if inv:get_stack('equip_feet', 2):is_empty() then
|
||||
EquipTab:image(116/16, 77/16, 1, 1, slotsOverlayTileSheet:t(1,3))
|
||||
EquipTab:image(140/16, 77/16, 1, 1, slotsOverlayTileSheet:t(1,3))
|
||||
end
|
||||
if inv:get_stack('equip_back', 1):is_empty() then
|
||||
EquipTab:image(80/16, 97/16, 1, 1, slotsOverlayTileSheet:t(0,4))
|
||||
EquipTab:image(104/16, 97/16, 1, 1, slotsOverlayTileSheet:t(0,4))
|
||||
end
|
||||
if inv:get_stack('equip_left_thigh', 1):is_empty() then
|
||||
EquipTab:image(60/16, 97/16, 1, 1, slotsOverlayTileSheet:t(1,4))
|
||||
EquipTab:image(84/16, 97/16, 1, 1, slotsOverlayTileSheet:t(1,4))
|
||||
end
|
||||
if inv:get_stack('equip_right_thigh', 1):is_empty() then
|
||||
EquipTab:image(100/16, 97/16, 1, 1, slotsOverlayTileSheet:t(1,4))
|
||||
EquipTab:image(124/16, 97/16, 1, 1, slotsOverlayTileSheet:t(1,4))
|
||||
end
|
||||
|
||||
return EquipTab
|
||||
|
||||
@@ -8,7 +8,7 @@ local function getRefTab(self, playerName, tabType)
|
||||
local RefTab = Formspec:new()
|
||||
|
||||
RefTab
|
||||
:image(0, 0, 11, 9, 'player_inventory_tab_background.png')
|
||||
:image(0, 0, 14, 9, 'player_inventory_tab_background.png')
|
||||
:label(2,2, 'REFERENCE PANE')
|
||||
|
||||
return RefTab
|
||||
|
||||
Reference in New Issue
Block a user